Skip to content

Commit 8f04b72

Browse files
committed
hotfix: fixed FileNotFoundError in icon package parser
1 parent b14d5b1 commit 8f04b72

File tree

6 files changed

+60
-33
lines changed

6 files changed

+60
-33
lines changed

examples/Gallery for siui/components/page_widgets/page_widgets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from PyQt5.QtCore import Qt
55
from PyQt5.QtGui import QCursor
66

7-
from siui.components import SiTitledWidgetGroup, SiCircularProgressBar, SiWidget, SiOptionCardLinear
7+
from siui.components import SiCircularProgressBar, SiOptionCardLinear, SiTitledWidgetGroup, SiWidget
88
from siui.components.combobox import SiComboBox
99
from siui.components.menu import SiMenu
1010
from siui.components.page import SiPage
@@ -18,13 +18,13 @@
1818
SiIconLabel,
1919
SiLabel,
2020
SiLongPressButton,
21+
SiMasonryContainer,
2122
SiPixLabel,
2223
SiPushButton,
2324
SiRadioButton,
2425
SiSimpleButton,
2526
SiSwitch,
2627
SiToggleButton,
27-
SiMasonryContainer,
2828
)
2929
from siui.components.widgets.navigation_bar import SiNavigationBarH
3030
from siui.core.color import SiColor

setup.py

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,47 @@
1-
from setuptools import setup, find_packages
1+
from setuptools import find_packages, setup
22

33
# 定义项目需要的依赖项
44
install_requires = [
5-
'PyQt5>=5.15.10',
6-
'numpy'
5+
"PyQt5>=5.15.10",
6+
"numpy",
7+
"pyperclip",
78
]
89

910
# 定义项目元数据
1011
setup(
11-
name = 'PyQt-SiliconUI',
12-
version = '1.01',
13-
packages = find_packages(exclude = ['examples']), # 自动找到所有包
14-
include_package_data = True, # 包含包中的数据文件(如果有的话)
12+
name = "PyQt-SiliconUI",
13+
version = "1.01",
14+
packages = find_packages(exclude = ["examples"]), # 自动找到所有包
15+
data_files=[("./siui/gui/icons/packages", ["./siui/gui/icons/packages/fluent_ui_icon_filled.icons",
16+
"./siui/gui/icons/packages/fluent_ui_icon_regular.icons",
17+
"./siui/gui/icons/packages/fluent_ui_icon_light.icons"]),],
18+
include_package_data = True,
1519
install_requires = install_requires, # 依赖项列表
1620
# 以下为可选元数据
17-
description = 'A powerful and artistic UI library based on PyQt5 / PySide6', # 包的简短描述
18-
long_description = open('README.md', encoding='utf-8').read(), # 包的详细描述,通常来自README文件
19-
long_description_content_type = 'text/markdown', # README文件的格式
20-
url = 'https://github.com/ChinaIceF/PyQt-SiliconUI', # 项目主页
21-
author = 'ChinaIceF', # 作者名
22-
author_email = 'ChinaIceF@outlook.com', # 作者邮箱
23-
license = 'GPL-3.0', # 许可证
21+
description = "A powerful and artistic UI library based on PyQt5 / PySide6", # 包的简短描述
22+
long_description = open("README.md", encoding="utf-8").read(), # 包的详细描述,通常来自README文件
23+
long_description_content_type = "text/markdown", # README文件的格式
24+
url = "https://github.com/ChinaIceF/PyQt-SiliconUI", # 项目主页
25+
author = "ChinaIceF", # 作者名
26+
author_email = "ChinaIceF@outlook.com", # 作者邮箱
27+
license = "GPL-3.0", # 许可证
2428
classifiers=[ # 项目的分类信息
25-
'Development Status :: 3 - Alpha',
26-
'Intended Audience :: Developers',
27-
'License :: OSI Approved :: GPL-3.0 License',
28-
'Programming Language :: Python :: 3',
29-
'Programming Language :: Python :: 3.6',
30-
'Programming Language :: Python :: 3.7',
31-
'Programming Language :: Python :: 3.8',
32-
'Programming Language :: Python :: 3.9',
33-
'Programming Language :: Python :: 3.10',
34-
'Programming Language :: Python :: 3.11',
35-
'Programming Language :: Python :: 3.12',
36-
'Topic :: Software Development :: Libraries :: Python Modules',
29+
"Development Status :: 3 - Alpha",
30+
"Intended Audience :: Developers",
31+
"License :: OSI Approved :: GPL-3.0 License",
32+
"Programming Language :: Python :: 3",
33+
"Programming Language :: Python :: 3.6",
34+
"Programming Language :: Python :: 3.7",
35+
"Programming Language :: Python :: 3.8",
36+
"Programming Language :: Python :: 3.9",
37+
"Programming Language :: Python :: 3.10",
38+
"Programming Language :: Python :: 3.11",
39+
"Programming Language :: Python :: 3.12",
40+
"Topic :: Software Development :: Libraries :: Python Modules",
3741
],
3842
entry_points={ # 如果包是可执行的,定义入口点
39-
'console_scripts': [
40-
''
43+
"console_scripts": [
44+
""
4145
],
4246
},
4347
)

siui/components/widgets/button.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ def setUseTransition(self, b: bool):
7272
self.use_transition = b
7373

7474

75+
class SiTextButton(ABCButton):
76+
def __init__(self, *args, **kwargs):
77+
super().__init__(*args, **kwargs)
78+
79+
self.label_ = SiLabel(self)
80+
81+
def reloadStyleSheet(self):
82+
super().reloadStyleSheet()
83+
self.label_.setTextColor(self.colorGroup().fromToken(SiColor.BUTTON_TEXT_BUTTON_IDLE))
84+
85+
def label(self):
86+
return self.label_
87+
88+
7589
class SiLongPressButton(ABCPushButton):
7690
"""
7791
需要持续长按一段时间才能触发点击事件的按钮,可以设置文字、图标或是兼有\n

siui/core/color/color.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class SiColor(Enum):
2828
TEXT_C = auto()
2929
TEXT_D = auto()
3030
TEXT_E = auto()
31+
TEXT_THEME = auto()
3132

3233
TITLE_INDICATOR = auto()
3334
TITLE_HIGHLIGHT = auto()
@@ -59,6 +60,10 @@ class SiColor(Enum):
5960
BUTTON_ON = auto()
6061
BUTTON_OFF = auto()
6162

63+
BUTTON_TEXT_BUTTON_FLASH = auto()
64+
BUTTON_TEXT_BUTTON_HOVER = auto()
65+
BUTTON_TEXT_BUTTON_IDLE = auto()
66+
6267
# LONG_PRESS_BUTTON
6368
BUTTON_LONG_PRESS_PANEL = auto()
6469
BUTTON_LONG_PRESS_SHADOW = auto()

siui/gui/color_group/color_group.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def __init__(self):
8585
self.assign(SiColor.TEXT_C, "#C7C7C7")
8686
self.assign(SiColor.TEXT_D, "#AFAFAF")
8787
self.assign(SiColor.TEXT_E, "#979797")
88+
self.assign(SiColor.TEXT_THEME, "#c58bc2")
8889

8990
self.assign(SiColor.SIDE_MSG_FLASH, "#90FFFFFF")
9091
self.assign(SiColor.SIDE_MSG_THEME_NORMAL, "#242027")
@@ -123,6 +124,10 @@ def __init__(self):
123124
self.assign(SiColor.CHECKBOX_UNCHECKED, "#979797")
124125
self.assign(SiColor.CHECKBOX_CHECKED, "#9c65ae")
125126

127+
self.assign(SiColor.BUTTON_TEXT_BUTTON_IDLE, "#c58bc2")
128+
self.assign(SiColor.BUTTON_TEXT_BUTTON_FLASH, "#FFFFFF")
129+
self.assign(SiColor.BUTTON_TEXT_BUTTON_HOVER, "#DFDFDF")
130+
126131
# 长按按钮
127132
self.assign(SiColor.BUTTON_LONG_PRESS_PANEL, "#932a48")
128133
self.assign(SiColor.BUTTON_LONG_PRESS_SHADOW, "#642d41")

siui/gui/icons/parser.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import os
22

3-
from siui.core.color import SiColor
4-
53

64
class SiGlobalIconPack:
75
current_module_path = os.path.dirname(os.path.abspath(__file__))
@@ -24,7 +22,8 @@ def set_default_color(self, code):
2422
def reload_internals(self):
2523
for package_filename in os.listdir(self.package_folder_path):
2624
full_path = os.path.join(self.package_folder_path, package_filename)
27-
self.load_from_file(full_path)
25+
if os.path.isfile(full_path):
26+
self.load_from_file(full_path)
2827

2928
def load_from_file(self, path):
3029
class_name = os.path.basename(path)

0 commit comments

Comments
 (0)