From 3bf080b3a2732a5d6c5dd82b18510d50fc8f80cc Mon Sep 17 00:00:00 2001 From: wys Date: Wed, 7 Aug 2024 22:37:01 +0800 Subject: [PATCH 1/3] .gitignore --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2d1450f --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/debian/files +/debian/nfs-ai.debhelper.log +/debian/nfs-ai.substvars +/debian/.debhelper +/debian/nfs-ai -- Gitee From 6af08cc139e7c021808af2e8d86c178ad9e25f98 Mon Sep 17 00:00:00 2001 From: wys <1377030423@qq.com> Date: Thu, 8 Aug 2024 11:20:51 +0800 Subject: [PATCH 2/3] setting memu finished --- usr/share/aiassistant/data/icon_setting.png | Bin 0 -> 3662 bytes usr/share/aiassistant/mainwin.py | 77 +++++++++++++++++++- 2 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 usr/share/aiassistant/data/icon_setting.png diff --git a/usr/share/aiassistant/data/icon_setting.png b/usr/share/aiassistant/data/icon_setting.png new file mode 100644 index 0000000000000000000000000000000000000000..54d88bf0bf53dfce77c8c24a0b8ba6c27cfdcb44 GIT binary patch literal 3662 zcmaJ@c{r5)8h&kMi6px)MzmOFK`|NoGRiu(Q7L0)Fqoy8!Hgu5HrcXeO(@h*N|9_8 zAzKs)WyzAzkdQ2$@tv>loIg(Iz24=wJoo+F&+@yj_p+nCwWzSXFaQ9eHYf`;_ba>k z2yWrNheMD*06^HBXm0LkV{Q(j(kMQ}Kmq_T`?H-xFiFeOMnlVl?QUj$b7g6PkpNhg zE!ZsXktco)z@8VEFlmgwBMuj!RbM`K)%>wi@qEPQk( zlruZK`fjy)GHY_JgVnh`Vuyr!;zXW5V1SM`MD!`gJD?g`Y9e^0P{aHn@rl;wz5Kz zCSYy;`cj?Ip-iR6jAUF<_u-(K9h)6fnYy&|0ynwmV&UQYKEnhCQyKcDnBsIDc z#RJs0rnILW>DG~~OnEII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Ne%Nf3WaBVmJGNMCE$6Akc`x1iTfELIV92GlKX>EeEas$oDrE z|7R`GKVl(VF_6v5{#T`cFLB#vbNEm1awq?EKY`3`c^bF3uM_gH+;c&;u`qRE_IukN zIfBbo^YYGx$v%p}i+tsoKPxp_DdS7%JjNoct!7LH70IQTJS^-w%cvHOt518GyJK5G1bH U?c05zZSzRlSlU~Znt7f37c>fM&j0`b literal 0 HcmV?d00001 diff --git a/usr/share/aiassistant/mainwin.py b/usr/share/aiassistant/mainwin.py index bd63409..514e636 100644 --- a/usr/share/aiassistant/mainwin.py +++ b/usr/share/aiassistant/mainwin.py @@ -81,6 +81,7 @@ class ShadowWindow(QWidget): title_spacer = QSpacerItem(40, 10, QSizePolicy.Expanding, QSizePolicy.Minimum) title_layout.addItem(title_spacer) + # home button home_btn = QPushButton(title) home_btn.setFixedSize(24, 24) home_btn.setFlat(True) @@ -97,7 +98,28 @@ class ShadowWindow(QWidget): ) home_btn.setFixedSize(24, 24) title_layout.addWidget(home_btn) - + + # setting_ button + setting_btn = QPushButton(title) + setting_btn.setIcon(QIcon('./data/icon_setting.png')) + setting_btn.setIconSize(QSize(24, 24)); + setting_btn.setFixedSize(24, 24) + title_layout.addWidget(setting_btn) + setting_btn.setStyleSheet( + ''' + QPushButton{background-color:transparent;border:none;color:white;} + ''' + ) + + + menu = SettingMenu(self) + menu.addAction("显示模式") + menu.addAction("设置") + menu.addSeparator() + menu.addAction("关于") + setting_btn.setMenu(menu) + + # close button close_btn = QPushButton(title) close_btn.setFixedSize(24, 24) close_btn.setStyleSheet( @@ -675,3 +697,56 @@ class Mainwin(QWidget): # widget.show() # app.exec_() + +class SettingMenu(QMenu): + def __init__(self, *args, **kwargs): + super(SettingMenu, self).__init__() + self.radius = 5 + self.setStyleSheet( + ''' + QMenu {{ + /* 半透明效果 */ + border-radius: {radius}; + border: 2px solid rgb(255, 255, 255); + background-color: rgba(255, 255, 255, 230); + }} + + QMenu::item {{ + border-radius: {radius}; + /* 这个距离很麻烦需要根据菜单的长度和图标等因素微调 */ + padding: 8px 48px 8px 12px; /* 36px是文字距离左侧距离*/ + background-color: transparent; + }} + + /* 鼠标悬停和按下效果 */ + QMenu::item:selected {{ + border-radius: {radius}; + /* 半透明效果 */ + background-color: rgba(230, 240, 255, 232); + }} + + /* 禁用效果 */ + QMenu::item:disabled {{ + border-radius: {radius}; + background-color: transparent; + }} + + /* 图标距离左侧距离 */ + QMenu::icon {{ + left: 15px; + }} + + /* 分割线效果 */ + QMenu::separator {{ + height: 1px; + background-color: rgb(232, 236, 243); + }} + '''.format(radius=self.radius)) + + def resizeEvent(self, event): + # 添加蒙版 + path = QPainterPath() + path.addRoundedRect(QRectF(self.rect()), self.radius, self.radius) + region = QRegion(path.toFillPolygon(QTransform()).toPolygon()) + self.setMask(region) + -- Gitee From 9fd7ebcfbe36fc7967c3fed1e0e4510ce70f847d Mon Sep 17 00:00:00 2001 From: wuyuesong <1377030423@qq.com> Date: Sun, 27 Oct 2024 23:04:47 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=A8=A1=E5=BC=8F=E4=BA=8C=E7=BA=A7=E5=AD=90=E8=8F=9C?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/share/aiassistant/mainwin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr/share/aiassistant/mainwin.py b/usr/share/aiassistant/mainwin.py index 514e636..a1a4c0e 100644 --- a/usr/share/aiassistant/mainwin.py +++ b/usr/share/aiassistant/mainwin.py @@ -113,7 +113,9 @@ class ShadowWindow(QWidget): menu = SettingMenu(self) - menu.addAction("显示模式") + sub_menu = menu.addMenu("显示模式") + sub_menu.addAction("窗口模式") + sub_menu.addAction("侧边栏模式") menu.addAction("设置") menu.addSeparator() menu.addAction("关于") -- Gitee