提交 ecb7bba1 编写于 作者: 之一Yo's avatar 之一Yo

添加 QtDesigner 插件

上级 7a313bf9
# coding: utf-8
from PyQt5.QtCore import Qt
from PyQt5.QtDesigner import QPyDesignerCustomWidgetPlugin
from qfluentwidgets import (PushButton, PrimaryPushButton, SplitPushButton, DropDownPushButton,
ToolButton, SplitToolButton, DropDownToolButton, FluentIcon, ToggleButton,
SwitchButton, RadioButton, CheckBox, HyperlinkButton, Slider, ComboBox, IconWidget)
from plugin_base import PluginBase
class BasicInputPlugin(PluginBase):
def group(self):
return super().group() + ' (Basic Input)'
class CheckBoxPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Check box plugin """
def createWidget(self, parent):
return CheckBox(self.toolTip(), parent)
def icon(self):
return super().icon('Checkbox')
def name(self):
return "CheckBox"
class ComboBoxPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Combo box plugin """
def createWidget(self, parent):
return ComboBox(parent)
def icon(self):
return super().icon('ComboBox')
def name(self):
return "ComboBox"
class HyperlinkButtonPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Hyperlink button plugin """
def createWidget(self, parent):
return HyperlinkButton('', self.toolTip(), parent)
def icon(self):
return super().icon('HyperlinkButton')
def name(self):
return "HyperlinkButton"
class PushButtonPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Push button plugin """
def createWidget(self, parent):
return PushButton(self.toolTip(), parent)
def icon(self):
return super().icon('Button')
def name(self):
return "PushButton"
class PrimaryPushButtonPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Primary push button plugin """
def createWidget(self, parent):
return PrimaryPushButton(self.toolTip(), parent)
def icon(self):
return super().icon('Button')
def name(self):
return "PrimaryPushButton"
class DropDownPushButtonPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Drop down push button plugin """
def createWidget(self, parent):
return DropDownPushButton(self.toolTip(), parent)
def icon(self):
return super().icon('DropDownButton')
def name(self):
return "DropDownPushButton"
class SplitPushButtonPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Split push button plugin """
def createWidget(self, parent):
return SplitPushButton(self.toolTip(), parent)
def icon(self):
return super().icon('SplitButton')
def name(self):
return "SplitPushButton"
class ToolButtonPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Tool button plugin """
def createWidget(self, parent):
return ToolButton(FluentIcon.BASKETBALL, parent)
def icon(self):
return super().icon('Button')
def name(self):
return "ToolButton"
class DropDownToolButtonPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Drop down tool button plugin """
def createWidget(self, parent):
return DropDownToolButton(FluentIcon.BASKETBALL, parent)
def icon(self):
return super().icon('DropDownButton')
def name(self):
return "DropDownToolButton"
class SplitToolButtonPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" split tool button plugin """
def createWidget(self, parent):
return SplitToolButton(FluentIcon.BASKETBALL, parent)
def icon(self):
return super().icon('SplitButton')
def name(self):
return "SplitToolButton"
class SwitchButtonPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Switch button plugin """
def createWidget(self, parent):
return SwitchButton(parent)
def icon(self):
return super().icon('ToggleSwitch')
def name(self):
return "SwitchButton"
class RadioButtonPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Radio button plugin """
def createWidget(self, parent):
return RadioButton(self.toolTip(), parent)
def icon(self):
return super().icon('RadioButton')
def name(self):
return "RadioButton"
class ToggleButtonPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Toggle button plugin """
def createWidget(self, parent):
return ToggleButton(self.toolTip(), parent)
def icon(self):
return super().icon('ToggleButton')
def name(self):
return "ToggleButton"
class SliderPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Slider plugin """
def createWidget(self, parent):
slider = Slider(parent)
slider.setRange(0, 100)
slider.setMinimumWidth(200)
return slider
def icon(self):
return super().icon('Slider')
def name(self):
return "Slider"
class IconWidgetPlugin(BasicInputPlugin, QPyDesignerCustomWidgetPlugin):
""" Icon widget plugin """
def createWidget(self, parent):
return IconWidget(FluentIcon.EMOJI_TAB_SYMBOLS, parent)
def icon(self):
return super().icon('IconElement')
def name(self):
return "IconWidget"
# coding: utf-8
from PyQt5.QtCore import Qt
from PyQt5.QtDesigner import QPyDesignerCustomWidgetPlugin
from qfluentwidgets import DatePicker, TimePicker, ZhDatePicker, AMTimePicker
from plugin_base import PluginBase
class DateTimePlugin(PluginBase):
def group(self):
return super().group() + ' (Date Time)'
class DatePickerPlugin(DateTimePlugin, QPyDesignerCustomWidgetPlugin):
""" Date picker plugin """
def createWidget(self, parent):
return DatePicker(parent)
def icon(self):
return super().icon("DatePicker")
def name(self):
return "DatePicker"
class ZhDatePickerPlugin(DateTimePlugin, QPyDesignerCustomWidgetPlugin):
""" Chinese Date picker plugin """
def createWidget(self, parent):
return ZhDatePicker(parent)
def icon(self):
return super().icon("DatePicker")
def name(self):
return "ZhDatePicker"
def toolTip(self):
return "Chinese date picker"
class TimePickerPlugin(DateTimePlugin, QPyDesignerCustomWidgetPlugin):
""" Time picker plugin """
def createWidget(self, parent):
return TimePicker(parent)
def icon(self):
return super().icon("TimePicker")
def name(self):
return "TimePicker"
def toolTip(self):
return "24 hours time picker"
class AMTimePickerPlugin(DateTimePlugin, QPyDesignerCustomWidgetPlugin):
""" AM/PM time picker plugin """
def createWidget(self, parent):
return AMTimePicker(parent)
def icon(self):
return super().icon("TimePicker")
def name(self):
return "AMTimePicker"
def toolTip(self):
return "AM/PM time picker"
# coding:utf-8
import re
from PyQt5.QtGui import QIcon
class PluginBase:
def __init__(self, parent=None):
super().__init__(parent)
self.initialized = False
self.pattern = re.compile(r'(?<!^)(?=[A-Z])')
def initialize(self, core):
if self.initialized:
return
self.initialized = True
def isInitialized(self):
return self.initialized
def icon(self, name: str):
return QIcon(f":/qfluentwidgets/images/controls/{name}.png")
def name(self):
return "PluginBase"
def group(self):
return "PyQt-Fluent-Widgets"
def toolTip(self):
name = self.pattern.sub(' ', self.name()).lower()
return name[0].upper() + name[1:]
def whatsThis(self):
return self.toolTip()
def isContainer(self):
return False
def domXml(self):
return f'<widget class="{self.name()}" name="{self.name()}"></widget>'
def includeFile(self):
return "qfluentwidgets"
# coding: utf-8
from PyQt5.QtCore import Qt
from PyQt5.QtDesigner import QPyDesignerCustomWidgetPlugin
from qfluentwidgets import InfoBar, ProgressBar, IndeterminateProgressBar, ProgressRing, StateToolTip, InfoBarPosition
from plugin_base import PluginBase
class StatusInfoPlugin(PluginBase):
def group(self):
return super().group() + ' (Status & Info)'
class InfoBarPlugin(StatusInfoPlugin, QPyDesignerCustomWidgetPlugin):
""" Info bar plugin """
def createWidget(self, parent):
return InfoBar.success(
title='Lesson 5',
content='最短的捷径就是绕远路,绕远路才是我的最短捷径。',
duration=-1,
position=InfoBarPosition.NONE,
parent=parent
)
def icon(self):
return super().icon("InfoBar")
def name(self):
return "InfoBar"
class ProgressBarTipPlugin(StatusInfoPlugin, QPyDesignerCustomWidgetPlugin):
""" Progress bar plugin """
def createWidget(self, parent):
return ProgressBar(parent)
def icon(self):
return super().icon("ProgressBar")
def name(self):
return "ProgressBar"
class IndeterminateProgressBarTipPlugin(StatusInfoPlugin, QPyDesignerCustomWidgetPlugin):
""" Indeterminate progress bar plugin """
def createWidget(self, parent):
return IndeterminateProgressBar(parent)
def icon(self):
return super().icon("ProgressBar")
def name(self):
return "IndeterminateProgressBar"
class ProgressRingTipPlugin(StatusInfoPlugin, QPyDesignerCustomWidgetPlugin):
""" Progress ring plugin """
def createWidget(self, parent):
return ProgressRing(parent)
def icon(self):
return super().icon("ProgressRing")
def name(self):
return "ProgressRing"
class StateToolTipPlugin(StatusInfoPlugin, QPyDesignerCustomWidgetPlugin):
""" State tool tip plugin """
def createWidget(self, parent):
return StateToolTip('Running', 'Please wait patiently', parent)
def icon(self):
return super().icon("ProgressRing")
def name(self):
return "StateToolTip"
# coding: utf-8
from PyQt5.QtCore import Qt
from PyQt5.QtDesigner import QPyDesignerCustomWidgetPlugin
from qfluentwidgets import SpinBox, DoubleSpinBox, TextEdit, TimeEdit, DateTimeEdit, LineEdit, PlainTextEdit, DateEdit
from plugin_base import PluginBase
class TextPlugin(PluginBase):
def group(self):
return super().group() + ' (Text)'
class LineEditPlugin(TextPlugin, QPyDesignerCustomWidgetPlugin):
""" Line edit plugin """
def createWidget(self, parent):
return LineEdit(parent)
def icon(self):
return super().icon("TextBox")
def name(self):
return "LineEdit"
class TextEditPlugin(TextPlugin, QPyDesignerCustomWidgetPlugin):
""" Text edit plugin """
def createWidget(self, parent):
return TextEdit(parent)
def icon(self):
return super().icon("RichEditBox")
def name(self):
return "TextEdit"
class PlainTextEditPlugin(TextPlugin, QPyDesignerCustomWidgetPlugin):
""" Plain text edit plugin """
def createWidget(self, parent):
return PlainTextEdit(parent)
def icon(self):
return super().icon("RichEditBox")
def name(self):
return "PlainTextEdit"
class DateEditPlugin(TextPlugin, QPyDesignerCustomWidgetPlugin):
""" Date edit plugin """
def createWidget(self, parent):
return DateEdit(parent)
def icon(self):
return super().icon("NumberBox")
def name(self):
return "DateEdit"
class TimeEditPlugin(TextPlugin, QPyDesignerCustomWidgetPlugin):
""" Time edit plugin """
def createWidget(self, parent):
return TimeEdit(parent)
def icon(self):
return super().icon("NumberBox")
def name(self):
return "TimeEdit"
class DateTimeEditPlugin(TextPlugin, QPyDesignerCustomWidgetPlugin):
""" Date time edit plugin """
def createWidget(self, parent):
return DateTimeEdit(parent)
def icon(self):
return super().icon("NumberBox")
def name(self):
return "DateTimeEdit"
class SpinBoxPlugin(TextPlugin, QPyDesignerCustomWidgetPlugin):
""" Spin box plugin """
def createWidget(self, parent):
return SpinBox(parent)
def icon(self):
return super().icon("NumberBox")
def name(self):
return "SpinBox"
class DoubleSpinBoxPlugin(TextPlugin, QPyDesignerCustomWidgetPlugin):
""" Double spin box plugin """
def createWidget(self, parent):
return DoubleSpinBox(parent)
def icon(self):
return super().icon("NumberBox")
def name(self):
return "DoubleSpinBox"
# coding: utf-8
from PyQt5.QtCore import Qt
from PyQt5.QtDesigner import QPyDesignerCustomWidgetPlugin
from qfluentwidgets import ListWidget, ListView, TreeView, TreeWidget, TableView, TableWidget
from plugin_base import PluginBase
class ViewPlugin(PluginBase):
def group(self):
return super().group() + ' (View)'
class ListWidgetPlugin(ViewPlugin, QPyDesignerCustomWidgetPlugin):
""" List widget plugin """
def createWidget(self, parent):
return ListWidget(parent)
def icon(self):
return super().icon("ListView")
def name(self):
return "ListWidget"
class ListViewPlugin(ViewPlugin, QPyDesignerCustomWidgetPlugin):
""" List view plugin """
def createWidget(self, parent):
return ListView(parent)
def icon(self):
return super().icon("ListView")
def name(self):
return "ListView"
class TableWidgetPlugin(ViewPlugin, QPyDesignerCustomWidgetPlugin):
""" Table widget plugin """
def createWidget(self, parent):
return TableWidget(parent)
def icon(self):
return super().icon("DataGrid")
def name(self):
return "TableWidget"
class TableViewPlugin(ViewPlugin, QPyDesignerCustomWidgetPlugin):
""" Table widget plugin """
def createWidget(self, parent):
return TableView(parent)
def icon(self):
return super().icon("DataGrid")
def name(self):
return "TableView"
class TreeWidgetPlugin(ViewPlugin, QPyDesignerCustomWidgetPlugin):
""" Tree widget plugin """
def createWidget(self, parent):
return TreeWidget(parent)
def icon(self):
return super().icon("TreeView")
def name(self):
return "TreeWidget"
class TreeViewPlugin(ViewPlugin, QPyDesignerCustomWidgetPlugin):
""" Tree view plugin """
def createWidget(self, parent):
return TreeView(parent)
def icon(self):
return super().icon("TreeView")
def name(self):
return "TreeView"
<?xml version="1.0" encoding="utf-8"?>
<svg id="" width="16" height="16" style="width:16px;height:16px;" version="1.1"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2048 2048" enable-background="new 0 0 2048 2048"
xml:space="preserve"><path fill="#000000" d="M1920 1287 l0 -135 l128 0 l0 384 l-384 0 l0 -128 l192 0 q-45 -60 -113 -94 q-68 -34 -143 -34 q-51 0 -98 15.5 q-47 15.5 -87 43.5 q-40 28 -70 67 q-30 39 -47 87 l-120 -42 q24 -67 66 -122 q42 -55 97.5 -94.5 q55.5 -39.5 121.5 -61 q66 -21.5 137 -21.5 q91 0 174 34.5 q83 34.5 146 100.5 ZM448 0 q93 0 174.5 35 q81.5 35 142.5 96 q61 61 96 142.5 q35 81.5 35 174.5 q0 93 -35 174.5 q-35 81.5 -96 142.5 q-61 61 -142.5 96 q-81.5 35 -174.5 35 q-93 0 -174.5 -35 q-81.5 -35 -142.5 -96 q-61 -61 -96 -142.5 q-35 -81.5 -35 -174.5 q0 -93 35 -174.5 q35 -81.5 96 -142.5 q61 -61 142.5 -96 q81.5 -35 174.5 -35 ZM128 448 q0 66 25 124.5 q25 58.5 68.5 102 q43.5 43.5 102 68.5 q58.5 25 124.5 25 q47 0 92 -13.5 q45 -13.5 84 -39.5 l-443 -443 q-26 39 -39.5 84 q-13.5 45 -13.5 92 ZM272 181 l443 443 q26 -39 39.5 -84 q13.5 -45 13.5 -92 q0 -66 -25.5 -124 q-25.5 -58 -69 -101.5 q-43.5 -43.5 -101.5 -69 q-58 -25.5 -124 -25.5 q-47 0 -92 13.5 q-45 13.5 -84 39.5 ZM1600 1920 q51 0 98 -15.5 q47 -15.5 86.5 -43.5 q39.5 -28 70 -67 q30.5 -39 47.5 -87 l120 42 q-24 67 -66 122 q-42 55 -97.5 94.5 q-55.5 39.5 -121.5 61 q-66 21.5 -137 21.5 q-91 0 -174 -34.5 q-83 -34.5 -146 -100.5 l0 135 l-128 0 l0 -384 l384 0 l0 128 l-192 0 q45 60 113 94 q68 34 143 34 ZM1600 890 l-370 -369 q-38 -38 -58 -86.5 q-20 -48.5 -20 -102.5 q0 -55 21 -104 q21 -49 57 -85.5 q36 -36.5 84.5 -57.5 q48.5 -21 104.5 -21 q51 0 97.5 18 q46.5 18 83.5 52 q37 -34 83.5 -52 q46.5 -18 97.5 -18 q55 0 104 21 q49 21 85 57.5 q36 36.5 57 85.5 q21 49 21 104 q0 54 -20 102.5 q-20 48.5 -58 86.5 l-370 369 ZM1420 192 q-29 0 -54.5 11 q-25.5 11 -44.5 30 q-19 19 -30 44.5 q-11 25.5 -11 54.5 q0 28 10.5 53 q10.5 25 30.5 45 l279 279 l279 -279 q41 -41 41 -98 q0 -29 -11 -54.5 q-11 -25.5 -30 -44.5 q-19 -19 -44.5 -30 q-25.5 -11 -54.5 -11 q-29 0 -53.5 10.5 q-24.5 10.5 -44.5 30.5 l-82 82 l-82 -82 q-20 -20 -45 -30.5 q-25 -10.5 -53 -10.5 ZM384 1152 l128 0 l0 384 l384 0 l0 128 l-384 0 l0 384 l-128 0 l0 -384 l-384 0 l0 -128 l384 0 l0 -384 Z"/></svg>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<svg id="" width="16" height="16" style="width:16px;height:16px;" version="1.1"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2048 2048" enable-background="new 0 0 2048 2048"
xml:space="preserve"><path fill="#ffffff" d="M1920 1287 l0 -135 l128 0 l0 384 l-384 0 l0 -128 l192 0 q-45 -60 -113 -94 q-68 -34 -143 -34 q-51 0 -98 15.5 q-47 15.5 -87 43.5 q-40 28 -70 67 q-30 39 -47 87 l-120 -42 q24 -67 66 -122 q42 -55 97.5 -94.5 q55.5 -39.5 121.5 -61 q66 -21.5 137 -21.5 q91 0 174 34.5 q83 34.5 146 100.5 ZM448 0 q93 0 174.5 35 q81.5 35 142.5 96 q61 61 96 142.5 q35 81.5 35 174.5 q0 93 -35 174.5 q-35 81.5 -96 142.5 q-61 61 -142.5 96 q-81.5 35 -174.5 35 q-93 0 -174.5 -35 q-81.5 -35 -142.5 -96 q-61 -61 -96 -142.5 q-35 -81.5 -35 -174.5 q0 -93 35 -174.5 q35 -81.5 96 -142.5 q61 -61 142.5 -96 q81.5 -35 174.5 -35 ZM128 448 q0 66 25 124.5 q25 58.5 68.5 102 q43.5 43.5 102 68.5 q58.5 25 124.5 25 q47 0 92 -13.5 q45 -13.5 84 -39.5 l-443 -443 q-26 39 -39.5 84 q-13.5 45 -13.5 92 ZM272 181 l443 443 q26 -39 39.5 -84 q13.5 -45 13.5 -92 q0 -66 -25.5 -124 q-25.5 -58 -69 -101.5 q-43.5 -43.5 -101.5 -69 q-58 -25.5 -124 -25.5 q-47 0 -92 13.5 q-45 13.5 -84 39.5 ZM1600 1920 q51 0 98 -15.5 q47 -15.5 86.5 -43.5 q39.5 -28 70 -67 q30.5 -39 47.5 -87 l120 42 q-24 67 -66 122 q-42 55 -97.5 94.5 q-55.5 39.5 -121.5 61 q-66 21.5 -137 21.5 q-91 0 -174 -34.5 q-83 -34.5 -146 -100.5 l0 135 l-128 0 l0 -384 l384 0 l0 128 l-192 0 q45 60 113 94 q68 34 143 34 ZM1600 890 l-370 -369 q-38 -38 -58 -86.5 q-20 -48.5 -20 -102.5 q0 -55 21 -104 q21 -49 57 -85.5 q36 -36.5 84.5 -57.5 q48.5 -21 104.5 -21 q51 0 97.5 18 q46.5 18 83.5 52 q37 -34 83.5 -52 q46.5 -18 97.5 -18 q55 0 104 21 q49 21 85 57.5 q36 36.5 57 85.5 q21 49 21 104 q0 54 -20 102.5 q-20 48.5 -58 86.5 l-370 369 ZM1420 192 q-29 0 -54.5 11 q-25.5 11 -44.5 30 q-19 19 -30 44.5 q-11 25.5 -11 54.5 q0 28 10.5 53 q10.5 25 30.5 45 l279 279 l279 -279 q41 -41 41 -98 q0 -29 -11 -54.5 q-11 -25.5 -30 -44.5 q-19 -19 -44.5 -30 q-25.5 -11 -54.5 -11 q-29 0 -53.5 10.5 q-24.5 10.5 -44.5 30.5 l-82 82 l-82 -82 q-20 -20 -45 -30.5 q-25 -10.5 -53 -10.5 ZM384 1152 l128 0 l0 384 l384 0 l0 128 l-384 0 l0 384 l-128 0 l0 -384 l-384 0 l0 -128 l384 0 l0 -384 Z"/></svg>
\ No newline at end of file
此差异已折叠。
......@@ -3,6 +3,7 @@
<file>images/color_dialog/Clear_black.svg</file>
<file>images/color_dialog/Clear_white.svg</file>
<file>images/color_dialog/HuePanel.png</file>
<file>images/icons/Cancel_black.svg</file>
<file>images/icons/Cancel_white.svg</file>
<file>images/icons/ChevronRight_black.svg</file>
......@@ -173,6 +174,9 @@
<file>images/icons/CareLeftSolid_white.svg</file>
<file>images/icons/CareRightSolid_black.svg</file>
<file>images/icons/CareRightSolid_white.svg</file>
<file>images/icons/EmojiTabSymbols_black.svg</file>
<file>images/icons/EmojiTabSymbols_white.svg</file>
<file>images/acrylic/noise.png</file>
<file>images/folder_list_dialog/Close_white.png</file>
<file>images/folder_list_dialog/Close_black.png</file>
......@@ -255,5 +259,76 @@
<file>i18n/qfluentwidgets.zh_HK.qm</file>
<file>i18n/qfluentwidgets.zh_TW.qm</file>
<file>i18n/qfluentwidgets.en_US.qm</file>
<file>images/controls/Acrylic.png</file>
<file>images/controls/AnimatedIcon.png</file>
<file>images/controls/AppBarButton.png</file>
<file>images/controls/AppBarSeparator.png</file>
<file>images/controls/AppBarToggleButton.png</file>
<file>images/controls/AutoSuggestBox.png</file>
<file>images/controls/BreadcrumbBar.png</file>
<file>images/controls/Button.png</file>
<file>images/controls/CalendarDatePicker.png</file>
<file>images/controls/CalendarView.png</file>
<file>images/controls/Canvas.png</file>
<file>images/controls/Checkbox.png</file>
<file>images/controls/Clipboard.png</file>
<file>images/controls/ColorPaletteResources.png</file>
<file>images/controls/ColorPicker.png</file>
<file>images/controls/ComboBox.png</file>
<file>images/controls/CommandBar.png</file>
<file>images/controls/CommandBarFlyout.png</file>
<file>images/controls/ConnectedAnimation.png</file>
<file>images/controls/ContentDialog.png</file>
<file>images/controls/DataGrid.png</file>
<file>images/controls/DatePicker.png</file>
<file>images/controls/DropDownButton.png</file>
<file>images/controls/EasingFunction.png</file>
<file>images/controls/Expander.png</file>
<file>images/controls/FlipView.png</file>
<file>images/controls/Flyout.png</file>
<file>images/controls/Grid.png</file>
<file>images/controls/GridView.png</file>
<file>images/controls/HyperlinkButton.png</file>
<file>images/controls/IconElement.png</file>
<file>images/controls/Image.png</file>
<file>images/controls/InfoBadge.png</file>
<file>images/controls/InfoBar.png</file>
<file>images/controls/ListBox.png</file>
<file>images/controls/ListView.png</file>
<file>images/controls/MediaPlayerElement.png</file>
<file>images/controls/MenuBar.png</file>
<file>images/controls/MenuFlyout.png</file>
<file>images/controls/NavigationView.png</file>
<file>images/controls/NumberBox.png</file>
<file>images/controls/PasswordBox.png</file>
<file>images/controls/PersonPicture.png</file>
<file>images/controls/PipsPager.png</file>
<file>images/controls/Pivot.png</file>
<file>images/controls/ProgressBar.png</file>
<file>images/controls/ProgressRing.png</file>
<file>images/controls/RadioButton.png</file>
<file>images/controls/RadioButtons.png</file>
<file>images/controls/RatingControl.png</file>
<file>images/controls/RelativePanel.png</file>
<file>images/controls/RepeatButton.png</file>
<file>images/controls/RichEditBox.png</file>
<file>images/controls/RichTextBlock.png</file>
<file>images/controls/ScrollViewer.png</file>
<file>images/controls/Slider.png</file>
<file>images/controls/SplitButton.png</file>
<file>images/controls/StackPanel.png</file>
<file>images/controls/TabView.png</file>
<file>images/controls/TeachingTip.png</file>
<file>images/controls/TextBlock.png</file>
<file>images/controls/TextBox.png</file>
<file>images/controls/TimePicker.png</file>
<file>images/controls/ToggleButton.png</file>
<file>images/controls/ToggleSplitButton.png</file>
<file>images/controls/ToggleSwitch.png</file>
<file>images/controls/ToolTip.png</file>
<file>images/controls/TreeView.png</file>
<file>images/controls/VariableSizedWrapGrid.png</file>
<file>images/controls/Viewbox.png</file>
</qresource>
</RCC>
\ No newline at end of file
......@@ -289,6 +289,7 @@ class FluentIcon(FluentIconBase, Enum):
CARE_LEFT_SOLID = "CareLeftSolid"
BACKGROUND_FILL = "BackgroundColor"
CARE_RIGHT_SOLID = "CareRightSolid"
EMOJI_TAB_SYMBOLS = "EmojiTabSymbols"
def path(self, theme=Theme.AUTO):
return f':/qfluentwidgets/images/icons/{self.value}_{getIconColor(theme)}.svg'
......
# coding:utf-8
from typing import Union
from PyQt5.QtCore import pyqtSignal, QUrl, Qt, QRectF, QSize, QPoint
from PyQt5.QtCore import pyqtSignal, QUrl, Qt, QRectF, QSize, QPoint, pyqtProperty
from PyQt5.QtGui import QDesktopServices, QIcon, QPainter
from PyQt5.QtWidgets import QHBoxLayout, QPushButton, QRadioButton, QToolButton, QApplication, QWidget, QSizePolicy
......@@ -127,10 +127,10 @@ class HyperlinkButton(QPushButton):
@singledispatchmethod
def __init__(self, parent: QWidget = None):
super().__init__(parent)
self.url = QUrl()
self._url = QUrl()
FluentStyleSheet.BUTTON.apply(self)
self.setCursor(Qt.PointingHandCursor)
self.clicked.connect(lambda i: QDesktopServices.openUrl(self.url))
self.clicked.connect(lambda i: QDesktopServices.openUrl(self.getUrl()))
@__init__.register
def _(self, url: str, text: str, parent: QWidget = None):
......@@ -138,8 +138,13 @@ class HyperlinkButton(QPushButton):
self.setText(text)
self.url.setUrl(url)
def getUrl(self):
return self._url
def setUrl(self, url: str):
self.url.setUrl(url)
self._url.setUrl(url)
url = pyqtProperty(QUrl, getUrl, setUrl)
class RadioButton(QRadioButton):
......
# coding: utf-8
from distutils.sysconfig import get_python_lib
import os
import sys
from pathlib import Path
import PyQt5
from PyQt5.QtCore import QProcessEnvironment, QProcess, QLibraryInfo
def get_designer_path():
""" get the path of qt designer """
site_packages = get_python_lib()
ext = '.exe' if os.name == 'nt' else ''
bins = [
f"{QLibraryInfo.location(QLibraryInfo.BinariesPath)}/designer{ext}",
f"{site_packages}/pyqt5_tools/designer{ext}",
f"{site_packages}/qt5_applications/Qt/bin/designer{ext}",
]
for f in bins:
if os.path.exists(f):
return f
raise Exception("Can't find avalibale QtDesigner")
tools_dir = Path(__file__).absolute().parent
project_dir = tools_dir.parent
# set up environment variables
env = QProcessEnvironment.systemEnvironment()
PATH = f"{os.path.dirname(PyQt5.__file__)};{sys.prefix};{env.value('PATH', '')}"
env.insert('PATH', PATH)
env.insert('PYQTDESIGNERPATH', str(project_dir / 'plugins'))
env.insert('PYTHONPATH', str(project_dir))
# launch QtDesigner
designer = QProcess()
designer.setProcessEnvironment(env)
designer.start(get_designer_path())
designer.waitForFinished(-1)
sys.exit(designer.exitCode())
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册