Python-FastUI-Widgets 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. fastuiwidgets/__init__.py +12 -0
  2. fastuiwidgets/_rc/__init__.py +0 -0
  3. fastuiwidgets/_rc/resource.py +98835 -0
  4. fastuiwidgets/common/__init__.py +12 -0
  5. fastuiwidgets/common/animation.py +530 -0
  6. fastuiwidgets/common/auto_wrap.py +164 -0
  7. fastuiwidgets/common/color.py +95 -0
  8. fastuiwidgets/common/config.py +423 -0
  9. fastuiwidgets/common/exception_handler.py +31 -0
  10. fastuiwidgets/common/font.py +38 -0
  11. fastuiwidgets/common/icon.py +703 -0
  12. fastuiwidgets/common/image_utils.py +198 -0
  13. fastuiwidgets/common/overload.py +47 -0
  14. fastuiwidgets/common/router.py +133 -0
  15. fastuiwidgets/common/screen.py +25 -0
  16. fastuiwidgets/common/smooth_scroll.py +141 -0
  17. fastuiwidgets/common/style_sheet.py +512 -0
  18. fastuiwidgets/common/theme_listener.py +27 -0
  19. fastuiwidgets/common/translator.py +14 -0
  20. fastuiwidgets/components/__init__.py +6 -0
  21. fastuiwidgets/components/date_time/__init__.py +4 -0
  22. fastuiwidgets/components/date_time/calendar_picker.py +121 -0
  23. fastuiwidgets/components/date_time/calendar_view.py +671 -0
  24. fastuiwidgets/components/date_time/date_picker.py +245 -0
  25. fastuiwidgets/components/date_time/fast_calendar_view.py +487 -0
  26. fastuiwidgets/components/date_time/picker_base.py +632 -0
  27. fastuiwidgets/components/date_time/time_picker.py +223 -0
  28. fastuiwidgets/components/dialog_box/__init__.py +6 -0
  29. fastuiwidgets/components/dialog_box/color_dialog.py +414 -0
  30. fastuiwidgets/components/dialog_box/dialog.py +167 -0
  31. fastuiwidgets/components/dialog_box/folder_list_dialog.py +307 -0
  32. fastuiwidgets/components/dialog_box/mask_dialog_base.py +120 -0
  33. fastuiwidgets/components/dialog_box/message_box_base.py +92 -0
  34. fastuiwidgets/components/dialog_box/message_dialog.py +65 -0
  35. fastuiwidgets/components/layout/__init__.py +3 -0
  36. fastuiwidgets/components/layout/expand_layout.py +96 -0
  37. fastuiwidgets/components/layout/flow_layout.py +236 -0
  38. fastuiwidgets/components/layout/v_box_layout.py +41 -0
  39. fastuiwidgets/components/material/__init__.py +6 -0
  40. fastuiwidgets/components/material/acrylic_combo_box.py +96 -0
  41. fastuiwidgets/components/material/acrylic_flyout.py +105 -0
  42. fastuiwidgets/components/material/acrylic_line_edit.py +27 -0
  43. fastuiwidgets/components/material/acrylic_menu.py +204 -0
  44. fastuiwidgets/components/material/acrylic_tool_tip.py +39 -0
  45. fastuiwidgets/components/material/acrylic_widget.py +42 -0
  46. fastuiwidgets/components/navigation/__init__.py +9 -0
  47. fastuiwidgets/components/navigation/breadcrumb.py +350 -0
  48. fastuiwidgets/components/navigation/navigation_bar.py +416 -0
  49. fastuiwidgets/components/navigation/navigation_interface.py +268 -0
  50. fastuiwidgets/components/navigation/navigation_panel.py +657 -0
  51. fastuiwidgets/components/navigation/navigation_widget.py +686 -0
  52. fastuiwidgets/components/navigation/pivot.py +272 -0
  53. fastuiwidgets/components/navigation/segmented_widget.py +174 -0
  54. fastuiwidgets/components/settings/__init__.py +8 -0
  55. fastuiwidgets/components/settings/custom_color_setting_card.py +139 -0
  56. fastuiwidgets/components/settings/expand_setting_card.py +390 -0
  57. fastuiwidgets/components/settings/folder_list_setting_card.py +134 -0
  58. fastuiwidgets/components/settings/options_setting_card.py +86 -0
  59. fastuiwidgets/components/settings/setting_card.py +449 -0
  60. fastuiwidgets/components/settings/setting_card_group.py +48 -0
  61. fastuiwidgets/components/widgets/__init__.py +41 -0
  62. fastuiwidgets/components/widgets/acrylic_label.py +261 -0
  63. fastuiwidgets/components/widgets/button.py +1059 -0
  64. fastuiwidgets/components/widgets/card_widget.py +369 -0
  65. fastuiwidgets/components/widgets/check_box.py +203 -0
  66. fastuiwidgets/components/widgets/combo_box.py +556 -0
  67. fastuiwidgets/components/widgets/command_bar.py +636 -0
  68. fastuiwidgets/components/widgets/cycle_list_widget.py +251 -0
  69. fastuiwidgets/components/widgets/flip_view.py +430 -0
  70. fastuiwidgets/components/widgets/flyout.py +521 -0
  71. fastuiwidgets/components/widgets/frameless_window.py +49 -0
  72. fastuiwidgets/components/widgets/icon_widget.py +53 -0
  73. fastuiwidgets/components/widgets/info_badge.py +483 -0
  74. fastuiwidgets/components/widgets/info_bar.py +596 -0
  75. fastuiwidgets/components/widgets/label.py +553 -0
  76. fastuiwidgets/components/widgets/line_edit.py +551 -0
  77. fastuiwidgets/components/widgets/list_view.py +158 -0
  78. fastuiwidgets/components/widgets/menu.py +1318 -0
  79. fastuiwidgets/components/widgets/pips_pager.py +331 -0
  80. fastuiwidgets/components/widgets/progress_bar.py +311 -0
  81. fastuiwidgets/components/widgets/progress_ring.py +212 -0
  82. fastuiwidgets/components/widgets/scroll_area.py +125 -0
  83. fastuiwidgets/components/widgets/scroll_bar.py +673 -0
  84. fastuiwidgets/components/widgets/separator.py +43 -0
  85. fastuiwidgets/components/widgets/slider.py +307 -0
  86. fastuiwidgets/components/widgets/spin_box.py +306 -0
  87. fastuiwidgets/components/widgets/stacked_widget.py +211 -0
  88. fastuiwidgets/components/widgets/state_tool_tip.py +188 -0
  89. fastuiwidgets/components/widgets/switch_button.py +312 -0
  90. fastuiwidgets/components/widgets/tab_view.py +804 -0
  91. fastuiwidgets/components/widgets/table_view.py +360 -0
  92. fastuiwidgets/components/widgets/teaching_tip.py +657 -0
  93. fastuiwidgets/components/widgets/tool_tip.py +460 -0
  94. fastuiwidgets/components/widgets/tree_view.py +216 -0
  95. fastuiwidgets/multimedia/__init__.py +3 -0
  96. fastuiwidgets/multimedia/media_play_bar.py +319 -0
  97. fastuiwidgets/multimedia/media_player.py +124 -0
  98. fastuiwidgets/multimedia/video_widget.py +93 -0
  99. fastuiwidgets/window/__init__.py +2 -0
  100. fastuiwidgets/window/fluent_window.py +413 -0
  101. fastuiwidgets/window/splash_screen.py +92 -0
  102. fastuiwidgets/window/stacked_widget.py +66 -0
  103. python_fastui_widgets-1.0.0.dist-info/METADATA +30 -0
  104. python_fastui_widgets-1.0.0.dist-info/RECORD +107 -0
  105. python_fastui_widgets-1.0.0.dist-info/WHEEL +5 -0
  106. python_fastui_widgets-1.0.0.dist-info/licenses/LICENSE +674 -0
  107. python_fastui_widgets-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,449 @@
1
+ # coding:utf-8
2
+ from typing import Union
3
+
4
+ from PySide6.QtCore import Qt, Signal
5
+ from PySide6.QtGui import QColor, QIcon, QPainter
6
+ from PySide6.QtWidgets import QFrame, QHBoxLayout, QLabel, QToolButton, QVBoxLayout, QPushButton
7
+ from PySide6.QtSvgWidgets import QSvgWidget
8
+
9
+ from ..dialog_box.color_dialog import ColorDialog
10
+ from ..widgets.combo_box import ComboBox
11
+ from ..widgets.switch_button import SwitchButton, IndicatorPosition
12
+ from ..widgets.slider import Slider
13
+ from ..widgets.icon_widget import IconWidget
14
+ from ..widgets.button import HyperlinkButton
15
+ from ...common.style_sheet import FluentStyleSheet
16
+ from ...common.config import qconfig, isDarkTheme, ConfigItem, OptionsConfigItem
17
+ from ...common.icon import FluentIconBase, drawIcon
18
+
19
+
20
+ class SettingIconWidget(IconWidget):
21
+
22
+ def paintEvent(self, e):
23
+ painter = QPainter(self)
24
+
25
+ if not self.isEnabled():
26
+ painter.setOpacity(0.36)
27
+
28
+ painter.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform)
29
+ drawIcon(self._icon, painter, self.rect())
30
+
31
+
32
+
33
+ class SettingCard(QFrame):
34
+ """ Setting card """
35
+
36
+ def __init__(self, icon: Union[str, QIcon, FluentIconBase], title, content=None, parent=None):
37
+ """
38
+ Parameters
39
+ ----------
40
+ icon: str | QIcon | FluentIconBase
41
+ the icon to be drawn
42
+
43
+ title: str
44
+ the title of card
45
+
46
+ content: str
47
+ the content of card
48
+
49
+ parent: QWidget
50
+ parent widget
51
+ """
52
+ super().__init__(parent=parent)
53
+ self.iconLabel = SettingIconWidget(icon, self)
54
+ self.titleLabel = QLabel(title, self)
55
+ self.contentLabel = QLabel(content or '', self)
56
+ self.hBoxLayout = QHBoxLayout(self)
57
+ self.vBoxLayout = QVBoxLayout()
58
+
59
+ if not content:
60
+ self.contentLabel.hide()
61
+
62
+ self.setFixedHeight(70 if content else 50)
63
+ self.iconLabel.setFixedSize(16, 16)
64
+
65
+ # initialize layout
66
+ self.hBoxLayout.setSpacing(0)
67
+ self.hBoxLayout.setContentsMargins(16, 0, 0, 0)
68
+ self.hBoxLayout.setAlignment(Qt.AlignVCenter)
69
+ self.vBoxLayout.setSpacing(0)
70
+ self.vBoxLayout.setContentsMargins(0, 0, 0, 0)
71
+ self.vBoxLayout.setAlignment(Qt.AlignVCenter)
72
+
73
+ self.hBoxLayout.addWidget(self.iconLabel, 0, Qt.AlignLeft)
74
+ self.hBoxLayout.addSpacing(16)
75
+
76
+ self.hBoxLayout.addLayout(self.vBoxLayout)
77
+ self.vBoxLayout.addWidget(self.titleLabel, 0, Qt.AlignLeft)
78
+ self.vBoxLayout.addWidget(self.contentLabel, 0, Qt.AlignLeft)
79
+
80
+ self.hBoxLayout.addSpacing(16)
81
+ self.hBoxLayout.addStretch(1)
82
+
83
+ self.contentLabel.setObjectName('contentLabel')
84
+ FluentStyleSheet.SETTING_CARD.apply(self)
85
+
86
+ def setTitle(self, title: str):
87
+ """ set the title of card """
88
+ self.titleLabel.setText(title)
89
+
90
+ def setContent(self, content: str):
91
+ """ set the content of card """
92
+ self.contentLabel.setText(content)
93
+ self.contentLabel.setVisible(bool(content))
94
+
95
+ def setValue(self, value):
96
+ """ set the value of config item """
97
+ pass
98
+
99
+ def setIconSize(self, width: int, height: int):
100
+ """ set the icon fixed size """
101
+ self.iconLabel.setFixedSize(width, height)
102
+
103
+ def paintEvent(self, e):
104
+ painter = QPainter(self)
105
+ painter.setRenderHints(QPainter.Antialiasing)
106
+
107
+ if isDarkTheme():
108
+ painter.setBrush(QColor(255, 255, 255, 13))
109
+ painter.setPen(QColor(0, 0, 0, 50))
110
+ else:
111
+ painter.setBrush(QColor(255, 255, 255, 170))
112
+ painter.setPen(QColor(0, 0, 0, 19))
113
+
114
+ painter.drawRoundedRect(self.rect().adjusted(1, 1, -1, -1), 6, 6)
115
+
116
+
117
+
118
+ class SwitchSettingCard(SettingCard):
119
+ """ Setting card with switch button """
120
+
121
+ checkedChanged = Signal(bool)
122
+
123
+ def __init__(self, icon: Union[str, QIcon, FluentIconBase], title, content=None,
124
+ configItem: ConfigItem = None, parent=None):
125
+ """
126
+ Parameters
127
+ ----------
128
+ icon: str | QIcon | FluentIconBase
129
+ the icon to be drawn
130
+
131
+ title: str
132
+ the title of card
133
+
134
+ content: str
135
+ the content of card
136
+
137
+ configItem: ConfigItem
138
+ configuration item operated by the card
139
+
140
+ parent: QWidget
141
+ parent widget
142
+ """
143
+ super().__init__(icon, title, content, parent)
144
+ self.configItem = configItem
145
+ self.switchButton = SwitchButton(
146
+ self.tr('Off'), self, IndicatorPosition.RIGHT)
147
+
148
+ if configItem:
149
+ self.setValue(qconfig.get(configItem))
150
+ configItem.valueChanged.connect(self.setValue)
151
+
152
+ # add switch button to layout
153
+ self.hBoxLayout.addWidget(self.switchButton, 0, Qt.AlignRight)
154
+ self.hBoxLayout.addSpacing(16)
155
+
156
+ self.switchButton.checkedChanged.connect(self.__onCheckedChanged)
157
+
158
+ def __onCheckedChanged(self, isChecked: bool):
159
+ """ switch button checked state changed slot """
160
+ self.setValue(isChecked)
161
+ self.checkedChanged.emit(isChecked)
162
+
163
+ def setValue(self, isChecked: bool):
164
+ if self.configItem:
165
+ qconfig.set(self.configItem, isChecked)
166
+
167
+ self.switchButton.setChecked(isChecked)
168
+ self.switchButton.setText(
169
+ self.tr('On') if isChecked else self.tr('Off'))
170
+
171
+ def setChecked(self, isChecked: bool):
172
+ self.setValue(isChecked)
173
+
174
+ def isChecked(self):
175
+ return self.switchButton.isChecked()
176
+
177
+
178
+ class RangeSettingCard(SettingCard):
179
+ """ Setting card with a slider """
180
+
181
+ valueChanged = Signal(int)
182
+
183
+ def __init__(self, configItem, icon: Union[str, QIcon, FluentIconBase], title, content=None, parent=None):
184
+ """
185
+ Parameters
186
+ ----------
187
+ configItem: RangeConfigItem
188
+ configuration item operated by the card
189
+
190
+ icon: str | QIcon | FluentIconBase
191
+ the icon to be drawn
192
+
193
+ title: str
194
+ the title of card
195
+
196
+ content: str
197
+ the content of card
198
+
199
+ parent: QWidget
200
+ parent widget
201
+ """
202
+ super().__init__(icon, title, content, parent)
203
+ self.configItem = configItem
204
+ self.slider = Slider(Qt.Horizontal, self)
205
+ self.valueLabel = QLabel(self)
206
+ self.slider.setMinimumWidth(268)
207
+
208
+ self.slider.setSingleStep(1)
209
+ self.slider.setRange(*configItem.range)
210
+ self.slider.setValue(configItem.value)
211
+ self.valueLabel.setNum(configItem.value)
212
+
213
+ self.hBoxLayout.addStretch(1)
214
+ self.hBoxLayout.addWidget(self.valueLabel, 0, Qt.AlignRight)
215
+ self.hBoxLayout.addSpacing(6)
216
+ self.hBoxLayout.addWidget(self.slider, 0, Qt.AlignRight)
217
+ self.hBoxLayout.addSpacing(16)
218
+
219
+ self.valueLabel.setObjectName('valueLabel')
220
+ configItem.valueChanged.connect(self.setValue)
221
+ self.slider.valueChanged.connect(self.__onValueChanged)
222
+
223
+ def __onValueChanged(self, value: int):
224
+ """ slider value changed slot """
225
+ self.setValue(value)
226
+ self.valueChanged.emit(value)
227
+
228
+ def setValue(self, value):
229
+ qconfig.set(self.configItem, value)
230
+ self.valueLabel.setNum(value)
231
+ self.valueLabel.adjustSize()
232
+ self.slider.setValue(value)
233
+
234
+
235
+ class PushSettingCard(SettingCard):
236
+ """ Setting card with a push button """
237
+
238
+ clicked = Signal()
239
+
240
+ def __init__(self, text, icon: Union[str, QIcon, FluentIconBase], title, content=None, parent=None):
241
+ """
242
+ Parameters
243
+ ----------
244
+ text: str
245
+ the text of push button
246
+
247
+ icon: str | QIcon | FluentIconBase
248
+ the icon to be drawn
249
+
250
+ title: str
251
+ the title of card
252
+
253
+ content: str
254
+ the content of card
255
+
256
+ parent: QWidget
257
+ parent widget
258
+ """
259
+ super().__init__(icon, title, content, parent)
260
+ self.button = QPushButton(text, self)
261
+ self.hBoxLayout.addWidget(self.button, 0, Qt.AlignRight)
262
+ self.hBoxLayout.addSpacing(16)
263
+ self.button.clicked.connect(self.clicked)
264
+
265
+
266
+ class PrimaryPushSettingCard(PushSettingCard):
267
+ """ Push setting card with primary color """
268
+
269
+ def __init__(self, text, icon, title, content=None, parent=None):
270
+ super().__init__(text, icon, title, content, parent)
271
+ self.button.setObjectName('primaryButton')
272
+
273
+
274
+ class HyperlinkCard(SettingCard):
275
+ """ Hyperlink card """
276
+
277
+ def __init__(self, url, text, icon: Union[str, QIcon, FluentIconBase], title, content=None, parent=None):
278
+ """
279
+ Parameters
280
+ ----------
281
+ url: str
282
+ the url to be opened
283
+
284
+ text: str
285
+ text of url
286
+
287
+ icon: str | QIcon | FluentIconBase
288
+ the icon to be drawn
289
+
290
+ title: str
291
+ the title of card
292
+
293
+ content: str
294
+ the content of card
295
+
296
+ text: str
297
+ the text of push button
298
+
299
+ parent: QWidget
300
+ parent widget
301
+ """
302
+ super().__init__(icon, title, content, parent)
303
+ self.linkButton = HyperlinkButton(url, text, self)
304
+ self.hBoxLayout.addWidget(self.linkButton, 0, Qt.AlignRight)
305
+ self.hBoxLayout.addSpacing(16)
306
+
307
+
308
+ class ColorPickerButton(QToolButton):
309
+ """ Color picker button """
310
+
311
+ colorChanged = Signal(QColor)
312
+
313
+ def __init__(self, color: QColor, title: str, parent=None, enableAlpha=False):
314
+ super().__init__(parent=parent)
315
+ self.title = title
316
+ self.enableAlpha = enableAlpha
317
+ self.setFixedSize(96, 32)
318
+ self.setAttribute(Qt.WA_TranslucentBackground)
319
+
320
+ self.setColor(color)
321
+ self.setCursor(Qt.PointingHandCursor)
322
+ self.clicked.connect(self.__showColorDialog)
323
+
324
+ def __showColorDialog(self):
325
+ """ show color dialog """
326
+ w = ColorDialog(self.color, self.tr(
327
+ 'Choose ')+self.title, self.window(), self.enableAlpha)
328
+ w.colorChanged.connect(self.__onColorChanged)
329
+ w.exec()
330
+
331
+ def __onColorChanged(self, color):
332
+ """ color changed slot """
333
+ self.setColor(color)
334
+ self.colorChanged.emit(color)
335
+
336
+ def setColor(self, color):
337
+ """ set color """
338
+ self.color = QColor(color)
339
+ self.update()
340
+
341
+ def paintEvent(self, e):
342
+ painter = QPainter(self)
343
+ painter.setRenderHints(QPainter.Antialiasing)
344
+ pc = QColor(255, 255, 255, 10) if isDarkTheme() else QColor(234, 234, 234)
345
+ painter.setPen(pc)
346
+
347
+ color = QColor(self.color)
348
+ if not self.enableAlpha:
349
+ color.setAlpha(255)
350
+
351
+ painter.setBrush(color)
352
+ painter.drawRoundedRect(self.rect().adjusted(1, 1, -1, -1), 5, 5)
353
+
354
+
355
+ class ColorSettingCard(SettingCard):
356
+ """ Setting card with color picker """
357
+
358
+ colorChanged = Signal(QColor)
359
+
360
+ def __init__(self, configItem, icon: Union[str, QIcon, FluentIconBase],
361
+ title: str, content: str = None, parent=None, enableAlpha=False):
362
+ """
363
+ Parameters
364
+ ----------
365
+ configItem: RangeConfigItem
366
+ configuration item operated by the card
367
+
368
+ icon: str | QIcon | FluentIconBase
369
+ the icon to be drawn
370
+
371
+ title: str
372
+ the title of card
373
+
374
+ content: str
375
+ the content of card
376
+
377
+ parent: QWidget
378
+ parent widget
379
+
380
+ enableAlpha: bool
381
+ whether to enable the alpha channel
382
+ """
383
+ super().__init__(icon, title, content, parent)
384
+ self.configItem = configItem
385
+ self.colorPicker = ColorPickerButton(
386
+ qconfig.get(configItem), title, self, enableAlpha)
387
+ self.hBoxLayout.addWidget(self.colorPicker, 0, Qt.AlignRight)
388
+ self.hBoxLayout.addSpacing(16)
389
+ self.colorPicker.colorChanged.connect(self.__onColorChanged)
390
+ configItem.valueChanged.connect(self.setValue)
391
+
392
+ def __onColorChanged(self, color: QColor):
393
+ qconfig.set(self.configItem, color)
394
+ self.colorChanged.emit(color)
395
+
396
+ def setValue(self, color: QColor):
397
+ self.colorPicker.setColor(color)
398
+ qconfig.set(self.configItem, color)
399
+
400
+
401
+ class ComboBoxSettingCard(SettingCard):
402
+ """ Setting card with a combo box """
403
+
404
+ def __init__(self, configItem: OptionsConfigItem, icon: Union[str, QIcon, FluentIconBase], title, content=None, texts=None, parent=None):
405
+ """
406
+ Parameters
407
+ ----------
408
+ configItem: OptionsConfigItem
409
+ configuration item operated by the card
410
+
411
+ icon: str | QIcon | FluentIconBase
412
+ the icon to be drawn
413
+
414
+ title: str
415
+ the title of card
416
+
417
+ content: str
418
+ the content of card
419
+
420
+ texts: List[str]
421
+ the text of items
422
+
423
+ parent: QWidget
424
+ parent widget
425
+ """
426
+ super().__init__(icon, title, content, parent)
427
+ self.configItem = configItem
428
+ self.comboBox = ComboBox(self)
429
+ self.hBoxLayout.addWidget(self.comboBox, 0, Qt.AlignRight)
430
+ self.hBoxLayout.addSpacing(16)
431
+
432
+ self.optionToText = {o: t for o, t in zip(configItem.options, texts)}
433
+ for text, option in zip(texts, configItem.options):
434
+ self.comboBox.addItem(text, userData=option)
435
+
436
+ self.comboBox.setCurrentText(self.optionToText[qconfig.get(configItem)])
437
+ self.comboBox.currentIndexChanged.connect(self._onCurrentIndexChanged)
438
+ configItem.valueChanged.connect(self.setValue)
439
+
440
+ def _onCurrentIndexChanged(self, index: int):
441
+
442
+ qconfig.set(self.configItem, self.comboBox.itemData(index))
443
+
444
+ def setValue(self, value):
445
+ if value not in self.optionToText:
446
+ return
447
+
448
+ self.comboBox.setCurrentText(self.optionToText[value])
449
+ qconfig.set(self.configItem, value)
@@ -0,0 +1,48 @@
1
+ # coding:utf-8
2
+ from typing import List
3
+
4
+ from PySide6.QtCore import Qt
5
+ from PySide6.QtWidgets import QWidget, QLabel, QVBoxLayout
6
+
7
+ from ...common.style_sheet import FluentStyleSheet
8
+ from ...common.font import setFont
9
+ from ..layout.expand_layout import ExpandLayout
10
+
11
+
12
+ class SettingCardGroup(QWidget):
13
+ """ Setting card group """
14
+
15
+ def __init__(self, title: str, parent=None):
16
+ super().__init__(parent=parent)
17
+ self.titleLabel = QLabel(title, self)
18
+ self.vBoxLayout = QVBoxLayout(self)
19
+ self.cardLayout = ExpandLayout()
20
+
21
+ self.vBoxLayout.setContentsMargins(0, 0, 0, 0)
22
+ self.vBoxLayout.setAlignment(Qt.AlignTop)
23
+ self.vBoxLayout.setSpacing(0)
24
+ self.cardLayout.setContentsMargins(0, 0, 0, 0)
25
+ self.cardLayout.setSpacing(2)
26
+
27
+ self.vBoxLayout.addWidget(self.titleLabel)
28
+ self.vBoxLayout.addSpacing(12)
29
+ self.vBoxLayout.addLayout(self.cardLayout, 1)
30
+
31
+ FluentStyleSheet.SETTING_CARD_GROUP.apply(self)
32
+ setFont(self.titleLabel, 20)
33
+ self.titleLabel.adjustSize()
34
+
35
+ def addSettingCard(self, card: QWidget):
36
+ """ add setting card to group """
37
+ card.setParent(self)
38
+ self.cardLayout.addWidget(card)
39
+ self.adjustSize()
40
+
41
+ def addSettingCards(self, cards: List[QWidget]):
42
+ """ add setting cards to group """
43
+ for card in cards:
44
+ self.addSettingCard(card)
45
+
46
+ def adjustSize(self):
47
+ h = self.cardLayout.heightForWidth(self.width()) + 46
48
+ return self.resize(self.width(), h)
@@ -0,0 +1,41 @@
1
+ from .button import (DropDownPushButton, DropDownToolButton, PrimaryPushButton, PushButton, RadioButton,
2
+ HyperlinkButton, ToolButton, TransparentToolButton, ToggleButton, SplitWidgetBase,
3
+ SplitPushButton, SplitToolButton, PrimaryToolButton, PrimarySplitPushButton,
4
+ PrimarySplitToolButton, PrimaryDropDownPushButton, PrimaryDropDownToolButton,
5
+ TogglePushButton, ToggleToolButton, TransparentPushButton, TransparentTogglePushButton,
6
+ TransparentToggleToolButton, TransparentDropDownPushButton, TransparentDropDownToolButton,
7
+ PillPushButton, PillToolButton)
8
+ from .card_widget import CardWidget, ElevatedCardWidget, SimpleCardWidget, HeaderCardWidget, CardGroupWidget, GroupHeaderCardWidget
9
+ from .check_box import CheckBox
10
+ from .combo_box import ComboBox, EditableComboBox
11
+ from .command_bar import CommandBar, CommandButton, CommandBarView
12
+ from .flip_view import FlipView, HorizontalFlipView, VerticalFlipView, FlipImageDelegate
13
+ from .line_edit import LineEdit, TextEdit, PlainTextEdit, LineEditButton, SearchLineEdit, PasswordLineEdit, TextBrowser
14
+ from .icon_widget import IconWidget
15
+ from .label import (PixmapLabel, CaptionLabel, StrongBodyLabel, BodyLabel, SubtitleLabel, TitleLabel,
16
+ LargeTitleLabel, DisplayLabel, FluentLabelBase, ImageLabel, AvatarWidget, HyperlinkLabel)
17
+ from .list_view import ListWidget, ListView, ListItemDelegate
18
+ from .menu import (DWMMenu, LineEditMenu, RoundMenu, MenuAnimationManager, MenuAnimationType, IndicatorMenuItemDelegate,
19
+ MenuItemDelegate, ShortcutMenuItemDelegate, CheckableMenu, MenuIndicatorType, SystemTrayMenu,
20
+ CheckableSystemTrayMenu)
21
+ from .info_bar import InfoBar, InfoBarIcon, InfoBarPosition, InfoBarManager
22
+ from .info_badge import InfoBadge, InfoLevel, DotInfoBadge, IconInfoBadge, InfoBadgePosition, InfoBadgeManager
23
+ from .scroll_area import SingleDirectionScrollArea, SmoothScrollArea, ScrollArea
24
+ from .slider import Slider, HollowHandleStyle, ClickableSlider
25
+ from .spin_box import (SpinBox, DoubleSpinBox, DateEdit, DateTimeEdit, TimeEdit, CompactSpinBox,
26
+ CompactDoubleSpinBox, CompactDateEdit, CompactDateTimeEdit, CompactTimeEdit)
27
+ from .stacked_widget import PopUpAniStackedWidget, OpacityAniStackedWidget
28
+ from .state_tool_tip import StateToolTip
29
+ from .switch_button import SwitchButton, IndicatorPosition
30
+ from .table_view import TableView, TableWidget, TableItemDelegate
31
+ from .tool_tip import ToolTip, ToolTipFilter, ToolTipPosition
32
+ from .tree_view import TreeWidget, TreeView, TreeItemDelegate
33
+ from .cycle_list_widget import CycleListWidget
34
+ from .progress_bar import IndeterminateProgressBar, ProgressBar
35
+ from .progress_ring import ProgressRing, IndeterminateProgressRing
36
+ from .scroll_bar import ScrollBar, SmoothScrollBar, SmoothScrollDelegate, ScrollBarHandleDisplayMode
37
+ from .teaching_tip import TeachingTip, TeachingTipTailPosition, TeachingTipView, PopupTeachingTip
38
+ from .flyout import FlyoutView, FlyoutViewBase, Flyout, FlyoutAnimationType, FlyoutAnimationManager
39
+ from .tab_view import TabBar, TabItem, TabCloseButtonDisplayMode
40
+ from .pips_pager import PipsPager, VerticalPipsPager, HorizontalPipsPager, PipsScrollButtonDisplayMode
41
+ from .separator import HorizontalSeparator, VerticalSeparator