date_time_plugin.py 2.0 KB
Newer Older
之一Yo's avatar
之一Yo 已提交
1 2 3 4
# coding: utf-8
from PyQt5.QtCore import Qt
from PyQt5.QtDesigner import QPyDesignerCustomWidgetPlugin

之一Yo's avatar
之一Yo 已提交
5
from qfluentwidgets import DatePicker, TimePicker, ZhDatePicker, AMTimePicker, CalendarPicker
之一Yo's avatar
之一Yo 已提交
6 7 8 9 10 11 12 13 14 15

from plugin_base import PluginBase


class DateTimePlugin(PluginBase):

    def group(self):
        return super().group() + ' (Date Time)'


之一Yo's avatar
之一Yo 已提交
16 17 18 19 20 21 22 23 24 25 26 27 28
class CalendarPickerPlugin(DateTimePlugin, QPyDesignerCustomWidgetPlugin):
    """ Calendar picker plugin """

    def createWidget(self, parent):
        return CalendarPicker(parent)

    def icon(self):
        return super().icon("CalendarDatePicker")

    def name(self):
        return "CalendarPicker"


之一Yo's avatar
之一Yo 已提交
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
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"