diff --git a/examples/Gallery/components/ExperimentField.py b/examples/Gallery/components/ExperimentField.py
deleted file mode 100644
index 2784f5d..0000000
--- a/examples/Gallery/components/ExperimentField.py
+++ /dev/null
@@ -1,297 +0,0 @@
-import SiliconUI.SiGlobal as SiGlobal
-from SiliconUI.SiFont import *
-from siui.components import SiOptionCardLinear, SiOptionCardPlane, SiSliderH, SiProgressBar, SiTitledWidgetGroup
-from siui.components.widgets import (
- SiCheckBox,
- SiDenseHContainer,
- SiDenseVContainer,
- SiLabel,
- SiLongPressButton,
- SiPushButton,
- SiRadioButton,
- SiScrollArea,
- SiSimpleButton,
- SiSwitch,
- SiToggleButton,
- SiLineEdit,
-)
-
-from .experifield.music_info_placeholder import MusicInfoPlaceholder
-import random
-
-
-class ExperimentField(SiliconUI.SiScrollFrame):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.setStyleSheet('')
-
- self.discription = SiliconUI.SiOption(self)
- self.discription.setIcon(SiGlobal.icons.get('fi-rr-bulb'))
- self.discription.setText('实验场',
- '欢迎来到 Silicon 试验场。这里有一些由控件组合出来的小组件,展现 Silicon UI 蕴含的创造力与设计艺术')
-
- ## ================ Stack 开始 ===================
-
- self.stack_music_info_placeholder = SiliconUI.SiCategory(self)
- self.stack_music_info_placeholder.setTitle('音乐信息展示板')
-
- self.layout_music_info_placeholder = SiliconUI.SiLayoutH(self)
-
- # 其一
- self.music_info_placeholder = MusicInfoPlaceholder(self)
- self.music_info_placeholder.load('./img/cover.jpeg')
- self.music_info_placeholder.setText(
- title='只因你太美',
- artist='我家鸽鸽',
- album='你干嘛嗨嗨呦',
- )
- self.music_info_placeholder.resize(380, 132)
- self.music_info_placeholder.setProgress(0.7)
-
- # 其二
- self.music_info_placeholder_2 = MusicInfoPlaceholder(self)
- self.music_info_placeholder_2.load('./img/cover2.jpg')
- self.music_info_placeholder_2.setText(
- title='Axolotl',
- artist='C418',
- album='Axolotl',
- )
- self.music_info_placeholder_2.resize(380, 132)
- self.music_info_placeholder_2.setProgress(0)
-
- self.layout_music_info_placeholder.addItem(self.music_info_placeholder)
- self.layout_music_info_placeholder.addItem(self.music_info_placeholder_2)
-
- self.stack_music_info_placeholder.addItem(self.layout_music_info_placeholder)
-
- ## ================ Stack 开始 ===================
-
- self.stack_reconstruct_test = SiliconUI.SiCategory(self)
- self.stack_reconstruct_test.setTitle('重构测试')
-
- self.reconstruct_discription = SiliconUI.SiOption(self)
- self.reconstruct_discription.setIcon(SiGlobal.icons.get('fi-rr-bulb'))
- self.reconstruct_discription.setText('这里是重构测试', '此处进行项目重构的各种测试')
-
- self.button_layout = SiliconUI.SiLayoutH(self)
- self.button_layout.setFixedHeight(32)
-
- self.test_new_button = SiPushButton(self)
- self.test_new_button.setFixedSize(128, 32)
- self.test_new_button.attachment().setText("重构按钮")
- self.test_new_button.setHint("还有工具提示")
- self.test_new_button.setUseTransition(True)
-
- self.test_new_button2 = SiLongPressButton(self)
- self.test_new_button2.setFixedSize(128, 32)
- self.test_new_button2.attachment().load(SiGlobal.icons.get('fi-rr-bulb'))
- self.test_new_button2.attachment().setText("新增图标")
- self.test_new_button2.clicked.connect(lambda: print("点击事件触发"))
- self.test_new_button2.longPressed.connect(lambda: print("长按事件触发"))
-
- self.test_new_button3 = SiPushButton(self)
- self.test_new_button3.setFixedSize(48, 32)
- self.test_new_button3.attachment().load(SiGlobal.icons.get('fi-rr-disk'))
-
- self.test_new_button4 = SiToggleButton(self)
- self.test_new_button4.attachment().load(SiGlobal.icons.get('fi-rr-disk'))
- self.test_new_button4.attachment().setText("自动保存模式")
- self.test_new_button4.adjustSize()
-
- self.test_new_button5 = SiRadioButton(self)
- self.test_new_button5.setText("赤石")
-
- self.test_new_button6 = SiRadioButton(self)
- self.test_new_button6.setText("豪赤啊")
-
- self.test_new_button7 = SiRadioButton(self)
- self.test_new_button7.setText("吃饱了")
-
- self.button_layout.addItem(self.test_new_button)
- self.button_layout.addItem(self.test_new_button2)
- self.button_layout.addItem(self.test_new_button3)
- self.button_layout.addItem(self.test_new_button4)
- self.button_layout.addItem(self.test_new_button5)
- self.button_layout.addItem(self.test_new_button6)
- self.button_layout.addItem(self.test_new_button7)
-
- self.button_layout2 = SiliconUI.SiLayoutH(self)
- self.button_layout2.setFixedHeight(32)
- self.button_layout2.setAlignment(Qt.AlignCenter)
-
- self.test_new_button8 = SiCheckBox(self)
- self.test_new_button8.setText("鸡你太美")
-
- self.test_new_button9 = SiCheckBox(self)
- self.test_new_button9.setText("你干嘛嗨嗨呦")
-
- self.switch_test = SiSwitch(self)
-
- self.button_layout2.addItem(self.test_new_button8)
- self.button_layout2.addItem(self.test_new_button9)
- self.button_layout2.addItem(self.switch_test)
-
- self.container_h = SiDenseHContainer(self)
- self.container_h.setFixedHeight(128)
- self.container_h.setAdjustWidgetsSize(True)
- self.container_h.setStyleSheet("background-color: #05ffffff")
-
- self.container_v_left = SiDenseVContainer(self)
- self.container_v_left.setFixedWidth(128)
- self.container_v_left.setStyleSheet("background-color: #05ffffff")
-
- self.container_v_right = SiDenseVContainer(self)
- self.container_v_right.setFixedWidth(128)
- self.container_v_right.setStyleSheet("background-color: #05ffffff")
-
- self.button_lefttop = SiPushButton(self)
- self.button_lefttop.setFixedSize(128, 32)
- self.button_lefttop.attachment().load(SiGlobal.icons.get('fi-rr-bulb'))
- self.button_lefttop.attachment().setText("左上角")
-
- self.button_leftbottom = SiPushButton(self)
- self.button_leftbottom.setFixedSize(128, 32)
- self.button_leftbottom.attachment().load(SiGlobal.icons.get('fi-rr-bulb'))
- self.button_leftbottom.attachment().setText("左下角")
-
- self.button_righttop = SiPushButton(self)
- self.button_righttop.setFixedSize(128, 32)
- self.button_righttop.attachment().load(SiGlobal.icons.get('fi-rr-bulb'))
- self.button_righttop.attachment().setText("右上角")
-
- self.button_rightbottom = SiPushButton(self)
- self.button_rightbottom.setFixedSize(128, 32)
- self.button_rightbottom.attachment().load(SiGlobal.icons.get('fi-rr-bulb'))
- self.button_rightbottom.attachment().setText("右下角")
-
- self.container_v_left.addWidget(self.button_lefttop)
- self.container_v_left.addWidget(self.button_leftbottom, "bottom")
-
- self.container_v_right.addWidget(self.button_righttop)
- self.container_v_right.addWidget(self.button_rightbottom, "bottom")
-
-
- self.container_h.addWidget(self.container_v_left)
- self.container_h.addWidget(self.container_v_right, "right")
-
- self.alabel = SiLabel(self)
- self.alabel.setAutoAdjustSize(True)
- self.alabel.setHint("你触发了工具提示")
- self.alabel.setText(
-"""
-合成器是一种在接收到红石信号时自动合成并丢出产物的方块。
-合成器可以用5个铁锭、1个工作台、2个红石粉和1个投掷器合成。
-合成器拥有3×3的合成方格,允许多名玩家同时操作。合成方格的每个槽位都可以被单独禁用,空手单击槽位可禁用该槽位,再次点击可取消禁用。
-依照合成配方在合成器的合成方格内摆放物品时,右边的输出槽会显示产物,但不能像工作台一样直接取走产物。
-漏斗、投掷器和其他合成器可以与合成器的任何一面互动,将物品转入合成器的未禁用槽位。漏斗和漏斗矿车可以从合成器中取出物品。
-被激活后,合成器会消耗合成方格中的材料合成一份产物,同时将产物从正面掷出。如果合成器的前方存在容器(包括另一个合成器),且容器的槽位允许接收该产物,那么产物会直接存入容器。
-图为Minecraft Live 2023展示的合成器。
-在创造模式中,玩家拥有无限的方块用于创造,没有生命值、饥饿值和氧气值来阻碍他们的建造,因此不必担心有危险。创造模式允许玩家在没有拿剑、三叉戟或重锤时瞬间破坏大多数的方块,包括像基岩和末地传送门这种正常情况下不能破坏的方块,除隐形基岩[仅基岩版]等。使用一次性的物品不会使其被消耗。武器与工具也不会有耐久度的限制,不会损坏。由创造模式玩家发射的箭只能被创造模式玩家捡起。
-
-创造模式给予玩家额外0.5格方块交互距离和额外2格实体交互距离。
-
-创造模式给予玩家飞行的能力。玩家可通过快速按两下跳跃起飞,并通过按住跳跃上升高度,或通过潜行降低高度和着陆;使用移动可在同一高度下移动。另外,玩家在空中快速按两下跳跃可离开飞行状态并掉下来。在Java版中,如果飞行时降落在方块上,玩家会自动退出飞行状态;基岩版中则不会,但速度仍会降到行走的速度。飞行时进入矿车和床后再离开后,玩家将仍然处于飞行状态。
-
-
-在创造模式中飞行的玩家
-在Java版中,玩家在创造模式中无法受到除虚空和/kill外的伤害。当玩家的Y坐标低于世界建筑下限64格或更多时,就会受到虚空伤害;反之如果在世界建筑下限下方64格内,就不会受到虚空伤害,并可以在虚空中飞行。
-
-在基岩版中,玩家在创造模式下不会受到任何伤害。如果在基岩版试图使用/kill杀死创造模式的玩家,聊天栏会提示“玩家在创造模式下无法被杀死”。
-
-生物仍然会像在其他游戏模式中那样生成(包括从刷怪笼中生成),但都永远不会攻击玩家,也不会因被玩家攻击或其他在生存模式中可行的激怒方式被激怒。玩家在创造模式进入末地后,末影龙不会攻击玩家。在Java版中,即使玩家在创造模式下,增援的僵尸仍然会试图攻击玩家,不过不会造成任何伤害,并且在几秒后就会停止攻击。[1]
-
-当一个世界被创建后,如果开启了作弊,可以通过/gamemode creative命令或设置[仅基岩版]来切换到创造模式。在多人游戏中,管理员可以通过/gamemode命令单独切换每一名玩家的游戏模式。这意味着在一个生存模式的世界中(根据管理员的意愿)玩家也可以使用创造模式,反之亦然。新玩家的默认游戏模式也能通过/defaultgamemode命令[仅Java版]或设置中默认游戏模式[仅基岩版]来切换。
-
-如果游戏能确定方块是被创造模式的玩家所破坏的,那么不会有任何掉落物出现(潜影盒和蜂巢除外)。如果游戏不能确定,方块的物品形式仍会掉落。[2]
-
-在基岩版中,无论是以创造模式创建新的世界还是进入旧的世界,都将永久关闭该世界的成就和排行榜的更新,但这并不会对游戏内容造成任何影响。换言之,成就和排行榜只有在一直保持在生存模式或冒险模式下才有效。
-
-"""
- )
-
- self.scrollarea = SiScrollArea(self)
- self.scrollarea.setFixedHeight(256)
- self.scrollarea.setAttachment(self.alabel)
-
- # 新测试
- self.titled_widget_group = SiTitledWidgetGroup(self)
-
- self.button_for_option_card = SiPushButton(self)
- self.button_for_option_card.attachment().setText("刷新")
- self.button_for_option_card.resize(128, 32)
-
- self.optioncard = SiOptionCardLinear(self)
- self.optioncard.load(SiGlobal.icons.get('fi-rr-bulb'))
- self.optioncard.setTitle("测试选项卡", "这是这个选项卡的一段说明性文字,但是它非常非常长")
- self.optioncard.addWidget(self.button_for_option_card)
-
- self.button_for_option_card2 = SiSimpleButton(self)
- self.button_for_option_card2.setCheckable(False)
- self.button_for_option_card2.attachment().load(SiGlobal.icons.get('fi-rr-link'))
- self.button_for_option_card2.attachment().setText("打开链接")
- self.button_for_option_card2.adjustSize()
-
- self.optioncard2 = SiOptionCardLinear(self)
- self.optioncard2.load(SiGlobal.icons.get('fi-rr-bulb'))
- self.optioncard2.setTitle("测试选项卡", "这是这个选项卡的一段说明性文字,但是它非常非常长")
- self.optioncard2.addWidget(self.button_for_option_card2)
-
- self.optioncard3 = SiOptionCardPlane(self)
- self.optioncard3.setTitle("平面选项卡")
-
- self.button_for_test = SiPushButton(self)
- self.button_for_test.attachment().setText("测试按钮")
- self.button_for_test.resize(128, 32)
-
- self.button_for_test2 = SiPushButton(self)
- self.button_for_test2.attachment().setText("另一个")
- self.button_for_test2.resize(128, 32)
-
- self.optioncard3.body().addWidget(self.button_for_test)
- self.optioncard3.body().addWidget(self.button_for_test2)
- self.optioncard3.body().addPlaceholder(24 - 8)
- self.optioncard3.adjustSize()
-
- self.new_slider = SiSliderH(self)
- #self.new_slider.setStyleSheet("background-color: #20FF0000")
- self.new_slider.setFixedHeight(16)
-
- self.new_progressbar = SiProgressBar(self)
- self.new_progressbar.setFixedHeight(32)
-
- self.random_progress_button = SiPushButton(self)
- self.random_progress_button.resize(128, 32)
- self.random_progress_button.attachment().setText("随机进度")
- self.random_progress_button.clicked.connect(lambda: self.new_progressbar.setValue(random.random()))
-
- self.lineedit = SiLineEdit(self)
- self.lineedit.setFixedHeight(32)
-
- self.titled_widget_group.setFixedWidth(800)
- #self.titled_widget_group.setStyleSheet("background-color: #20FF0000")
- self.titled_widget_group.addTitle("选项卡")
- self.titled_widget_group.addWidget(self.optioncard)
- self.titled_widget_group.addWidget(self.optioncard2)
- self.titled_widget_group.addWidget(self.optioncard3)
- self.titled_widget_group.addTitle("滑条")
- self.titled_widget_group.addWidget(self.new_slider)
- self.titled_widget_group.addTitle("进度条")
- self.titled_widget_group.addWidget(self.new_progressbar)
- self.titled_widget_group.addWidget(self.random_progress_button)
- self.titled_widget_group.addTitle("输入框")
- self.titled_widget_group.addWidget(self.lineedit)
-
- self.stack_reconstruct_test.addItem(self.reconstruct_discription)
- self.stack_reconstruct_test.addItem(self.button_layout)
- self.stack_reconstruct_test.addItem(self.button_layout2)
- self.stack_reconstruct_test.addItem(self.container_h)
- self.stack_reconstruct_test.addItem(self.scrollarea)
- self.stack_reconstruct_test.addItem(self.titled_widget_group)
-
- #self.stack_reconstruct_test.addItem(self.test_label)
-
- self.addItem(self.discription)
- self.addItem(self.stack_music_info_placeholder)
- self.addItem(self.stack_reconstruct_test)
diff --git a/examples/Gallery/components/Glaze.py b/examples/Gallery/components/Glaze.py
deleted file mode 100644
index e9c89e7..0000000
--- a/examples/Gallery/components/Glaze.py
+++ /dev/null
@@ -1,182 +0,0 @@
-from PyQt5.Qt import *
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5 import QtCore, QtGui, QtWidgets
-from PyQt5.QtCore import *
-from PyQt5.Qt import *
-from PyQt5.QtWidgets import QMainWindow, QApplication, QLabel, QLineEdit
-import numpy
-import time
-import os
-
-import SiliconUI
-import SiliconUI.SiGlobal as SiGlobal
-
-from .sub_example_A import *
-from .sub_example_B import *
-
-class GlazeExample(SiliconUI.SiScrollFrame):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.setStyleSheet('')
-
- ## ================ Stack 开始 ===================
-
- self.stack_basics = SiliconUI.SiCategory(self)
- self.stack_basics.setTitle('预设组合控件基类')
-
- self.example_silicon_option_basic = SiliconUI.SiOption(self.stack_basics)
- self.example_silicon_option_basic.setText('基类 Silicon 选项', '所有预设组合控件的基类,梦开始的地方')
- self.example_silicon_option_basic.setIcon(SiGlobal.icons.get('fi-rr-rectangle-panoramic'))
-
- self.example_silicon_option_basic_unavailable = SiliconUI.SiOption(self.stack_basics)
- self.example_silicon_option_basic_unavailable.setText('禁用', '可将选项设为禁用')
- self.example_silicon_option_basic_unavailable.setIcon(SiGlobal.icons.get('fi-rr-ban'))
- self.example_silicon_option_basic_unavailable.setUsability(False)
-
- # 添加
- self.stack_basics.addItem(self.example_silicon_option_basic)
- self.stack_basics.addItem(self.example_silicon_option_basic_unavailable)
-
- ## ================ Stack 开始 ===================
-
- self.stack_buttons = SiliconUI.SiCategory(self)
- self.stack_buttons.setTitle('按钮选项')
-
- self.example_silicon_option_button = SiliconUI.SiOptionButton(self.stack_buttons)
- self.example_silicon_option_button.setText('具有按钮的 Silicon 选项', '这是一个具有按钮的 Silicon 选项', '确定')
- self.example_silicon_option_button.setIcon(SiGlobal.icons.get('fi-rr-apps'))
-
- self.example_silicon_option_button_highlighted = SiliconUI.SiOptionButton(self.stack_buttons)
- self.example_silicon_option_button_highlighted.setText('强调选项', '允许将按钮设为高亮,突出重点', '高亮按钮')
- self.example_silicon_option_button_highlighted.setIcon(SiGlobal.icons.get('fi-rr-apps-add'))
- self.example_silicon_option_button_highlighted.setStrong(True)
-
- self.example_silicon_option_button_hold = SiliconUI.SiOptionButtonHoldtoConfirm(self.stack_buttons)
- self.example_silicon_option_button_hold.setText('长按确定按钮', '避免手滑导致的不必要问题', '确定')
- self.example_silicon_option_button_hold.setIcon(SiGlobal.icons.get('fi-rr-apps-delete'))
-
- # 添加
- self.stack_buttons.addItem(self.example_silicon_option_button)
- self.stack_buttons.addItem(self.example_silicon_option_button_highlighted)
- self.stack_buttons.addItem(self.example_silicon_option_button_hold)
-
- ## ================ Stack 开始 ===================
-
- self.stack_switches = SiliconUI.SiCategory(self)
- self.stack_switches.setTitle('开关选项')
-
- self.example_silicon_option_switch = SiliconUI.SiOptionSwitch(self.stack_switches)
- self.example_silicon_option_switch.setText('具有开关的 Silicon 选项', '单击开关,切换状态',)
- self.example_silicon_option_switch.setIcon(SiGlobal.icons.get('fi-rr-interactive'))
-
- self.example_silicon_option_switch_sender = SiliconUI.SiOptionSwitch(self.stack_switches)
- self.example_silicon_option_switch_sender.setText('绑定开关事件', '开关发射一个布尔值信号',)
- self.example_silicon_option_switch_sender.setIcon(SiGlobal.icons.get('fi-rr-interactive'))
-
- self.example_silicon_option_switch_receiver = SiliconUI.SiOptionSwitch(self.stack_switches)
- self.example_silicon_option_switch_receiver.setText('被绑定开关', '',)
- self.example_silicon_option_switch_receiver.setIcon(SiGlobal.icons.get('fi-rr-interactive'))
- self.example_silicon_option_switch_receiver.setUsability(False)
-
- self.example_silicon_option_switch_sender.switch.stateChanged.connect(self.example_silicon_option_switch_receiver.setUsability)
-
- # 添加
- self.stack_switches.addItem(self.example_silicon_option_switch)
- self.stack_switches.addItem(self.example_silicon_option_switch_sender)
- self.stack_switches.addItem(self.example_silicon_option_switch_receiver)
-
- ## ================ Stack 开始 ===================
-
- self.stack_sliderbars = SiliconUI.SiCategory(self)
- self.stack_sliderbars.setTitle('滑条选项')
-
- self.example_silicon_option_sliderbar = SiliconUI.SiOptionSliderBar(self.stack_sliderbars)
- self.example_silicon_option_sliderbar.setText('一个 Silicon SliderBar 滑条', '滑动以设置值',)
- self.example_silicon_option_sliderbar.setIcon(SiGlobal.icons.get('fi-rr-settings-sliders'))
-
- self.example_silicon_option_sliderbar_dispersed = SiliconUI.SiOptionSliderBar(self.stack_sliderbars)
- self.example_silicon_option_sliderbar_dispersed.setText('离散取值滑条', '取值不连续,这是含8个档位的示例',)
- self.example_silicon_option_sliderbar_dispersed.setIcon(SiGlobal.icons.get('fi-rr-settings-sliders'))
- self.example_silicon_option_sliderbar_dispersed.sliderbar.slider.setDispersed(range(0,8))
-
- # 添加
- self.stack_sliderbars.addItem(self.example_silicon_option_sliderbar)
- self.stack_sliderbars.addItem(self.example_silicon_option_sliderbar_dispersed)
-
- ## ================ Stack 开始 ===================
-
- self.stack_inputboxes = SiliconUI.SiCategory(self)
- self.stack_inputboxes.setTitle('输入框选项')
-
- self.example_silicon_option_inputbox = SiliconUI.SiOptionInputBox(self.stack_inputboxes)
- self.example_silicon_option_inputbox.setText('输入框', '接收用户输入的文字内容',)
- self.example_silicon_option_inputbox.setIcon(SiGlobal.icons.get('fi-rr-cursor-text'))
-
- # 添加
- self.stack_inputboxes.addItem(self.example_silicon_option_inputbox)
-
-
- ## ================ Stack 开始 ===================
-
- self.stack_combobox = SiliconUI.SiCategory(self)
- self.stack_combobox.setTitle('下拉菜单选项')
-
- self.example_combobox = SiliconUI.SiOptionComboBox(self.stack_combobox)
- self.example_combobox.setText('下拉菜单', '一个下拉菜单示例,选择你最喜欢的科目')
- self.example_combobox.setIcon(SiGlobal.icons.get('fi-rr-align-left'))
- self.example_combobox.addOption('语文', 1)
- self.example_combobox.addOption('数学', 2)
- self.example_combobox.addOption('英语', 3)
- self.example_combobox.addOption('物理', 4)
- self.example_combobox.addOption('化学', 5)
- self.example_combobox.addOption('生物学', 6)
- self.example_combobox.addOption('历史', 7)
- self.example_combobox.addOption('地理', 8)
- self.example_combobox.addOption('思想政治', 9)
- self.example_combobox.setOption('语文')
-
- self.stack_combobox.addItem(self.example_combobox)
-
-
- ## ================ Stack 开始 ===================
-
- self.popup_interfaces = SiliconUI.SiCategory(self)
- self.popup_interfaces.setTitle('二级界面选项')
-
- self.example_silicon_popup_interfaces = SiliconUI.SiOptionButton(self.popup_interfaces)
- self.example_silicon_popup_interfaces.setText('二级界面示例·其一', '一个网络通行证设置示例,包括高级设置', '打开')
- self.example_silicon_popup_interfaces.setIcon(SiGlobal.icons.get('fi-rr-layers'))
- self.example_silicon_popup_interfaces.button.clicked.connect(lambda : SiGlobal.overlay.setInterface('example_a'))
- self.example_silicon_popup_interfaces.button.clicked.connect(SiGlobal.overlay.show_animation)
-
- self.example_silicon_popup_interfaces_b = SiliconUI.SiOptionButton(self.popup_interfaces)
- self.example_silicon_popup_interfaces_b.setText('二级界面示例·其二', '一个文件备份设置示例,包含了多个设置组以及提示信息', '打开')
- self.example_silicon_popup_interfaces_b.setIcon(SiGlobal.icons.get('fi-rr-layers'))
- self.example_silicon_popup_interfaces_b.button.clicked.connect(lambda : SiGlobal.overlay.setInterface('example_b'))
- self.example_silicon_popup_interfaces_b.button.clicked.connect(SiGlobal.overlay.show_animation)
-
- # 添加
- self.popup_interfaces.addItem(self.example_silicon_popup_interfaces)
- self.popup_interfaces.addItem(self.example_silicon_popup_interfaces_b)
-
-
-
-
-
-
-
-
- self.addItem(self.stack_basics)
- self.addItem(self.stack_buttons)
- self.addItem(self.stack_switches)
- self.addItem(self.stack_sliderbars)
- self.addItem(self.stack_inputboxes)
- self.addItem(self.stack_combobox)
- self.addItem(self.popup_interfaces)
-
- SiGlobal.overlay.addInterface(SubInterface_A(self, 'example_a'))
- SiGlobal.overlay.addInterface(SubInterface_B(self, 'example_b'))
diff --git a/examples/Gallery/components/Homepage.py b/examples/Gallery/components/Homepage.py
deleted file mode 100644
index 28d40ca..0000000
--- a/examples/Gallery/components/Homepage.py
+++ /dev/null
@@ -1,393 +0,0 @@
-from PyQt5 import QtGui
-from PyQt5.Qt import *
-from PyQt5.QtCore import *
-from PyQt5.QtGui import *
-from PyQt5.QtWidgets import *
-
-from SiliconUI.SiFont import *
-from SiliconUI.SiInfo import *
-from SiliconUI.SiInputBox import *
-from SiliconUI.SiLayout import *
-from SiliconUI.SiOption import *
-from SiliconUI.SiScrollArea import *
-from SiliconUI.SiScrollFrame import *
-from SiliconUI.SiSliderBar import *
-from SiliconUI.SiSticker import *
-from SiliconUI.SiSwitch import *
-
-from .web_url import GithubUrl, browse
-
-
-# 用到模糊
-class SiPixButton(QLabel):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.image_label = QLabel(self)
- self.mask = QLabel(self)
- self.title = QLabel(self)
- self.discription = QLabel(self)
- self.button = QPushButton(self)
-
- self.title.setFont(font_L2_bold)
- self.title.move(24, 16)
- self.discription.setFont(font_L1)
- self.discription.setAlignment(Qt.AlignBottom)
- self.discription.move(24, 40)
- self.discription.setWordWrap(True)
-
- self.title.setStyleSheet("color:#ffffff")
- self.discription.setStyleSheet("color:#ffffff")
- self.mask.setStyleSheet("""
- border-radius:6px;
- background-image:none;
- background-color:qlineargradient(
- x1:0, y1:1, x2:0, y2:0,
- stop:0 #7f000000, stop:1 #00000000
- )""")
-
- shadow = QGraphicsDropShadowEffect()
- shadow.setBlurRadius(4) # 阴影模糊半径
- shadow.setColor(QtGui.QColor(0, 0, 0, 255)) # 阴影颜色和不透明度
- shadow.setOffset(0, 0) # 阴影偏移量
- self.title.setGraphicsEffect(shadow)
-
- shadow = QGraphicsDropShadowEffect()
- shadow.setBlurRadius(4) # 阴影模糊半径
- shadow.setColor(QtGui.QColor(0, 0, 0, 255)) # 阴影颜色和不透明度
- shadow.setOffset(0, 0) # 阴影偏移量
- self.discription.setGraphicsEffect(shadow)
-
- def setPixmap(self, path):
- self.button.setStyleSheet("""
- QPushButton {
- border-radius:6px;
- background-color:transparent;
- }
- QPushButton:hover {
- border-radius:6px;
- background-color:#04ffffff;
- }
- QPushButton:pressed {
- border-radius:6px;
- background-color:#02ffffff;
- }""")
-
- self.image_label.setStyleSheet(
- f"""
- background-image: url({path});
- border-radius:6px;
- border: 1px solid #2A252D """
- )
-
- def setText(self, title, discri):
- self.title.setText(title)
- self.discription.setText(discri)
-
- def resizeEvent(self, event):
- w = event.size().width()
- h = event.size().height()
-
- self.image_label.resize(w, h)
- self.mask.resize(w, h)
- self.button.resize(w, h)
- self.discription.resize(w - 48, h - 40 - 16)
-
-
-class WidgetSticker(SiSticker):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.button_github = SiButtonFlat(self)
- self.button_github.resize(32, 32)
- self.button_github.load(SiGlobal.icons.get("fi-rr-link"))
- self.button_github.setHint("前往 GitHub")
- self.button_github.clicked.connect(lambda: browse(GithubUrl.SiliconUI_Home))
-
- self.button_example = SiButtonFlat(self)
- self.button_example.resize(32, 32)
- self.button_example.load(SiGlobal.icons.get("fi-rr-presentation"))
- self.button_example.setHint("查看使用样例")
- self.button_example.clicked.connect(lambda: browse(GithubUrl.SiliconUI_Home))
-
- self.head.addItem(self.button_github, side="right")
- self.head.addItem(self.button_example, side="right")
-
- self.body = SiLayoutV(self)
-
- def resizeEvent(self, event):
- super().resizeEvent(event)
- size = event.size()
- w, h = size.width(), size.height()
-
- self.body.setGeometry(24, 16 + 32 + 16, w - 48, h - 64 - 16)
-
-
-class WidgetSticker_Buttons(WidgetSticker):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.widgets = SiLayoutH(self)
- self.widgets.resize(500, 32)
-
- self.button_A = SiButton(self)
- self.button_A.setStrong(False)
- self.button_A.setText("普通按钮")
- self.button_A.resize(128, 32)
-
- self.button_B = SiButton(self)
- self.button_B.setStrong(True)
- self.button_B.setText("高亮按钮")
- self.button_B.resize(128, 32)
-
- self.button_C = SiButtonHoldtoConfirm(self)
- self.button_C.setText("长按按钮")
- self.button_C.resize(128, 32)
-
- self.widgets.addItem(self.button_A, "left")
- self.widgets.addItem(self.button_B, "left")
- self.widgets.addItem(self.button_C, "left")
-
- self.body.addItem(self.widgets, "top")
-
-
-class WidgetSticker_Switches(WidgetSticker):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.widgets = SiLayoutH(self)
- self.widgets.resize(500, 32)
-
- self.switch = SiSwitch(self)
- self.switch.resize(128, 32)
-
- self.widgets.addItem(self.switch, "left")
-
- self.body.addItem(self.widgets, "top")
-
-
-class WidgetSticker_Sliders(WidgetSticker):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.slider_A = SiSliderBar(self)
- self.slider_A.resize(500, 32)
-
- self.body.addItem(self.slider_A, "top")
-
-
-class WidgetSticker_InputBoxes(WidgetSticker):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.widgets = SiLayoutH(self)
- self.widgets.resize(500, 32)
-
- self.inputbox = SiInputBox(self)
- self.inputbox.resize(300, 32)
-
- self.widgets.addItem(self.inputbox, "left")
-
- self.body.addItem(self.widgets, "top")
-
-
-class GlazeSticker(WidgetSticker):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.glaze_example = SiOptionButton(self)
- self.glaze_example.resize(500, 0)
- self.glaze_example.setText("Glaze 样例", "使用 Silicon Glaze 帮助您高效构建界面", "确定")
- self.glaze_example.setIcon(SiGlobal.icons.get("fi-rr-apps-add"))
-
- self.body.addItem(self.glaze_example, "top")
-
- def resizeEvent(self, event):
- super().resizeEvent(event)
- w = event.size().width()
-
- self.glaze_example.resize(w - 48, self.glaze_example.geometry().height())
-
-
-class SiHomePage(SiScrollFrame):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.setStyleSheet("")
-
- self.rightside_interval = 0
-
- self.title = QLabel(self)
- self.title.setGeometry(64, 0, 500, 128)
- self.title.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)
- self.title.setText("Silicon UI")
- self.title.setStyleSheet("color:#fafafa")
- self.title.setFont(font_L4)
-
- self.subtitle = QLabel(self)
- self.subtitle.setGeometry(64, 72, 500, 48)
- self.subtitle.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)
- self.subtitle.setText("基于 PyQt5 / PySide6 的 UI 框架,灵动、优雅而轻便")
- self.subtitle.setStyleSheet("color:#fafafa")
- self.subtitle.setFont(font_L1_bold)
-
- self.theme_image = QLabel(self)
- self.theme_image.setStyleSheet(""" background-image: url('./img/image.png');
- border-top-left-radius:8px""")
- self.theme_image.setGeometry(0, 0, 100, 300)
-
- self.theme_image_hover = QLabel(self)
- self.theme_image_hover.setGeometry(0, 100, 0, 200)
- self.theme_image_hover.setStyleSheet("""
- background-image:none;
- background-color: qlineargradient(x1:0, y1:1, x2:0, y2:0,
- stop:0 #ff252229, stop:1 #00252229)
- """)
-
- self.interval = 64
- self.delta = 48
-
- self.title.raise_()
- self.subtitle.raise_()
-
- self.addH(148)
-
- self.sticker_project = SiStickerWithBottomButton(self)
- self.sticker_project.setGeometry(64, 148, 196, 256)
- self.sticker_project.setTitle("访问项目主页")
- self.sticker_project.setContent(
- " 访问 GitHub 项目主页,以获取最新版本,参与 Silicon UI 的开发,报告错误,建言献策"
- )
- self.sticker_project.bgimage.setStyleSheet("background-image: url('./img/wiki.png');border-radius:6px")
- self.sticker_project.bottom_button.load(SiGlobal.icons.get("fi-rr-link"))
- self.sticker_project.bottom_button.setHint("前往 GitHub")
- self.sticker_project.bottom_button.clicked.connect(lambda: browse(GithubUrl.SiliconUI_Home))
-
- self.sticker_wiki = SiStickerWithBottomButton(self)
- self.sticker_wiki.setGeometry(64 + 196 + 32, 148, 196, 256)
- self.sticker_wiki.setTitle("应用示例")
- self.sticker_wiki.setContent(" 学习并快速上手 Silicon UI,了解如何开发你的第一件作品")
- self.sticker_wiki.bgimage.setStyleSheet("background-image: url('./img/github.png');border-radius:6px")
- self.sticker_wiki.bottom_button.load(SiGlobal.icons.get("fi-rr-link"))
- self.sticker_wiki.bottom_button.setHint("前往 GitHub")
- self.sticker_wiki.bottom_button.clicked.connect(lambda: browse(GithubUrl.SiliconUI_Home))
-
- self.addH(300)
-
- # ============== Stack 开始 ===============
-
- self.widgets_stack = SiCategory(self)
- self.widgets_stack.setTitle("Silicon 控件")
- self.widgets_stack.resize(1000, 0)
-
- # 初始化两个 SiLayoutH 用于平行放置四个 Sticker
- self.layout_widgets_A = SiLayoutH(self)
- self.layout_widgets_A.resize(0, 128)
- self.layout_widgets_B = SiLayoutH(self)
- self.layout_widgets_B.resize(0, 128)
-
- self.sticker_buttons = WidgetSticker_Buttons(self)
- self.sticker_buttons.resize(600, 128)
- self.sticker_buttons.setTitle("按钮")
-
- self.sticker_switches = WidgetSticker_Switches(self)
- self.sticker_switches.resize(300, 128)
- self.sticker_switches.setTitle("开关")
-
- self.sticker_inputboxes = WidgetSticker_InputBoxes(self)
- self.sticker_inputboxes.resize(350, 128)
- self.sticker_inputboxes.setTitle("输入框")
-
- self.sticker_sliders = WidgetSticker_Sliders(self)
- self.sticker_sliders.resize(550, 128)
- self.sticker_sliders.setTitle("滑动条")
-
- # 四个 sticker 添加到 layout
- self.layout_widgets_A.addItem(self.sticker_buttons, "left")
- self.layout_widgets_A.addItem(self.sticker_switches, "left")
- self.layout_widgets_B.addItem(self.sticker_inputboxes, "left")
- self.layout_widgets_B.addItem(self.sticker_sliders, "left")
-
- # 添加到 Stack
- self.widgets_stack.addItem(self.layout_widgets_A)
- self.widgets_stack.addItem(self.layout_widgets_B)
-
- # 添加到 Frame
- self.addItem(self.widgets_stack)
-
- # ============== Stack 开始 ===============
-
- self.glazes_stack = SiCategory(self)
- self.glazes_stack.setTitle("Silicon Glaze 界面构建模板")
- self.glazes_stack.resize(916, 0)
-
- self.sticker_glaze = GlazeSticker(self.glazes_stack)
- self.sticker_glaze.resize(0, 176)
- self.sticker_glaze.setTitle("Glaze 组建预设")
-
- # 添加到 Stack
- self.glazes_stack.addItem(self.sticker_glaze)
-
- # 添加到 Frame
- self.addItem(self.glazes_stack)
-
- # ============== Stack 开始 ===============
-
- self.info_stack = SiCategory(self)
- self.info_stack.setTitle("提示信息")
- self.info_stack.resize(916, 0)
-
- self.info_layout = SiLayoutH(self.info_stack)
- self.info_layout.resize(0, 176)
-
- self.info_bar_A = SiInfo(self.info_layout)
- self.info_bar_A.setFixedWidth(184)
- self.info_bar_A.setType(0)
- self.info_bar_A.setContent(
- "提示",
- "· 你可以创建提示信息
· 提示信息支持富文本
· 这段信息过长的时候会自动换行并自动设置高度,你只需要锁定一个宽度",
- )
-
- self.info_bar_B = SiInfo(self.info_layout)
- self.info_bar_B.setFixedWidth(184)
- self.info_bar_B.setType(1)
- self.info_bar_B.setContent("已完成", "提示信息已经创建完成")
-
- self.info_bar_C = SiInfo(self.info_layout)
- self.info_bar_C.setFixedWidth(184)
- self.info_bar_C.setType(2)
- self.info_bar_C.setContent("警告", "为什么创建这么多的提示信息,还要堆在一起")
-
- self.info_bar_D = SiInfo(self.info_layout)
- self.info_bar_D.setFixedWidth(184)
- self.info_bar_D.setType(3)
- self.info_bar_D.setContent("错误", "我们在Bug中发现了少量代码(雾")
-
- # 添加到 Layout
- self.info_layout.addItem(self.info_bar_A, "left")
- self.info_layout.addItem(self.info_bar_B, "left")
- self.info_layout.addItem(self.info_bar_C, "left")
- self.info_layout.addItem(self.info_bar_D, "left")
-
- # 添加到 Stack
- self.info_stack.addItem(self.info_layout)
-
- # 添加到 Frame
- self.addItem(self.info_stack)
-
- self.adjustSize()
-
- def resizeEvent(self, event):
- w = event.size().width()
- h = event.size().height()
-
- self.theme_image.resize(w, self.theme_image.geometry().height())
- self.theme_image_hover.resize(w, 200)
diff --git a/examples/Gallery/components/Layouts.py b/examples/Gallery/components/Layouts.py
deleted file mode 100644
index 0969bf0..0000000
--- a/examples/Gallery/components/Layouts.py
+++ /dev/null
@@ -1,130 +0,0 @@
-
-from SiliconUI import *
-from SiliconUI.SiGlobal import *
-
-from siui.components.widgets import SiPushButton
-
-from .web_url import GithubUrl, browse
-
-
-class WidgetSticker(SiliconUI.SiSticker):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.button_github = SiButtonFlat(self)
- self.button_github.resize(32, 32)
- self.button_github.load(SiGlobal.icons.get("fi-rr-link"))
- self.button_github.setHint("查看源代码")
-
- self.button_report_bug = SiButtonFlat(self)
- self.button_report_bug.resize(32, 32)
- self.button_report_bug.load(SiGlobal.icons.get("fi-rr-bug"))
- self.button_report_bug.setHint("报告问题")
- self.button_report_bug.clicked.connect(lambda: browse(GithubUrl.Issues_New))
-
- self.head.addItem(self.button_github, side="right")
- self.head.addItem(self.button_report_bug, side="right")
-
-
-class LayoutsExample(SiliconUI.SiScrollFrame):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.setStyleSheet("")
- self.max_width_policy = False # 取消过长中置
-
- widgets_width = 580
-
- ## ================ Stack 开始 ===================
-
- self.stack_layouts_basics = SiliconUI.SiCategory(self)
- self.stack_layouts_basics.setTitle("基本布局")
-
- self.sticker_flow_layouts = WidgetSticker(self.stack_layouts_basics)
- self.sticker_flow_layouts.setTitle("流式布局")
-
- self.flow_layout = SiliconUI.SiFlowLayout(self)
- self.flow_layout.setInterval(8, 8)
- self.flow_layout.setFixedWidth(532)
-
- for _ in range(12):
- label = ClickableLabel(self)
- label.setStyleSheet(
- f"""
- background-color: {colorset.BG_GRAD_HEX[3]};
- color: {colorset.TEXT_GRAD_HEX[0]};
- padding: 4px;
- border-radius: 4px;
- """
- )
- label.setFixedHeight(32)
- label.animation_move.setFactor(1 / 6) # byd有点快我给放慢点
- label.setText(str(round(random.random(), int(random.random() * 10))))
- self.flow_layout.addItem(label, ani=False) # 禁用动画
-
- self.layout_flow_layouts_buttons = SiLayoutH(self)
-
- self.button_reverse_label = SiPushButton(self)
- self.button_reverse_label.setText("重排首个元素")
- self.button_reverse_label.resize(128, 32)
- self.button_reverse_label.clicked.connect(lambda: reverse_label(self.flow_layout))
-
- self.button_shuffle_label = SiPushButton(self)
- self.button_shuffle_label.setText("随机打乱")
- self.button_shuffle_label.resize(128, 32)
- self.button_shuffle_label.clicked.connect(lambda: shuffle_label(self.flow_layout))
-
- self.layout_flow_layouts_buttons.addItem(self.button_reverse_label)
- self.layout_flow_layouts_buttons.addItem(self.button_shuffle_label)
-
- self.sticker_flow_layouts.addItem(self.flow_layout)
- self.sticker_flow_layouts.addItem(self.layout_flow_layouts_buttons)
-
- self.stack_layouts_basics.addItem(self.sticker_flow_layouts)
-
- ## ================ Stack 开始 ===================
-
- self.stack_layouts_advanced = SiliconUI.SiCategory(self)
- self.stack_layouts_advanced.setTitle("高级布局")
-
- self.sticker_stacked_layouts = WidgetSticker(self.stack_layouts_advanced)
- self.sticker_stacked_layouts.setTitle("组布局")
-
- self.stacked_layout = SiliconUI.SiStackedLayout(self)
- self.stacked_layout.setFixedWidth(500)
- self.stacked_layout.setFixedHeight(160)
- self.stacked_layout.addPage("测试选项卡")
- self.stacked_layout.addPage("鸽鸽")
-
- self.option_test_1 = SiliconUI.SiOptionSwitch(self)
- self.option_test_1.setText("我是测试1", "这是测试1的内容")
- self.option_test_1.setIcon(SiGlobal.icons.get("fi-rr-band-aid"))
-
- self.option_test_2 = SiliconUI.SiOptionButton(self)
- self.option_test_2.setText("鸡你太美", "备备,偶哦", "你干嘛")
- self.option_test_2.setIcon(SiGlobal.icons.get("fi-rr-basketball"))
-
- self.stacked_layout.addItemToPage("测试选项卡", self.option_test_1)
- self.stacked_layout.addItemToPage("鸽鸽", self.option_test_2)
- # self.stacked_layout.setStyleSheet('background-color: #20ff0000')
-
- self.sticker_stacked_layouts.addItem(self.stacked_layout)
-
- self.stack_layouts_advanced.addItem(self.sticker_stacked_layouts)
-
- self.addItem(self.stack_layouts_basics)
- self.addItem(self.stack_layouts_advanced)
-
-
-def shuffle_label(obj):
- random.shuffle(obj.items)
- obj.adjustSize()
- obj.parent.adjustSize()
-
-
-def reverse_label(obj):
- obj.items = obj.items[1:] + [obj.items[0]]
- obj.adjustSize()
- obj.parent.adjustSize()
diff --git a/examples/Gallery/components/Options.py b/examples/Gallery/components/Options.py
deleted file mode 100644
index c99e079..0000000
--- a/examples/Gallery/components/Options.py
+++ /dev/null
@@ -1,161 +0,0 @@
-from PyQt5.Qt import *
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5 import QtCore, QtGui, QtWidgets
-from PyQt5.QtCore import *
-from PyQt5.Qt import *
-from PyQt5.QtWidgets import QMainWindow, QApplication, QLabel, QLineEdit
-import numpy
-import time
-import os
-
-import SiliconUI
-import SiliconUI.SiGlobal as SiGlobal
-
-from SiliconUI.SiSticker import SiSticker
-from SiliconUI.SiFont import *
-from SiliconUI.SiButton import SiButtonLabel
-
-from .web_url import GithubUrl, BiliBiliUrl, browse
-
-
-class NameTag(SiSticker):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- # 所有内容的 LayoutH
- self.layout_all_content = SiliconUI.SiLayoutH(self)
- self.layout_all_content.move(24, 24)
-
- self.selfie = SiliconUI.SiPixLabel(self)
- self.selfie.setRadius(32)
- self.selfie.resize(80, 80)
-
- # 文字信息得到 LayoutV
- self.layout_labels = SiliconUI.SiLayoutV(self.layout_all_content)
- self.layout_labels.setInterval(1)
-
- self.name = SiliconUI.SiLabel(self.layout_labels)
- self.name.setFont(font_L2)
- self.name.setStyleSheet("color: #ffffff; padding-left: 2px; padding-bottom: 6px")
- self.layout_labels.addItem(self.name)
-
- self.layout_all_content.addItem(self.selfie, "left")
- self.layout_all_content.addItem(self.layout_labels, "left")
-
- self.adjustSize()
-
- def load(self, path):
- self.selfie.load(path)
-
- def setName(self, name):
- self.name.setText(name)
- self.name.adjustSize()
- self.layout_labels.adjustSize()
- self.adjustSize()
-
- def addItem(self, text, url, hint=""):
- newItem = SiButtonLabel(self)
- newItem.setStyleSheet("""
- color: #d986e8;
- padding-left: 4px;
- padding-right: 4px;
- padding-top: 1px;
- padding-bottom: 1px;
- """)
- newItem.setText(text)
- newItem.clicked.connect(lambda: os.system("start {}".format(url)))
- newItem.setHint(hint)
- self.layout_labels.addItem(newItem, "top")
- self.layout_labels.adjustSize()
-
- def resizeEvent(self, event):
- super().resizeEvent(event)
- size = event.size()
- w, h = size.width(), size.height()
-
- self.layout_all_content.resize(w - 48, h - 48)
- self.layout_labels.resize(self.layout_labels.width(), h - 48)
-
-
-class Options(SiliconUI.SiScrollFrame):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.setStyleSheet("")
-
- ## ================ Stack 开始 ===================
-
- self.stack_developers = SiliconUI.SiCategory(self)
- self.stack_developers.setTitle("开发者")
-
- self.layout_developers = SiliconUI.SiLayoutH(self.stack_developers)
- self.layout_developers.setFixedHeight(132)
-
- self.nametag = NameTag(self.stack_developers)
- self.nametag.setFixedWidth(380)
- self.nametag.setFixedHeight(132)
- self.nametag.load("./img/headpic.png")
- self.nametag.setName("霏泠Ice")
- self.nametag.addItem("访问 GitHub 主页", GithubUrl.Author_Home, GithubUrl.Author_Home)
- self.nametag.addItem("访问 哔哩哔哩 主页", BiliBiliUrl.Author_Home, BiliBiliUrl.Author_Home)
-
- self.nametag_1 = NameTag(self.stack_developers)
- self.nametag_1.setFixedWidth(380)
- self.nametag_1.setFixedHeight(132)
- self.nametag_1.load("./img/headpic2.jpg")
- self.nametag_1.setName("你干嘛~嗨嗨呦↓")
- self.nametag_1.addItem("访问 GitHub 主页", "www.github.com", "www.github.com")
- self.nametag_1.addItem("访问 哔哩哔哩 主页", "www.bilibili.com", "www.bilibili.com")
-
- self.layout_developers.addItem(self.nametag)
- self.layout_developers.addItem(self.nametag_1)
-
- self.stack_developers.addItem(self.layout_developers)
-
- ## ================ Stack 开始 ===================
-
- self.stack_about = SiliconUI.SiCategory(self)
- self.stack_about.setTitle("关于")
-
- self.about = SiliconUI.SiOption(self.stack_about)
- self.about.setIcon(SiGlobal.icons.get("fi-rr-info"))
- self.about.setText(
- "关于 Silicon UI", """版本号 1.01 构建日期2024.05.26"""
- )
-
- self.license = SiliconUI.SiOption(self.stack_about)
- self.license.setText("开源许可", "本项目遵循 GNU General Public License v3.0")
- self.license.setIcon(SiGlobal.icons.get("fi-rr-diploma"))
-
- self.copyright = SiliconUI.SiOption(self.stack_about)
- self.copyright.setText("版权", "霏泠冰 IceF 版权所有")
- self.copyright.setIcon(SiGlobal.icons.get("fi-rr-copyright"))
-
- # 添加
- self.stack_about.addItem(self.about)
- self.stack_about.addItem(self.license)
- self.stack_about.addItem(self.copyright)
-
- ## ================ Stack 开始 ===================
-
- self.stack_quotes = SiliconUI.SiCategory(self)
- self.stack_quotes.setTitle("第三方资源")
-
- self.icons = SiliconUI.SiOptionSourceCode(self.stack_about)
- self.icons._setMinimumHeight(80)
- self.icons.setText(
- "图标", "Silicon Gallery 使用了 FLATICON 的图标,这些图标不应被认为是 Silicon UI 的一部分"
- )
- self.icons.setIcon(SiGlobal.icons.get("fi-rr-quote-right"))
- self.icons.load(SiGlobal.icons.get("fi-rr-link"))
- self.icons.setURL("www.flaticon.com")
-
- self.stack_quotes.addItem(self.icons)
-
- self.addItem(self.stack_developers)
- self.addItem(self.stack_about)
- self.addItem(self.stack_quotes)
diff --git a/examples/Gallery/components/UpdateLogs.py b/examples/Gallery/components/UpdateLogs.py
deleted file mode 100644
index ee43768..0000000
--- a/examples/Gallery/components/UpdateLogs.py
+++ /dev/null
@@ -1,148 +0,0 @@
-from PyQt5.Qt import *
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5 import QtCore, QtGui, QtWidgets
-from PyQt5.QtCore import *
-from PyQt5.Qt import *
-from PyQt5.QtWidgets import QMainWindow, QApplication, QLabel, QLineEdit
-import numpy
-import time
-import os
-
-import SiliconUI
-import SiliconUI.SiGlobal as SiGlobal
-
-from .sub_example_A import *
-from .sub_example_B import *
-from SiliconUI.SiGlobal import colorset
-from SiliconUI.SiFont import *
-
-class Log(object):
- def __init__(self, title):
- self.title = title
- self.columns = []
-
- def addColumn(self, title):
- self.columns.append([title, ''])
-
- def addText(self, text):
- self.columns[-1][1] = self.columns[-1][1] + text
-
- def __str__(self):
- return str(self.columns)
-
-class UpdateLogs(SiliconUI.SiScrollFrame):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.log_tabs = []
-
- self.max_width_policy = False # 取消过长中置
- self.setStyleSheet('')
-
- self.log_width = 600
-
- # 内容的布局,左边是更新版本导航栏,右边是日志内容
- self.layout_main = SiliconUI.SiLayoutH(self)
- self.layout_main.setInterval(64)
-
- # 版本的 sticker
- self.sticker_versions = SiliconUI.SiSticker(self)
- self.sticker_versions.setTitle('历史版本')
- self.sticker_versions.setFixedWidth(256)
- self.sticker_versions.setFixedHeight(128)
-
- self.flowlayout_versions = SiliconUI.SiFlowLayout(self)
- self.flowlayout_versions.setFixedWidth(256 - 48)
-
- self.sticker_versions.addItem(self.flowlayout_versions)
-
- self.layout_main.addItem(self.sticker_versions)
-
- self.addItem(self.layout_main)
-
- self.loadUpdates()
-
-
- def _log_parser(self, path):
- f = open(path)
- content = f.readlines()
- logs = []
-
- for line in content:
- if line[0:2] == '::': # 识别到标题行
- logs.append(Log(line[3:].replace('\n', ''))) # 新建一个新日志
- continue
-
- if line[0:2] == '##': # 识别到内容标题行
- logs[-1].addColumn(line[3:].replace('\n', ''))
- continue
-
- logs[-1].addText(line)
-
- return logs
-
- def showLog(self, obj):
- for tab in self.log_tabs:
- tab.setVisible(False)
- obj.setVisible(True)
-
- def loadUpdates(self):
- logs = self._log_parser('./updatelogs/updates.txt')
-
- for log in logs:
-
- version_tab = SiliconUI.SiTab(self)
- version_tab.left_margin = 0
- version_tab.resize(self.log_width, 600)
- version_tab.setTitle(log.title)
- version_tab.move(400, -32)
-
- version_stack = SiliconUI.SiLayoutV(self)
- version_stack.setFixedWidth(self.log_width)
-
- for column in log.columns:
- title, text = column
- if text == '' or text == '\n' :
- continue # 跳过没有内容的column
- new_stack = SiliconUI.SiCategory(self)
- new_stack.setTitle(title)
-
- new_label = SiliconUI.SiLabel(self)
- new_label.setFixedWidth(self.log_width)
- new_label.setText(text)
- new_label.setWordWrap(True)
-
- new_stack.addItem(new_label)
- version_stack.addItem(new_stack)
-
- version_tab.attachFrame(version_stack)
- version_tab.setVisible(False)
- self.log_tabs.append(version_tab)
-
- new_button = SiliconUI.ClickableLabel(self)
- new_button.clicked.connect(gen_function(self, version_tab))
- new_button.setStyleSheet('''
- background-color: {};
- color: {};
- padding: 4px;
- border-radius: 4px;
- '''.format(colorset.BG_GRAD_HEX[3], colorset.TEXT_GRAD_HEX[0]))
- new_button.setFixedHeight(32)
- new_button.setText(log.title)
- self.flowlayout_versions.addItem(new_button)
-
- self.sticker_versions.adjustSize()
-
-
- def resizeEvent(self, event):
- super().resizeEvent(event)
- h = event.size().height()
- self.layout_main.setFixedHeight(h)
-
-
-
-def gen_function(self, obj):
- return lambda : self.showLog(obj)
diff --git a/examples/Gallery/components/Widgets.py b/examples/Gallery/components/Widgets.py
deleted file mode 100644
index 4d1e764..0000000
--- a/examples/Gallery/components/Widgets.py
+++ /dev/null
@@ -1,647 +0,0 @@
-from SiliconUI import *
-from SiliconUI.SiGlobal import *
-from SiliconUI.SiSticker import SiSticker
-
-from .web_url import GithubUrl, browse
-
-
-class WidgetsExampleDisplayer(QLabel):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- widgets_sticker_width = 580
- status_sticker_width = 320
-
- self.layout = SiLayoutH(self)
-
- self.sticker_widgets = WidgetSticker(self)
- self.sticker_widgets.setFixedWidth(widgets_sticker_width)
-
- self.sticker_status = SiSticker(self)
- self.sticker_status.setFixedWidth(status_sticker_width)
- self.sticker_status.setTitle("信号表")
- self.sticker_status.setInterval(0)
- self.sticker_status.setMinimumSize(status_sticker_width, 64)
- self.sticker_status.setVisible(False)
-
- self.layout.addItem(self.sticker_widgets)
- self.layout.addItem(self.sticker_status)
-
- def setWidth(self, widgets_sticker_width, status_sticker_width):
- self.sticker_widgets.setFixedWidth(widgets_sticker_width)
- self.sticker_status.setFixedWidth(status_sticker_width)
-
- def setCodeURL(self, url):
- self.sticker_widgets.button_github.clicked.connect(lambda: os.system(f"start {url}"))
-
- def setTitle(self, title):
- self.sticker_widgets.setTitle(title)
-
- def addItem(self, item):
- self.sticker_widgets.addItem(item)
- self.layout.adjustSize()
- self.adjustSize()
-
- def addValueStatus(self, name, signals: list, note="", width=128):
- self.sticker_status.setVisible(True)
- new_type = SiLabel(self)
- new_type.resize(6, 18)
- new_type.setStyleSheet("background-color: #664976; border-radius: 3px")
- new_type.setHint("具参信号")
-
- new_status = SiLabel(self)
- new_status.setHint(note)
- new_status.setStyleSheet(
- f"""
- padding-left: 4px; padding-right: 4px; padding-top: 2px; padding-bottom: 2px;
- color: {colorset.TEXT_GRAD_HEX[0]};
- border-radius: 4px """
- )
- new_status.setText(name)
-
- new_value = SiLabelHasUpdateAnimation(self)
- new_value.setFixedWidth(width)
- new_value.setFixedHeight(24)
- new_value.setStyleSheet(
- f"""
- padding-left: 4px; padding-right: 4px; padding-top: 2px; padding-bottom: 2px;
- color: {colorset.TEXT_GRAD_HEX[1]};
- text-align: right;
- border-radius: 4px """
- )
- new_value.setAlignment(Qt.AlignRight)
- new_value.setAutoAdjustSize(False)
-
- for signal in signals:
- signal.connect(new_value.setText)
- signal.connect(new_value.activate)
-
- layout = SiLayoutH(self)
- layout.setInterval(4)
- layout.setFixedWidth(self.sticker_status.width() - 48)
- layout.setAlignment(Qt.AlignCenter)
- layout.addItem(new_type)
- layout.addItem(new_status)
- layout.addItem(new_value, "right")
-
- self.sticker_status.addItem(layout)
- self.layout.adjustSize()
- self.adjustSize()
-
- def addSignalStatus(self, name, signals: list, note=""):
- self.sticker_status.setVisible(True)
- new_type = SiLabel(self)
- new_type.resize(6, 18)
- new_type.setStyleSheet("background-color: #3D6D76; border-radius: 3px")
- new_type.setHint("信号")
-
- new_status = SiLabelHasUpdateAnimation(self)
- new_status.setHint(note)
- new_status.setStyleSheet(
- f"""
- padding-left: 4px;
- padding-right: 4px;
- padding-top: 2px;
- padding-bottom: 2px;
- color: {colorset.TEXT_GRAD_HEX[0]};
- border-radius: 4px """
- )
- new_status.setText(name)
- for signal in signals:
- signal.connect(new_status.activate)
-
- layout = SiLayoutH(self)
- layout.setAlignment(Qt.AlignCenter)
- layout.setInterval(4)
- layout.addItem(new_type)
- layout.addItem(new_status)
-
- self.sticker_status.addItem(layout)
- self.layout.adjustSize()
- self.adjustSize()
-
- def resizeEvent(self, event):
- size = event.size()
- w, h = size.width(), size.height()
-
- self.layout.resize(w, h)
-
- def adjustSize(self):
- h = max(self.sticker_widgets.height(), self.sticker_status.height())
- self.resize(self.width(), h)
- self.sticker_widgets.resize(self.sticker_widgets.width(), h)
- self.sticker_status.resize(self.sticker_status.width(), h)
-
-
-class WidgetSticker(SiliconUI.SiSticker):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.button_github = SiButtonFlat(self)
- self.button_github.resize(32, 32)
- self.button_github.load(SiGlobal.icons.get("fi-rr-link"))
- self.button_github.setHint("查看源代码")
-
- self.button_report_bug = SiButtonFlat(self)
- self.button_report_bug.resize(32, 32)
- self.button_report_bug.load(SiGlobal.icons.get("fi-rr-bug"))
- self.button_report_bug.setHint("报告问题")
- self.button_report_bug.clicked.connect(lambda: browse(GithubUrl.Issues_New))
-
- self.head.addItem(self.button_github, side="right")
- self.head.addItem(self.button_report_bug, side="right")
-
-
-class WidgetsExample(SiliconUI.SiScrollFrame):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.setStyleSheet("")
- self.max_width_policy = False # 取消过长中置
-
- widgets_width = 580
-
- ## ================ Stack 开始 ===================
-
- self.stack_labels = SiliconUI.SiCategory(self)
- self.stack_labels.setTitle("标签")
-
- self.sticker_label = WidgetsExampleDisplayer(self.stack_labels)
- self.sticker_label.setTitle("文字标签")
- self.sticker_label.setCodeURL(GithubUrl.SiLabel)
-
- self.label_with_no_hint = SiliconUI.SiLabel(self)
- self.label_with_no_hint.setText("测试标签")
-
- self.label_with_hint = SiliconUI.SiLabel(self)
- self.label_with_hint.setText("测试标签(具有提示信息)")
- self.label_with_hint.setHint("你好,我是提示信息")
-
- # 添加到 Sticker
- self.sticker_label.addItem(self.label_with_no_hint)
- self.sticker_label.addItem(self.label_with_hint)
-
- self.sticker_pixlabel_with_hint = WidgetsExampleDisplayer(self.stack_labels)
- self.sticker_pixlabel_with_hint.setTitle("图片标签")
- self.sticker_pixlabel_with_hint.setCodeURL(GithubUrl.SiLabel)
-
- self.layout_pixlabel = SiLayoutH(self)
-
- self.pixlabel_with_hint = SiliconUI.SiPixLabel(self)
- self.pixlabel_with_hint.resize(80, 80)
- self.pixlabel_with_hint.setRadius(40)
- self.pixlabel_with_hint.load("./img/headpic.png")
- self.pixlabel_with_hint.setHint("关注霏泠谢谢喵
这真的很重要
但其实这只是一个多行富文本工具提示罢了XD")
-
- self.pixlabel_with_hint_roundrect = SiliconUI.SiPixLabel(self)
- self.pixlabel_with_hint_roundrect.resize(80, 80)
- self.pixlabel_with_hint_roundrect.setRadius(32)
- self.pixlabel_with_hint_roundrect.load("./img/headpic.png")
- self.pixlabel_with_hint_roundrect.setHint("尺寸 80*80,圆角半径 20")
-
- self.layout_pixlabel.addItem(self.pixlabel_with_hint)
- self.layout_pixlabel.addItem(self.pixlabel_with_hint_roundrect)
- self.layout_pixlabel.setFixedHeight(80)
-
- # 添加到 Sticker
- self.sticker_pixlabel_with_hint.addItem(self.layout_pixlabel)
-
- self.sticker_movable_label = WidgetsExampleDisplayer(self.stack_labels)
- self.sticker_movable_label.setTitle("动画标签")
- self.sticker_movable_label.setCodeURL(GithubUrl.SiLabel)
-
- self.layout_movable_label = SiliconUI.SiLayoutH(self)
- self.layout_movable_label.setFixedWidth(580)
- self.layout_movable_label.setFixedHeight(80)
-
- self.movable_label = SiliconUI.SiLabel(self)
- self.movable_label.resize(128, 32)
- self.movable_label.setHint("我是动画标签,支持 moveTo, resizeTo 方法")
- self.movable_label.setMoveLimits(0, 0, 532, 80)
- self.movable_label.setStyleSheet(
- f"""
- border-radius: 4px;
- background-color: {colorset.BG_GRAD_HEX[4]};
- """
- )
-
- self.layout_movable_label.addItem(self.movable_label)
-
- self.layout_button = SiliconUI.SiLayoutH(self)
-
- self.button_random_x = SiliconUI.SiButton(self)
- self.button_random_x.setText("随机移动")
- self.button_random_x.resize(128, 32)
- self.button_random_x.clicked.connect(
- lambda: self.movable_label.moveTo(int(random.random() * 532), int(random.random() * 80))
- )
-
- self.button_random_size = SiliconUI.SiButton(self)
- self.button_random_size.setText("随机大小")
- self.button_random_size.resize(128, 32)
- self.button_random_size.clicked.connect(
- lambda: self.movable_label.resizeTo(int(random.random() * 256 + 8), int(random.random() * 64 + 8))
- )
-
- self.button_reset = SiliconUI.SiButton(self)
- self.button_reset.setText("还原初始状态")
- self.button_reset.resize(128, 32)
- self.button_reset.clicked.connect(lambda: self.movable_label.moveTo(0, 0))
- self.button_reset.clicked.connect(lambda: self.movable_label.resizeTo(128, 32))
-
- self.layout_button.addItem(self.button_random_x)
- self.layout_button.addItem(self.button_random_size)
- self.layout_button.addItem(self.button_reset)
-
- self.sticker_movable_label.addItem(self.layout_movable_label)
- self.sticker_movable_label.addItem(self.layout_button)
-
- self.sticker_draggable_label = WidgetsExampleDisplayer(self.stack_labels)
- self.sticker_draggable_label.setTitle("可拖动标签")
- self.sticker_draggable_label.setCodeURL(GithubUrl.SiLabel)
-
- self.layout_draggable_label = SiliconUI.SiLayoutH(self)
- self.layout_draggable_label.setFixedWidth(526)
- self.layout_draggable_label.setFixedHeight(80)
-
- self.draggable_label = SiliconUI.SiDraggableLabel(self)
- self.draggable_label.resize(128, 32)
- self.draggable_label.setHint("任意拖动,支持过渡动画")
- self.draggable_label.setMoveLimits(0, 0, 526, 80)
- self.draggable_label.animation_move.setFactor(1 / 6) # 放慢动画
- self.draggable_label.setStyleSheet(
- f"""
- border-radius: 4px;
- background-color: {colorset.BG_GRAD_HEX[4]};
- """
- )
-
- self.layout_draggable_label.addItem(self.draggable_label)
-
- self.sticker_draggable_label.addItem(self.layout_draggable_label)
-
- # 添加
- self.stack_labels.addItem(self.sticker_label)
- self.stack_labels.addItem(self.sticker_pixlabel_with_hint)
- self.stack_labels.addItem(self.sticker_movable_label)
- self.stack_labels.addItem(self.sticker_draggable_label)
-
- ## ================ Stack 开始 ===================
-
- self.stack_buttons = SiliconUI.SiCategory(self)
- self.stack_buttons.setTitle("按钮")
-
- self.sticker_button_normal = WidgetsExampleDisplayer(self.stack_labels)
- self.sticker_button_normal.setTitle("标准按钮")
- self.sticker_button_normal.setCodeURL(GithubUrl.SiButton)
-
- self.layout_button_normal = SiLayoutH(self)
-
- self.button_normal_A = SiButton(self)
- self.button_normal_A.setStrong(False)
- self.button_normal_A.setText("普通按钮")
- self.button_normal_A.resize(128, 32)
-
- self.button_normal_B = SiButton(self)
- self.button_normal_B.setStrong(True)
- self.button_normal_B.setText("高亮按钮")
- self.button_normal_B.resize(128, 32)
-
- self.button_normal_C = SiButtonHoldtoConfirm(self)
- self.button_normal_C.setText("长按按钮")
- self.button_normal_C.resize(128, 32)
-
- self.layout_button_normal.addItem(self.button_normal_A, "left")
- self.layout_button_normal.addItem(self.button_normal_B, "left")
- self.layout_button_normal.addItem(self.button_normal_C, "left")
-
- # 添加到 sticker
- self.sticker_button_normal.addItem(self.layout_button_normal)
- self.sticker_button_normal.addSignalStatus(
- "clicked",
- [
- self.button_normal_A.clicked,
- self.button_normal_B.clicked,
- self.button_normal_C.clicked,
- ],
- "被点击时触发",
- )
- self.sticker_button_normal.addValueStatus(
- "holdStateChanged",
- [
- self.button_normal_A.holdStateChanged,
- self.button_normal_B.holdStateChanged,
- self.button_normal_C.holdStateChanged,
- ],
- "当按钮被按下 / 松开时触发",
- )
-
- self.sticker_button_icon = WidgetsExampleDisplayer(self.stack_labels)
- self.sticker_button_icon.setTitle("图标按钮")
- self.sticker_button_icon.setCodeURL(GithubUrl.SiButton)
-
- self.button_icon = SiButtonFlat(self)
- self.button_icon.setHint("我是按钮示例")
- self.button_icon.load(SiGlobal.icons.get("fi-rr-disk"))
- self.button_icon.resize(32, 32)
-
- # 添加到 sticker
- self.sticker_button_icon.addItem(self.button_icon)
-
- self.sticker_button_label = WidgetsExampleDisplayer(self.stack_labels)
- self.sticker_button_label.setTitle("标签按钮")
- self.sticker_button_label.setCodeURL(GithubUrl.SiButton)
-
- self.button_label = ClickableLabel(self)
- self.button_label.setStyleSheet("color: #ffffff; padding: 8px")
- self.button_label.setFont(font_L1_bold)
- self.button_label.setFixedHeight(32)
- self.button_label.setText("标签按钮测试")
- self.button_label.adjustSize()
-
- self.button_label_flow = ClickableLabel(self) # TODO: 这部分以后整合到预设
- self.button_label_flow.radius = 14
- self.button_label_flow.setStyleSheet("""
- background-color: #20ffffff;
- color: #ffffff;
- padding: 4px;
- padding-left: 12px;
- padding-right: 12px;
- border-radius: 14px;
- """)
- self.button_label_flow.setFont(font_L1_bold)
- self.button_label_flow.setFixedHeight(28)
- self.button_label_flow.setText("流式标签")
- self.button_label_flow.adjustSize()
-
- # 添加到 sticker
- self.sticker_button_label.addItem(self.button_label)
- self.sticker_button_label.addItem(self.button_label_flow)
-
- self.sticker_button_icon_label = WidgetsExampleDisplayer(self.stack_labels)
- self.sticker_button_icon_label.setTitle("图标标签按钮")
- self.sticker_button_icon_label.setCodeURL(GithubUrl.SiButton)
-
- self.button_icon_label = SiButtonFlatWithLabel(self)
- self.button_icon_label.setFixedHeight(32)
- self.button_icon_label.setText("鸡你太美")
- self.button_icon_label.label.setFont(font_L1_bold)
- self.button_icon_label.load(SiGlobal.icons.get("fi-rr-basketball"))
-
- # 添加到 sticker
- self.sticker_button_icon_label.addItem(self.button_icon_label)
-
- self.sticker_radio_button = WidgetsExampleDisplayer(self.stack_labels)
- self.sticker_radio_button.setTitle("单选框")
- self.sticker_radio_button.setCodeURL(GithubUrl.SiButton)
-
- self.layout_radio_button = SiLayoutH(self)
- self.layout_radio_button.setInterval(16)
-
- self.radio_button = SiRadioButton(self)
- self.radio_button.setText("炫我嘴里")
- self.radio_button.setFixedWidth(96)
-
- self.radio_button2 = SiRadioButton(self)
- self.radio_button2.setText("睡大觉")
- self.radio_button2.setFixedWidth(96)
-
- self.radio_button3 = SiRadioButton(self)
- self.radio_button3.setText("买买买")
- self.radio_button3.setFixedWidth(96)
-
- self.radio_button4 = SiRadioButton(self)
- self.radio_button4.setText("来场旅行")
- self.radio_button4.setFixedWidth(96)
-
- self.layout_radio_button.addItem(self.radio_button)
- self.layout_radio_button.addItem(self.radio_button2)
- self.layout_radio_button.addItem(self.radio_button3)
- self.layout_radio_button.addItem(self.radio_button4)
-
- self.radio_button_group = SiRadioButtonGroup()
- self.radio_button_group.addItem(self.radio_button)
- self.radio_button_group.addItem(self.radio_button2)
- self.radio_button_group.addItem(self.radio_button3)
- self.radio_button_group.addItem(self.radio_button4)
-
- # 添加到 sticker
- self.sticker_radio_button.addItem(self.layout_radio_button)
-
- # 添加
- self.stack_buttons.addItem(self.sticker_button_normal)
- self.stack_buttons.addItem(self.sticker_button_icon)
- self.stack_buttons.addItem(self.sticker_button_label)
- self.stack_buttons.addItem(self.sticker_button_icon_label)
- self.stack_buttons.addItem(self.sticker_radio_button)
-
- ## ================ Stack 开始 ===================
-
- self.stack_menus = SiliconUI.SiCategory(self)
- self.stack_menus.setTitle("菜单")
-
- self.sticker_combobox = WidgetsExampleDisplayer(self.stack_menus)
- self.sticker_combobox.setTitle("下拉菜单")
- self.sticker_combobox.setCodeURL(GithubUrl.SiComboBox)
-
- self.combobox = SiComboBox(self)
- self.combobox.resize(160, 32)
- self.combobox.addOption("练习两年半", 2.5)
- self.combobox.addOption("鸡你太美", 114514)
- self.combobox.addOption("你干嘛嗨嗨呦", 1919)
- self.combobox.addOption("你好烦", 810)
- self.combobox.setOption("练习两年半")
-
- # 添加到 Sticker
- self.sticker_combobox.addItem(self.combobox)
- self.sticker_combobox.addSignalStatus("clicked", [self.combobox.clicked], "被点击时触发")
- self.sticker_combobox.addValueStatus(
- "holdStateChanged", [self.combobox.holdStateChanged], "被按下 / 松开时触发"
- )
- self.sticker_combobox.addValueStatus(
- "valueChanged", [self.combobox.valueChanged], "变更选项时触发,值为选项设定值"
- )
- self.sticker_combobox.addValueStatus(
- "textChanged", [self.combobox.textChanged], "变更选项时触发,值为选项设定文字"
- )
-
- # 添加到 Stack
- self.stack_menus.addItem(self.sticker_combobox)
-
- ## ================ Stack 开始 ===================
-
- self.stack_switchs = SiliconUI.SiCategory(self)
- self.stack_switchs.setTitle("开关")
-
- self.sticker_switch = WidgetsExampleDisplayer(self.stack_switchs)
- self.sticker_switch.setTitle("开关")
- self.sticker_switch.setCodeURL(GithubUrl.SiSwitch)
-
- self.switch = SiSwitch(self)
- self.switch.resize(150, 32)
-
- # 添加到 Sticker
- self.sticker_switch.addItem(self.switch)
- self.sticker_switch.addSignalStatus("clicked", [self.switch.clicked], "被点击时触发")
- self.sticker_switch.addValueStatus("stateChanged", [self.switch.stateChanged], "被点击时触发,值为开关状态")
-
- # 添加到 Stack
- self.stack_switchs.addItem(self.sticker_switch)
-
- ## ================ Stack 开始 ===================
-
- self.stack_sliderbar = SiliconUI.SiCategory(self)
- self.stack_sliderbar.setTitle("滑动条")
-
- self.sticker_sliderbar_free = WidgetsExampleDisplayer(self.stack_sliderbar)
- self.sticker_sliderbar_free.setTitle("连续滑动条")
- self.sticker_sliderbar_free.setCodeURL(GithubUrl.SiSliderBar)
-
- self.sliderbar_free = SiSliderBar(self)
- self.sliderbar_free.resize(500, 32)
-
- # 添加到 Sticker
- self.sticker_sliderbar_free.addItem(self.sliderbar_free)
- self.sticker_sliderbar_free.addValueStatus(
- "valueChanged", [self.sliderbar_free.valueChanged], "值改变时触发,值为滑动条当前值"
- )
-
- self.sticker_sliderbar_levelized = WidgetsExampleDisplayer(self.stack_sliderbar)
- self.sticker_sliderbar_levelized.setTitle("分档滑动条")
- self.sticker_sliderbar_levelized.setCodeURL(GithubUrl.SiSliderBar)
-
- self.sliderbar_levelized = SiSliderBar(self)
- self.sliderbar_levelized.resize(500, 32)
- self.sliderbar_levelized.setDispersed(range(0, 7))
-
- # 添加到 Sticker
- self.sticker_sliderbar_levelized.addItem(self.sliderbar_levelized)
- self.sticker_sliderbar_levelized.addValueStatus(
- "valueChanged", [self.sliderbar_levelized.valueChanged], "值改变时触发,值为滑动条当前值"
- )
-
- # 添加到 Stack
- self.stack_sliderbar.addItem(self.sticker_sliderbar_free)
- self.stack_sliderbar.addItem(self.sticker_sliderbar_levelized)
-
- ## ================ Stack 开始 ===================
-
- self.stack_inputboxes = SiliconUI.SiCategory(self)
- self.stack_inputboxes.setTitle("输入框")
-
- self.sticker_inputboxes = WidgetsExampleDisplayer(self.stack_inputboxes)
- self.sticker_inputboxes.setTitle("输入框")
- self.sticker_inputboxes.setCodeURL(GithubUrl.SiInputBox)
-
- self.inputbox = SiInputBox(self)
- self.inputbox.resize(300, 32)
-
- # 添加到 Sticker
- self.sticker_inputboxes.addItem(self.inputbox)
- self.sticker_inputboxes.addSignalStatus("editingFinished", [self.inputbox.editingFinished], "编辑已完成时触发")
- self.sticker_inputboxes.addSignalStatus("selectionChanged", [self.inputbox.selectionChanged], "选区改变时触发")
- self.sticker_inputboxes.addValueStatus(
- "cursorPositionChanged", [self.inputbox.cursorPositionChanged], "光标移动时触发,值为光标位置", width=96
- )
- self.sticker_inputboxes.addValueStatus("textEdited", [self.inputbox.textEdited], "文本被编辑时触发")
-
- # 添加到 Stack
- self.stack_inputboxes.addItem(self.sticker_inputboxes)
-
- ## ================ Stack 开始 ===================
-
- self.stack_progressbar = SiliconUI.SiCategory(self)
- self.stack_progressbar.setTitle("进度条")
-
- self.sticker_progressbar = WidgetsExampleDisplayer(self.stack_progressbar)
- self.sticker_progressbar.setTitle("进度条")
- self.sticker_progressbar.setWidth(800, 320)
-
- self.layout_progress_bar = SiliconUI.SiLayoutV(self)
-
- self.progress_bar = SiliconUI.SiProgressBar(self)
- self.progress_bar.setBorderRadius(3)
- self.progress_bar.resize(480, 6)
-
- self.layout_progress_bar_buttons = SiliconUI.SiLayoutH(self)
-
- self.random_progress = SiliconUI.SiButton(self)
- self.random_progress.setText("随机进度")
- self.random_progress.resize(128, 32)
- self.random_progress.clicked.connect(lambda: self.progress_bar.setProgress(random.random()))
-
- self.shift_status = SiliconUI.SiButton(self)
- self.shift_status.setText("随机切换状态")
- self.shift_status.resize(128, 32)
- self.shift_status.clicked.connect(lambda: self.progress_bar.setStatus(int(random.random() * 3)))
-
- self.random_color = SiliconUI.SiButton(self)
- self.random_color.setText("随机颜色")
- self.random_color.resize(128, 32)
- self.random_color.clicked.connect(lambda: self.progress_bar.setBarColor(Color.random()))
-
- self.stepping = SiliconUI.SiButton(self)
- self.stepping.setText("随机步进")
- self.stepping.resize(128, 32)
- self.stepping.clicked.connect(lambda: self.progress_bar.stepping(random.random() / 10))
-
- self.layout_progress_bar_buttons.addItem(self.random_progress)
- self.layout_progress_bar_buttons.addItem(self.shift_status)
- self.layout_progress_bar_buttons.addItem(self.random_color)
- self.layout_progress_bar_buttons.addItem(self.stepping)
-
- self.layout_progress_bar.addItem(self.progress_bar)
- self.layout_progress_bar.addItem(self.layout_progress_bar_buttons)
-
- self.sticker_progressbar.addItem(self.layout_progress_bar)
-
- self.stack_progressbar.addItem(self.sticker_progressbar)
-
- ## ================ Stack 开始 ===================
-
- self.stack_tableview = SiliconUI.SiCategory(self)
- self.stack_tableview.setTitle("表格")
-
- self.sticker_tableview = WidgetsExampleDisplayer(self.stack_tableview)
- self.sticker_tableview.setTitle("表格")
- self.sticker_tableview.setWidth(800, 320)
-
- self.table = SiliconUI.SiTable(self)
- self.table.setClasses(
- ["排名", "用户名", "分数", "准确率", "评级", "PP"],
- [
- 64,
- 196,
- 128,
- 96,
- 64,
- 64,
- ],
- )
- self.table.addData(["#1", "BeautifulChicken", "1,000,000", "100.00%", "SS", "120"])
- self.table.addData(["#2", "SummerainCN", "998,692", "98.87%", "S", "97"])
- self.table.addData(["#3", "ChinaIceF", "462,534", "92.14%", "A", "67"])
- self.table.addData(["#4", "SomeoneElse", "384,591", "91.25%", "A", "87"])
- self.table.addData(["#5", "Rick_fake", "273,479", "89.73%", "B", "76"])
- self.table.addData(["#6", "ImRealikun", "114,514", "91.98%", "A", "34"])
- self.table.addData(["#7", "PlayerA", "-", "-", "-", "-"])
- self.table.addData(["#8", "PlayerB", "-", "-", "-", "-"])
- self.table.addData(["#9", "PlayerC", "-", "-", "-", "-"])
- self.table.addData(["#10", "PlayerD", "-", "-", "-", "-"])
- self.table.resize(664, 200)
-
- self.sticker_tableview.addItem(self.table)
-
- self.stack_tableview.addItem(self.sticker_tableview)
-
- self.addItem(self.stack_labels)
- self.addItem(self.stack_buttons)
- self.addItem(self.stack_menus)
- self.addItem(self.stack_switchs)
- self.addItem(self.stack_sliderbar)
- self.addItem(self.stack_inputboxes)
- self.addItem(self.stack_progressbar)
- self.addItem(self.stack_tableview)
diff --git a/examples/Gallery/components/__init__.py b/examples/Gallery/components/__init__.py
deleted file mode 100644
index 09a0ea4..0000000
--- a/examples/Gallery/components/__init__.py
+++ /dev/null
@@ -1,8 +0,0 @@
-
-from . import Homepage
-from . import Glaze
-from . import Options
-from . import Widgets
-from . import ExperimentField
-from . import UpdateLogs
-from . import Layouts
diff --git a/examples/Gallery/components/experifield/__init__.py b/examples/Gallery/components/experifield/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/examples/Gallery/components/experifield/music_info_placeholder.py b/examples/Gallery/components/experifield/music_info_placeholder.py
deleted file mode 100644
index 70f938d..0000000
--- a/examples/Gallery/components/experifield/music_info_placeholder.py
+++ /dev/null
@@ -1,126 +0,0 @@
-from PyQt5.Qt import *
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5 import QtCore, QtGui, QtWidgets
-from PyQt5.QtCore import *
-from PyQt5.Qt import *
-from PyQt5.QtWidgets import QMainWindow, QApplication, QLabel, QLineEdit
-import numpy
-import time
-import os
-
-import SiliconUI
-import SiliconUI.SiGlobal as SiGlobal
-
-from SiliconUI.SiFont import *
-from SiliconUI.SiGlobal import colorset
-
-class MusicInfoPlaceholder(SiliconUI.SiSticker):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
-
- self.bg = SiliconUI.SiPixLabel(self)
- self.bg.setRadius(8)
- self.opacity = QGraphicsOpacityEffect()
- self.opacity.setOpacity(0.3)
- self.bg.setGraphicsEffect(self.opacity)
-
- # 所有内容 水平布局
- # 图片 信息 操作按钮
- self.layout_all_content = SiliconUI.SiLayoutH(self)
- self.layout_all_content.move(24, 24)
- self.layout_all_content.setInterval(24)
-
- # 封面
- self.cover = SiliconUI.SiPixLabel(self)
- self.cover.setRadius(24)
- self.cover.resize(80, 80)
-
- # 中间信息栏
- self.layout_info = SiliconUI.SiLayoutV(self)
- self.layout_info.setInterval(0)
-
- # 曲名
- self.title = SiliconUI.SiLabel(self)
- self.title.setFont(font_L2)
- self.title.setText('歌曲名')
-
- # 作者
- self.artist = SiliconUI.SiButtonLabel(self)
- self.artist.setText('艺术家')
- self.artist.setStyleSheet('''
- color: {}'''.format(colorset.TEXT_GRAD_HEX[2]))
-
- # 专辑
- self.album = SiliconUI.SiButtonLabel(self)
- self.album.setText('专辑')
- self.album.setStyleSheet('''
- color: {}'''.format(colorset.TEXT_GRAD_HEX[2]))
-
- self.layout_info.addItem(self.title)
- self.layout_info.addVacant(4)
- self.layout_info.addItem(self.artist)
- self.layout_info.addItem(self.album)
-
- self.layout_all_content.addItem(self.cover)
- self.layout_all_content.addItem(self.layout_info)
-
-
- # 右侧操作栏
- self.layout_operation = SiliconUI.SiLayoutV(self)
- self.layout_operation.setInterval(0)
-
- # 下载
- self.download = SiliconUI.SiButtonFlat(self)
- self.download.resize(32, 32)
- self.download.load(SiGlobal.icons.get('fi-rr-download'))
- self.download.setHint('下载单曲')
-
- # 收藏
- self.like = SiliconUI.SiButtonFlat(self)
- self.like.resize(32, 32)
- self.like.load(SiGlobal.icons.get('fi-rr-heart'))
- self.like.setHint('收藏')
-
- # 评论
- self.comments = SiliconUI.SiButtonFlat(self)
- self.comments.resize(32, 32)
- self.comments.load(SiGlobal.icons.get('fi-rr-comment'))
- self.comments.setHint('评论')
-
- self.layout_operation.addItem(self.download)
- self.layout_operation.addItem(self.like)
- self.layout_operation.addItem(self.comments)
-
-
- def setText(self, title = '', artist = '', album = ''):
- self.title.setText(title)
- self.artist.setText(artist)
- self.artist.setHint('艺术家 {}'.format(artist))
- self.album.setText(album)
- self.album.setHint('专辑 {}'.format(album))
-
- def setProgress(self, p):
- self.substrate.setStyleSheet('''
- background-color:qlineargradient(x1:{}, y1:0, x2:{}, y2:0,
- stop:0 {}, stop:1 {});
- border-radius:6px '''.format(
- p, p+0.00001, '#fed966', colorset.BG_GRAD_HEX[0]
- ))
-
- def load(self, path):
- self.cover.load(path)
- self.bg.load(path)
-
- def resizeEvent(self, event):
- super().resizeEvent(event)
- size = event.size()
- w, h = size.width(), size.height()
- self.layout_all_content.resize(w - 48, h - 48)
- self.layout_info.resize(self.layout_all_content.size())
- self.layout_operation.move(
- w - 24 - 32, (h - self.layout_operation.height()) // 2 - 2)
- self.bg.resize(w, h-3)
diff --git a/examples/Gallery/components/sub_example_A.py b/examples/Gallery/components/sub_example_A.py
deleted file mode 100644
index 22a8aab..0000000
--- a/examples/Gallery/components/sub_example_A.py
+++ /dev/null
@@ -1,97 +0,0 @@
-from PyQt5.Qt import *
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5 import QtCore, QtGui, QtWidgets
-from PyQt5.QtCore import *
-from PyQt5.Qt import *
-from PyQt5.QtWidgets import QMainWindow, QApplication, QLabel, QLineEdit
-import numpy
-import time
-import os
-
-import SiliconUI
-import SiliconUI.SiGlobal as SiGlobal
-
-
-class SubInterface_A(SiliconUI.SiOverlay.SubInterface):
- def __init__(self, parent, name):
- super().__init__()
-
- self.width = 724
- self.body = Body_A(parent)
- self.operation = Operation_A(parent)
- self.name = name
-
-class Operation_A(SiliconUI.SiLayoutH):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.setAlignment(Qt.AlignCenter)
-
- self.btn1 = SiliconUI.SiButton(self)
- self.btn1.resize(128, 32)
- self.btn1.setText('取消')
- self.btn1.setStrong(False)
-
- self.btn2 = SiliconUI.SiButton(self)
- self.btn2.resize(128, 32)
- self.btn2.setText('应用')
- self.btn2.setStrong(True)
-
- self.btn3 = SiliconUI.SiButton(self)
- self.btn3.resize(128, 32)
- self.btn3.setText('检查可用性')
- self.btn3.setStrong(False)
-
- self.addItem(self.btn1, 'left')
- self.addItem(self.btn2, 'right')
- self.addItem(self.btn3, 'right')
-
-class Body_A(SiliconUI.SiTab):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
-
- self.setTitle('设置通行证A')
-
- self.frame = SiliconUI.SiScrollFrame(self)
-
- # ========= stack 开始 =========
-
- self.stack_basics = SiliconUI.SiCategory(self.frame)
-
- self.inputpass = SiliconUI.SiOptionInputBox(self.stack_basics)
- self.inputpass.setText('通行证秘钥', '秘钥形如 XXXXX-XXXXX-XXXXX',)
- self.inputpass.setIcon(SiGlobal.icons.get('fi-rr-fingerprint'))
-
- self.proxy = SiliconUI.SiOptionInputBox(self.stack_basics)
- self.proxy.setText('代理', '代理服务器 IP,无可留空',)
- self.proxy.setIcon(SiGlobal.icons.get('fi-rr-data-transfer'))
-
- # 添加
- self.stack_basics.addItem(self.inputpass)
- self.stack_basics.addItem(self.proxy)
-
-
- # ========= stack 开始 =========
-
- self.stack_advances = SiliconUI.SiCategory(self.frame)
- self.stack_advances.setTitle('高级')
-
- self.try_to_update = SiliconUI.SiOptionSwitch(self.stack_advances)
- self.try_to_update.setText('自动更新通行证', '每次创建新连接时尝试向主机请求更新',)
- self.try_to_update.setIcon(SiGlobal.icons.get('fi-rr-network'))
-
- # 添加
- self.stack_advances.addItem(self.try_to_update)
-
-
- # 添加到 frame
- self.frame.addItem(self.stack_basics)
- self.frame.addItem(self.stack_advances)
-
- # 绑定 frame
- self.attachFrame(self.frame)
diff --git a/examples/Gallery/components/sub_example_B.py b/examples/Gallery/components/sub_example_B.py
deleted file mode 100644
index c0c03c4..0000000
--- a/examples/Gallery/components/sub_example_B.py
+++ /dev/null
@@ -1,136 +0,0 @@
-from PyQt5.Qt import *
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5 import QtCore, QtGui, QtWidgets
-from PyQt5.QtCore import *
-from PyQt5.Qt import *
-from PyQt5.QtWidgets import QMainWindow, QApplication, QLabel, QLineEdit
-import numpy
-import time
-import os
-
-import SiliconUI
-import SiliconUI.SiGlobal as SiGlobal
-
-
-class SubInterface_B(SiliconUI.SiOverlay.SubInterface):
- def __init__(self, parent, name):
- super().__init__()
-
- self.width_ = 740
- self.body = Body_B(parent)
- self.operation = Operation_B(parent)
- self.name = name
-
-class Operation_B(SiliconUI.SiLayoutH):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
- self.setAlignment(Qt.AlignCenter)
-
- self.btn1 = SiliconUI.SiButton(self)
- self.btn1.resize(128, 32)
- self.btn1.setText('取消')
- self.btn1.setStrong(False)
-
- self.btn2 = SiliconUI.SiButton(self)
- self.btn2.resize(128, 32)
- self.btn2.setText('应用')
- self.btn2.setStrong(True)
-
- self.btn3 = SiliconUI.SiButton(self)
- self.btn3.resize(128, 32)
- self.btn3.setText('管理备份文件夹')
- self.btn3.setStrong(False)
-
- self.addItem(self.btn1, 'left')
- self.addItem(self.btn2, 'right')
- self.addItem(self.btn3, 'right')
-
-class Body_B(SiliconUI.SiTab):
- def __init__(self, parent):
- super().__init__(parent)
- self.parent = parent
-
-
- self.setTitle('管理文件备份')
-
- self.frame = SiliconUI.SiScrollFrame(self)
-
- # ========= stack 开始 =========
-
- self.stack_dir = SiliconUI.SiCategory(self.frame)
- self.stack_dir.setTitle('目录设置')
-
- self.aim = SiliconUI.SiOptionInputBox(self.stack_dir)
- self.aim.setText('备份目标', '需要备份的目录或文件夹',)
- self.aim.setIcon(SiGlobal.icons.get('fi-rr-cloud-upload'))
-
- self.store = SiliconUI.SiOptionInputBox(self.stack_dir)
- self.store.setText('备份储存位置', '备份的文件储存的目录,留空将设置为工作目录',)
- self.store.setIcon(SiGlobal.icons.get('fi-rr-cloud-download'))
-
- # 添加
- self.stack_dir.addItem(self.aim)
- self.stack_dir.addItem(self.store)
-
-
- # ========= stack 开始 =========
-
- self.stack_settings = SiliconUI.SiCategory(self.frame)
- self.stack_settings.setTitle('备份设置')
-
- self.frequency = SiliconUI.SiOptionInputBox(self.stack_settings)
- self.frequency.setText('设置备份频率', '每天备份的次数',)
- self.frequency.setIcon(SiGlobal.icons.get('fi-rr-time-fast'))
-
- self.independency = SiliconUI.SiOptionSwitch(self.stack_settings)
- self.independency.setText('按备份时间创建目录', '每次备份储存在独立文件夹,这可能导致较大的储存占用',)
- self.independency.setIcon(SiGlobal.icons.get('fi-rr-folder'))
-
- self.mode = SiliconUI.SiOptionComboBox(self.stack_settings)
- self.mode.setText('储存模式', '选择创建备份时的行为',)
- self.mode.setIcon(SiGlobal.icons.get('fi-rr-folder'))
- self.mode.addOption('源文件', 0)
- self.mode.addOption('创建压缩文件', 1)
- self.mode.setOption('源文件')
-
- self.info_layout_v = SiliconUI.SiLayoutV(self.stack_settings)
- self.info_layout_v.setAlignment(Qt.AlignCenter)
-
- self.info_layout_h = SiliconUI.SiLayoutH(self.info_layout_v)
- self.info_layout_h.setAlignCenter(False)
-
- self.info = SiliconUI.SiInfo(self.info_layout_h)
- self.info.setFixedWidth(320)
- self.info.setType(0)
- self.info.setContent('提示', '· 备份目录将会被以 日期-次数-时间 的格式命名,并分立存放在储存目录下。\n· 当目标名称已存在时,会尝试在上述名称后加编号。')
-
- self.warning = SiliconUI.SiInfo(self.info_layout_h)
- self.warning.setFixedWidth(160)
- self.warning.setType(2)
- self.warning.setContent('注意', '· 请务必确认程序具有读写权限以访问和操作备份文件,否则备份可能无效')
-
- self.info_layout_h.addItem(self.info)
- self.info_layout_h.addItem(self.warning)
- self.info_layout_h.adjustSize()
-
- self.info_layout_v.addItem(self.info_layout_h)
- self.info_layout_v.adjustSize()
-
- # 添加
- self.stack_settings.addItem(self.frequency)
- self.stack_settings.addItem(self.independency)
- self.stack_settings.addItem(self.mode)
- self.stack_settings.addItem(self.info_layout_v)
- self.stack_settings.addVacant(16)
-
-
- # 添加到 frame
- self.frame.addItem(self.stack_dir)
- self.frame.addItem(self.stack_settings)
-
- # 绑定 frame
- self.attachFrame(self.frame)
diff --git a/examples/Gallery/components/web_url.py b/examples/Gallery/components/web_url.py
deleted file mode 100644
index 9f6bb38..0000000
--- a/examples/Gallery/components/web_url.py
+++ /dev/null
@@ -1,29 +0,0 @@
-import os
-from dataclasses import dataclass
-
-
-@dataclass(frozen=True)
-class GithubUrl:
- Author_Home: str = "https://github.com/ChinaIceF"
- SiliconUI_Home: str = Author_Home + "/PyQt-SiliconUI"
- Issues_New: str = SiliconUI_Home + "/issues/new"
- SiLabel: str = SiliconUI_Home + "/blob/main/SiliconUI/SiLabel.py"
- SiButton: str = SiliconUI_Home + "/blob/main/SiliconUI/SiButton.py"
- SiComboBox: str = SiliconUI_Home + "/blob/main/SiliconUI/SiComboBox.py"
- SiSwitch: str = SiliconUI_Home + "/blob/main/SiliconUI/SiSwitch.py"
- SiSliderBar: str = SiliconUI_Home + "/blob/main/SiliconUI/SiSliderBar.py"
- SiInputBox: str = SiliconUI_Home + "/blob/main/SiliconUI/SiInputBox.py"
-
-
-@dataclass(frozen=True)
-class BiliBiliUrl:
- Author_Home: str = "https://space.bilibili.com/390832893"
-
-
-def browse(url: str):
- os.system(f"start {url}")
-
-
-if __name__ == "__main__":
- # Example usage:
- browse(GithubUrl.SiliconUI_Home)
diff --git a/examples/Gallery/icons/__init__.py b/examples/Gallery/icons/__init__.py
deleted file mode 100644
index 8ef582f..0000000
--- a/examples/Gallery/icons/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from .parser import *
diff --git a/examples/Gallery/icons/icons.dat b/examples/Gallery/icons/icons.dat
deleted file mode 100644
index cc4b42d..0000000
Binary files a/examples/Gallery/icons/icons.dat and /dev/null differ
diff --git a/examples/Gallery/icons/parser.py b/examples/Gallery/icons/parser.py
deleted file mode 100644
index 2d947ce..0000000
--- a/examples/Gallery/icons/parser.py
+++ /dev/null
@@ -1,30 +0,0 @@
-import numpy
-import io
-from PyQt5.QtCore import QTemporaryFile, QByteArray, QIODevice
-
-class ICON_DICT(object):
- def __init__(self, library_path, color = None):
-
- # !注意! 你不应使用这些文件,他们已经过加密处理
- # 如果你需要这些图标文件,你可以直接在 flaticon.com 免费获取他们
-
- # 读取数据并解密
- f = open(library_path, 'rb')
- library_raw = f.read()
- library_list = list(library_raw)
- library = bytes(list((numpy.array(library_list) + numpy.array(range(len(library_list))) * 17) % 255)).decode() # 解密
-
- # 整理成字典
- items = library.split('!!!')
- names = []
- datas = []
- for item in items[1:]:
- name, data = item.split('###')
- data = data.replace('/>', ' fill="{}" />'.format(color))
- names.append(name)
- datas.append(data)
- self.icons = dict(zip(names, datas))
-
- def get(self, name):
- svg_data = self.icons[name]
- return svg_data.encode()
diff --git a/examples/Gallery/img/cover.jpeg b/examples/Gallery/img/cover.jpeg
deleted file mode 100644
index 26063af..0000000
Binary files a/examples/Gallery/img/cover.jpeg and /dev/null differ
diff --git a/examples/Gallery/img/cover2.jpg b/examples/Gallery/img/cover2.jpg
deleted file mode 100644
index 4697577..0000000
Binary files a/examples/Gallery/img/cover2.jpg and /dev/null differ
diff --git a/examples/Gallery/img/github.png b/examples/Gallery/img/github.png
deleted file mode 100644
index 91f7c11..0000000
Binary files a/examples/Gallery/img/github.png and /dev/null differ
diff --git a/examples/Gallery/img/headpic.png b/examples/Gallery/img/headpic.png
deleted file mode 100644
index 23effd7..0000000
Binary files a/examples/Gallery/img/headpic.png and /dev/null differ
diff --git a/examples/Gallery/img/headpic2.jpg b/examples/Gallery/img/headpic2.jpg
deleted file mode 100644
index 2dc8327..0000000
Binary files a/examples/Gallery/img/headpic2.jpg and /dev/null differ
diff --git a/examples/Gallery/img/image.png b/examples/Gallery/img/image.png
deleted file mode 100644
index 8adf502..0000000
Binary files a/examples/Gallery/img/image.png and /dev/null differ
diff --git a/examples/Gallery/img/logo.png b/examples/Gallery/img/logo.png
deleted file mode 100644
index 9efaf7b..0000000
Binary files a/examples/Gallery/img/logo.png and /dev/null differ
diff --git a/examples/Gallery/img/wiki.png b/examples/Gallery/img/wiki.png
deleted file mode 100644
index 7e7f95f..0000000
Binary files a/examples/Gallery/img/wiki.png and /dev/null differ
diff --git a/examples/Gallery/start.py b/examples/Gallery/start.py
deleted file mode 100644
index fc73337..0000000
--- a/examples/Gallery/start.py
+++ /dev/null
@@ -1,20 +0,0 @@
-
-import sys
-
-import ui as ui
-from PyQt5 import QtCore
-from PyQt5.QtWidgets import QApplication
-
-import siui
-
-siui.gui.set_scale_factor(1)
-
-if __name__ == "__main__":
-
- # 适应高DPI设备
- QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)
-
- app = QApplication(sys.argv)
- Window = ui.UserInterface()
- Window.show()
- sys.exit(app.exec_())
diff --git a/examples/Gallery/ui.py b/examples/Gallery/ui.py
deleted file mode 100644
index e060137..0000000
--- a/examples/Gallery/ui.py
+++ /dev/null
@@ -1,174 +0,0 @@
-from PyQt5.Qt import *
-from PyQt5.QtCore import *
-from PyQt5.QtWidgets import *
-from PyQt5.QtGui import *
-from PyQt5 import QtCore, QtGui, QtWidgets
-from PyQt5.QtCore import *
-from PyQt5.Qt import *
-from PyQt5.QtWidgets import QMainWindow, QApplication, QLabel, QLineEdit, QDesktopWidget
-import numpy
-import time
-import os
-
-import SiliconUI
-from SiliconUI.SiHint import *
-from SiliconUI.SiOverlay import *
-import SiliconUI.SiGlobal as SiGlobal
-
-import components as Components
-from siui.components.tooltip import ToolTipWindow
-import siui
-
-# 加载图标
-import icons
-SiGlobal.icons = icons.ICON_DICT('./icons/icons.dat', siui.core.globals.SiGlobal.siui.colors["TEXT_A"])
-
-class UserInterface(QMainWindow):
- def __init__(self):
- super().__init__()
- # 设置最小宽度
- self.setMinimumWidth(860)
-
- # 初始化 Hint 提示条
- self.floating_window = ToolTipWindow()
- self.floating_window.setWindowOpacity(0) # 初始隐藏小窗口
- self.floating_window.show()
- SiGlobal.floating_window = self.floating_window
-
- # 初始化二级界面叠加层
- self.overlay = SiOverlay(self)
- SiGlobal.overlay = self.overlay
-
- # 构建界面
- self.initUI()
-
- # 叠加层置顶
- self.overlay.raise_()
-
- # 加载样式表
- siui.core.globals.SiGlobal.siui.loadWindows(
- {
- "MAIN_WINDOW": self,
- "TOOL_TIP": self.floating_window
- }
- )
- siui.core.globals.SiGlobal.siui.reloadAllWindowsStyleSheet()
-
- def showEvent(self, event):
- self.overlay.showup_animation.setCurrent(self.geometry().height())
- self.overlay.moveFrame(self.geometry().height())
- self.overlay.hide()
-
- def reload_all_stylesheet(self, windows):
- start_time = time.time()
- self.reload_stylesheet_tried = 0
- self.reload_stylesheet_succeed = 0
-
- for window in windows:
- self.refresh_children_stylesheet(window)
-
- print("""重新加载全局样式表已完成(尝试{}次,成功{}次,失败{}次,用时 {} sec)""".format(
- self.reload_stylesheet_tried,
- self.reload_stylesheet_succeed,
- self.reload_stylesheet_tried - self.reload_stylesheet_succeed,
- time.time() - start_time
- ))
-
- def refresh_children_stylesheet(self, parent):
- for child in parent.children():
- self.reload_stylesheet_tried += 1
- try:
- child.reloadStyleSheet()
- self.reload_stylesheet_succeed += 1
- except:
- pass
- self.refresh_children_stylesheet(child)
-
- def resizeEvent(self, event):
- w = event.size().width()
- h = event.size().height()
- self.stackarea.setGeometry(0, 0, w, h)
- self.overlay.setGeometry(0, 0, w, h)
-
- def initUI(self):
-
- # 对象从属关系
- # SiliconUI.SiTabArea
- # SiliconUI.SiTab (里面包含一个标题和一个SiliconUI.SiScrollArea)
- # SiliconUI.SiScrollFrame
- # SiliconUI.SiStack
- # SiliconUI.SiOptionButton
- # SiliconUI.SiOptionSwitch
- # SiliconUI.SiOptionComboBox
- # ......
-
- # 初始化窗口
-
- screen_geo = QDesktopWidget().screenGeometry()
- w = 1200
- h = 700
-
- self.setAttribute(Qt.WA_TranslucentBackground)
- self.setGeometry((screen_geo.width()-w)//2, (screen_geo.height()-h)//2, w, h)
- self.setWindowTitle("Silicon Gallery")
-
- self.stackarea = SiliconUI.SiTabArea(self)
- self.stackarea.setGeometry(0, 0, 1200, 600)
-
- self.logo = QLabel(self)
- self.logo.setPixmap(QPixmap('./img/logo.png'))
- self.logo.setGeometry(64+4, 16+4, 24, 24)
-
- self.window_title = QLabel(self)
- self.window_title.setStyleSheet('color: {}'.format(colorset.TEXT_GRAD_HEX[1]))
- self.window_title.setGeometry(104, 0, 500, 64)
- self.window_title.setText('Silicon Gallery')
- self.window_title.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)
- self.window_title.setFont(SiliconUI.SiFont.font_L1_bold)
-
- # 初始化各个界面
- self.homepage = SiliconUI.SiTab(self)
- self.homepage.setTitleHeight(0)
- self.homepage.scrollarea.rightside_interval = 0
- self.homepage.attachFrame(Components.Homepage.SiHomePage(self.homepage))
- self.homepage.scrollarea.scrollbar.raise_()
-
- self.glaze_example = SiliconUI.SiTab(self)
- self.glaze_example.setTitle('Silicon Glaze 示例')
- self.glaze_example.attachFrame(Components.Glaze.GlazeExample(self.glaze_example))
- self.glaze_example.scrollarea.scrollbar.raise_()
-
- self.widgets_example = SiliconUI.SiTab(self)
- self.widgets_example.setTitle('控件')
- self.widgets_example.attachFrame(Components.Widgets.WidgetsExample(self.widgets_example))
- self.widgets_example.scrollarea.scrollbar.raise_()
-
- self.layouts_example = SiliconUI.SiTab(self)
- self.layouts_example.setTitle('布局')
- self.layouts_example.attachFrame(Components.Layouts.LayoutsExample(self.layouts_example))
- self.layouts_example.scrollarea.scrollbar.raise_()
-
- self.experiment_field = SiliconUI.SiTab(self)
- self.experiment_field.setTitle('实验场')
- self.experiment_field.attachFrame(Components.ExperimentField.ExperimentField(self.experiment_field))
- self.experiment_field.scrollarea.scrollbar.raise_()
-
- self.update_logs = SiliconUI.SiTab(self)
- self.update_logs.setTitle('更新日志')
- self.update_logs.attachFrame(Components.UpdateLogs.UpdateLogs(self.update_logs))
- self.update_logs.scrollarea.scrollbar.raise_()
-
- self.options = SiliconUI.SiTab(self)
- self.options.setTitle('设置')
- self.options.attachFrame(Components.Options.Options(self.options))
- self.options.scrollarea.scrollbar.raise_()
-
- # 添加到 stackarea
- self.stackarea.addTab(self.homepage, SiGlobal.icons.get('fi-rr-home'), '主页面')
- self.stackarea.addTab(self.widgets_example, SiGlobal.icons.get('fi-rr-layout-fluid'), '控件')
- self.stackarea.addTab(self.layouts_example, SiGlobal.icons.get('fi-rr-copy'), '布局')
- self.stackarea.addTab(self.glaze_example, SiGlobal.icons.get('fi-rr-list'), 'Silicon Glaze 示例')
- #self.stackarea.addTab(self.experiment_field, SiGlobal.icons.get('fi-rr-bulb'), '实验场')
-
- self.stackarea.addTab(self.options, SiGlobal.icons.get('fi-rr-settings'), '设置', 'bottom')
- self.stackarea.addTab(self.update_logs, SiGlobal.icons.get('fi-rr-e-learning'), '更新日志', 'bottom')
diff --git a/examples/Gallery/updatelogs/updates.txt b/examples/Gallery/updatelogs/updates.txt
deleted file mode 100644
index 91dd37f..0000000
--- a/examples/Gallery/updatelogs/updates.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-:: 2024.6.25
-##
- ־
- Ϊ SiLabel Ӵƶ moveTo(x, y)
- ʽ SiLayout.SiFlowLayout
- ڶƶʱȳԵ moveTo ᾡʹöΪ
-## ©
- ScrollArea.refresh_components 0Ĵ self.refresh_bar_geometry() ֻݳ߶ʱ
- SiLabel.MovableLabelMoveAnimation ©
-##
-
-:: 2024.6.28
-##
- ɾ SiStack.py
-## ©
- adjustSizeεôӶ½bug
-##
- ֵļ̳жQLabelΪSiLabel
- ȥSiStackΪSiCategory
- 岻refresh_componentΪadjustItemGeometry
\ No newline at end of file