Skip to content

Commit

Permalink
refactor: adjust package structure
Browse files Browse the repository at this point in the history
  • Loading branch information
ChinaIceF committed Jul 25, 2024
1 parent 385d2e6 commit b4c12a7
Show file tree
Hide file tree
Showing 21 changed files with 32 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,13 @@ def __init__(self, *args, **kwargs):

# 滑条
self.option_card_slider = WidgetsExampleOptionCardPlane(self)
self.option_card_slider.setTitle("输入框")
self.option_card_slider.setTitle("滑条")
self.option_card_slider.setFixedWidth(300)

slider = SiSliderH(self)
slider.setFixedHeight(32)
slider.setMinimum(-20)
slider.setMaximum(20)

self.option_card_slider.body().setAdjustWidgetsSize(True)
self.option_card_slider.body().addWidget(slider)
Expand Down
2 changes: 1 addition & 1 deletion examples/TODO list/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from siui.core.animation import SiExpAnimation
from siui.core.color import Color
from siui.core.globals import NewGlobal, SiGlobal
from siui.gui.tooltip import ToolTipWindow
from siui.components.tooltip.tooltip import ToolTipWindow

# 创建删除队列
SiGlobal.todo_list = NewGlobal()
Expand Down
11 changes: 3 additions & 8 deletions siui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@


import siui
import siui.components as components
import siui.components.widgets as widgets
import siui.core as core
import siui.core.globals
import siui.gui as gui
import siui.components.widgets as widgets
import siui.templates as templates

import siui

# 载入色彩字典
# siui.core.globals.SiGlobal.siui.loadColors(siui.gui.colorsets.ColorsetDark.colors)
siui.core.globals.SiGlobal.siui.colors = siui.gui.colorsets.DarkColorGroup()

# 加载全局缩放比例
siui.gui.reload_scale_factor()
siui.gui.scale.reload_scale_factor()
2 changes: 1 addition & 1 deletion siui/components/option_card/abstracts/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from siui.components.option_card.abstracts.option_card import *
from siui.components.option_card.abstracts.option_card import ABCSiOptionCardPlane
2 changes: 1 addition & 1 deletion siui/components/option_card/abstracts/option_card.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from siui.core.globals import SiGlobal
from siui.components.widgets import SiDenseHContainer, SiDenseVContainer, SiLabel
from siui.core.globals.globals import SiGlobal


class ABCSiOptionCardPlane(SiLabel):
Expand Down
1 change: 1 addition & 0 deletions siui/components/tooltip/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from siui.components.tooltip.tooltip import ToolTipWindow
File renamed without changes.
7 changes: 6 additions & 1 deletion siui/components/widgets/abstracts/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
from siui.components.widgets.abstracts.widget import SiWidget
from siui.components.widgets.label import SiLabel
from siui.core.animation import SiExpAnimation
from siui.core.globals import SiGlobal
from siui.core.color import SiColor
from siui.core.globals import SiGlobal
from siui.gui.color_group import SiColorGroup

SiGlobal.siui.colors

class ABCButton(QPushButton):
"""
Expand All @@ -24,6 +26,9 @@ def __init__(self, *args, **kwargs):
# 工具提示内容
self.hint = ""

# 颜色组
self.color_group = SiColorGroup(reference=SiGlobal.siui.colors)

# 颜色,通常 color_a 是按钮主题色
self.color_a = None
self.color_b = None
Expand Down
1 change: 0 additions & 1 deletion siui/components/widgets/abstracts/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from siui.core.animation import SiAnimationGroup, SiExpAnimation
from siui.core.color import SiColor
from siui.core.globals import SiGlobal
from siui.core.silicon import Si


Expand Down
2 changes: 1 addition & 1 deletion siui/components/widgets/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from siui.core.animation import SiExpAnimation
from siui.core.color import SiColor
from siui.core.globals import SiGlobal
from siui.gui import GlobalFont, SiFont
from siui.core.silicon import Si
from siui.gui.font import GlobalFont, SiFont


class SiPushButton(ABCPushButton):
Expand Down
2 changes: 1 addition & 1 deletion siui/components/widgets/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from PyQt5.QtSvg import QSvgWidget

from siui.components.widgets.abstracts.label import ABCAnimatedLabel
from siui.core.globals import SiGlobal
from siui.core.globals.globals import SiGlobal
from siui.core.silicon import Si


Expand Down
2 changes: 1 addition & 1 deletion siui/core/globals/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from siui.core.globals.globals import SiGlobal, NewGlobal
from siui.core.globals.globals import SiGlobal
7 changes: 5 additions & 2 deletions siui/core/globals/globals.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import time

from siui.gui.color_group import DarkColorGroup
from siui.gui.font import GlobalFontDict


class SiliconUIGlobal:
"""
Expand All @@ -11,7 +14,7 @@ class SiliconUIGlobal:

# 颜色字典,存储全部动态设置的颜色
# 值为 RRGGBB 或 AARRGGBB 色号
colors = {}
colors = DarkColorGroup()

# 图标字典,储存所有 SVG 类型的图标数据
# 值为 SVG信息的 bytes
Expand All @@ -23,7 +26,7 @@ class SiliconUIGlobal:

# 字体字典,储存所有字体
# 值为 QFont 类型的字体
fonts = {}
fonts = GlobalFontDict.fonts

def loadWindows(self, dictionary):
SiliconUIGlobal.windows.update(dictionary)
Expand Down
5 changes: 2 additions & 3 deletions siui/gui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

from siui.gui.colorsets import SiColor, ColorsetDark
from siui.gui.font import GlobalFont, SiFont
from siui.gui.color_group import *
from siui.gui.font import *
from siui.gui.scale import *
from siui.gui.tooltip import ToolTipWindow
1 change: 1 addition & 0 deletions siui/gui/color_group/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from siui.gui.color_group.color_group import SiColorGroup, ColorsetDark, DarkColorGroup
File renamed without changes.
1 change: 1 addition & 0 deletions siui/gui/font/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from siui.gui.font.font import SiFont, GlobalFontDict, GlobalFont
6 changes: 2 additions & 4 deletions siui/gui/font.py → siui/gui/font/font.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from PyQt5.QtGui import QFont

from siui.core.globals import SiGlobal

class SiFont:
@staticmethod
Expand Down Expand Up @@ -75,6 +74,5 @@ class GlobalFontDict:
fonts["L_BOLD_ITALIC"] = GlobalFont.L_BOLD_ITALIC.value
fonts["XL_BOLD_ITALIC"] = GlobalFont.XL_BOLD_ITALIC.value


# 合并到全局字体
SiGlobal.siui.fonts.update(GlobalFontDict.fonts)
def get_font_dict(self):
return self.fonts
1 change: 1 addition & 0 deletions siui/gui/scale/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from siui.gui.scale.scale import *
File renamed without changes.
2 changes: 1 addition & 1 deletion siui/templates/application/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from siui.components.widgets import SiDenseHContainer, SiDenseVContainer, SiLabel, SiPixLabel, SiSimpleButton
from siui.core.globals import SiGlobal
from siui.core.silicon import Si
from siui.gui import ToolTipWindow
from siui.components.tooltip import ToolTipWindow

from .page_view import PageView

Expand Down

0 comments on commit b4c12a7

Please sign in to comment.