当前位置: 首页>>代码示例>>Python>>正文


Python Qt.QDateTimeEdit类代码示例

本文整理汇总了Python中PyQt5.Qt.QDateTimeEdit的典型用法代码示例。如果您正苦于以下问题:Python QDateTimeEdit类的具体用法?Python QDateTimeEdit怎么用?Python QDateTimeEdit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QDateTimeEdit类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, parent, format):
     QDateTimeEdit.__init__(self, parent)
     self.setFrame(False)
     self.setMinimumDateTime(UNDEFINED_QDATETIME)
     self.setSpecialValueText(_('Undefined'))
     self.setCalendarPopup(True)
     self.setDisplayFormat(format)
开发者ID:AEliu,项目名称:calibre,代码行数:7,代码来源:delegates.py

示例2: __init__

 def __init__(self, parent, format_):
     QDateTimeEdit.__init__(self, parent)
     self.setFrame(False)
     self.setMinimumDateTime(UNDEFINED_QDATETIME)
     self.setSpecialValueText(_('Undefined'))
     self.setCalendarPopup(True)
     if format_ == 'iso':
         format_ = internal_iso_format_string()
     self.setDisplayFormat(format_)
开发者ID:JimmXinu,项目名称:calibre,代码行数:9,代码来源:delegates.py

示例3: __init__

 def __init__(self, parent=None):
     super(DownQDialog, self).__init__(parent)
     self.setWindowTitle(_('Request a Downtime'))
     self.setWindowFlags(Qt.FramelessWindowHint)
     self.setStyleSheet(settings.css_style)
     self.setWindowIcon(QIcon(settings.get_image('icon')))
     self.setMinimumSize(360, 460)
     self.setObjectName('dialog')
     # Fields
     self.fixed = True
     self.fixed_toggle_btn = ToggleQWidgetButton()
     self.duration = QTimeEdit()
     self.start_time = QDateTimeEdit()
     self.end_time = QDateTimeEdit()
     self.comment_edit = QTextEdit()
     self.offset = None
开发者ID:Alignak-monitoring-contrib,项目名称:alignak-app,代码行数:16,代码来源:actions.py

示例4: keyPressEvent

 def keyPressEvent(self, ev):
     if ev.key() == Qt.Key_Minus:
         ev.accept()
         self.setDateTime(self.minimumDateTime())
     elif ev.key() == Qt.Key_Equal:
         ev.accept()
         self.setDateTime(QDateTime.currentDateTime())
     else:
         return QDateTimeEdit.keyPressEvent(self, ev)
开发者ID:aimylios,项目名称:calibre,代码行数:9,代码来源:custom_column_widgets.py

示例5: keyPressEvent

 def keyPressEvent(self, ev):
     if ev.key() == Qt.Key_Minus:
         ev.accept()
         self.clear_date()
     elif ev.key() == Qt.Key_Equal:
         self.today_date()
         ev.accept()
     else:
         return QDateTimeEdit.keyPressEvent(self, ev)
开发者ID:JimmXinu,项目名称:calibre,代码行数:9,代码来源:delegates.py

示例6: keyPressEvent

 def keyPressEvent(self, ev):
     if ev.key() == Qt.Key_Minus:
         ev.accept()
         self.setDateTime(UNDEFINED_QDATETIME)
     elif ev.key() == Qt.Key_Equal:
         ev.accept()
         self.setDateTime(QDateTime.currentDateTime())
     else:
         return QDateTimeEdit.keyPressEvent(self, ev)
开发者ID:GaryMMugford,项目名称:calibre,代码行数:9,代码来源:delegates.py

示例7: focusOutEvent

 def focusOutEvent(self, x):
     self.setSpecialValueText(_('Undefined'))
     QDateTimeEdit.focusOutEvent(self, x)
开发者ID:aimylios,项目名称:calibre,代码行数:3,代码来源:custom_column_widgets.py

示例8: focusInEvent

 def focusInEvent(self, x):
     self.setSpecialValueText('')
     QDateTimeEdit.focusInEvent(self, x)
开发者ID:aimylios,项目名称:calibre,代码行数:3,代码来源:custom_column_widgets.py

示例9: DownQDialog

class DownQDialog(QDialog):
    """
        Class who create Downtime QDialog for hosts/services
    """

    def __init__(self, parent=None):
        super(DownQDialog, self).__init__(parent)
        self.setWindowTitle(_('Request a Downtime'))
        self.setWindowFlags(Qt.FramelessWindowHint)
        self.setStyleSheet(settings.css_style)
        self.setWindowIcon(QIcon(settings.get_image('icon')))
        self.setMinimumSize(360, 460)
        self.setObjectName('dialog')
        # Fields
        self.fixed = True
        self.fixed_toggle_btn = ToggleQWidgetButton()
        self.duration = QTimeEdit()
        self.start_time = QDateTimeEdit()
        self.end_time = QDateTimeEdit()
        self.comment_edit = QTextEdit()
        self.offset = None

    def initialize(self, item_type, item_name, comment):  # pylint: disable=too-many-locals
        """
        Initialize Downtime QDialog

        :param item_type: type of item to acknowledge : host | service
        :type item_type: str
        :param item_name: name of the item to acknowledge
        :type item_name: str
        :param comment: the default comment of action
        :type comment: str
        """

        logger.debug("Create Downtime QDialog...")

        # Main status_layout
        center_widget(self)
        main_layout = QVBoxLayout(self)
        main_layout.setContentsMargins(0, 0, 0, 0)

        main_layout.addWidget(get_logo_widget(self, _('Request Downtime')))

        downtime_widget = QWidget()
        downtime_widget.setObjectName('dialog')
        downtime_layout = QGridLayout(downtime_widget)

        downtime_title = QLabel(_('Request a downtime'))
        downtime_title.setObjectName('itemtitle')
        downtime_layout.addWidget(downtime_title, 0, 0, 1, 3)

        host_label = QLabel('<b>%s:</b> %s' % (item_type.capitalize(), item_name))
        downtime_layout.addWidget(host_label, 1, 0, 1, 1)

        options_label = QLabel(_('Downtime options:'))
        options_label.setObjectName('subtitle')
        downtime_layout.addWidget(options_label, 2, 0, 1, 1)

        self.fixed_toggle_btn.initialize()
        self.fixed_toggle_btn.update_btn_state(self.fixed)
        downtime_layout.addWidget(self.fixed_toggle_btn, 2, 1, 1, 1)

        fixed_label = QLabel(_('Fixed'))
        downtime_layout.addWidget(fixed_label, 2, 2, 1, 1)

        fixed_info = QLabel(
            _(
                'If checked, downtime will start and end at the times specified'
                ' by the “start time” and “end time” fields.'
            )
        )
        fixed_info.setWordWrap(True)
        downtime_layout.addWidget(fixed_info, 3, 0, 1, 3)

        duration_label = QLabel(_('Duration'))
        duration_label.setObjectName('subtitle')
        downtime_layout.addWidget(duration_label, 4, 0, 1, 1)

        duration_clock = QLabel()
        duration_clock.setPixmap(QPixmap(settings.get_image('time')))
        downtime_layout.addWidget(duration_clock, 4, 1, 1, 1)
        duration_clock.setFixedSize(16, 16)
        duration_clock.setScaledContents(True)

        self.duration.setTime(QTime(4, 00))
        self.duration.setDisplayFormat("HH'h'mm")
        downtime_layout.addWidget(self.duration, 4, 2, 1, 1)

        duration_info = QLabel(
            _('Sets the duration if it is a non-fixed downtime.')
        )
        downtime_layout.addWidget(duration_info, 5, 0, 1, 3)

        date_range_label = QLabel(_('Downtime date range'))
        date_range_label.setObjectName('subtitle')
        downtime_layout.addWidget(date_range_label, 6, 0, 1, 1)

        calendar_label = QLabel()
        calendar_label.setPixmap(QPixmap(settings.get_image('calendar')))
        calendar_label.setFixedSize(16, 16)
#.........这里部分代码省略.........
开发者ID:Alignak-monitoring-contrib,项目名称:alignak-app,代码行数:101,代码来源:actions.py

示例10: __init__

    def __init__(self, parent=None):
        super(HistoryWidget, self).__init__(parent)
        self.setObjectName("HistoryWidget")
        self.resize(800, 480)
        self.setWindowTitle("历史数据查看")

        # layout - top
        horiLayoutTop = QHBoxLayout()

        buttonQuit = QPushButton(self)
        buttonQuit.setObjectName("buttonQuit")
        horiLayoutTop.addSpacing(25)
        horiLayoutTop.addWidget(buttonQuit, 0, Qt.AlignLeft)
        horiLayoutTop.addStretch()

        # button-export
        buttonExport = QPushButton(self)
        buttonExport.setObjectName("buttonExport")
        horiLayoutTop.addWidget(buttonExport)
        horiLayoutTop.addStretch()

        # button-open
        buttonOpen = QPushButton(self)
        buttonOpen.setObjectName("buttonOpen")
        horiLayoutTop.addWidget(buttonOpen)
        horiLayoutTop.addStretch()

        formLayoutTime = QFormLayout()
        formLayoutTime.setFormAlignment(Qt.AlignVCenter)
        horiLayoutTop.addLayout(formLayoutTime)
        horiLayoutTop.addStretch()

        self.dateTimeEditStart = QDateTimeEdit(self)
        self.dateTimeEditStart.setObjectName("dateTimeEditStart")
        self.dateTimeEditStart.setDisplayFormat("yyyy-MM-dd HH:mm:ss")
        formLayoutTime.addRow("起始时间:", self.dateTimeEditStart)

        self.dateTimeEditEnd = QDateTimeEdit(self)
        self.dateTimeEditEnd.setObjectName("dateTimeEditEnd")
        self.dateTimeEditEnd.setDisplayFormat("yyyy-MM-dd HH:mm:ss")
        formLayoutTime.addRow("结束时间:", self.dateTimeEditEnd)

        # LBP
        formLayoutLBP = QFormLayout()
        formLayoutLBP.setFormAlignment(Qt.AlignVCenter)
        formLayoutLBP.setLabelAlignment(Qt.AlignRight)
        horiLayoutTop.addLayout(formLayoutLBP)
        horiLayoutTop.addStretch()
        self.checkBoxLBPMajor = QCheckBox("主", self)
        self.checkBoxLBPMajor.setProperty("curveColor", "#101010")
        self.checkBoxLBPMinor = QCheckBox("副", self)
        self.checkBoxLBPMinor.setProperty("curveColor", "#101010")
        formLayoutLBP.addRow("左刹车压力:", self.checkBoxLBPMajor)
        formLayoutLBP.addRow("", self.checkBoxLBPMinor)

        # RBP
        formLayoutRBP = QFormLayout()
        formLayoutRBP.setFormAlignment(Qt.AlignVCenter)
        formLayoutRBP.setLabelAlignment(Qt.AlignRight)
        horiLayoutTop.addLayout(formLayoutRBP)
        horiLayoutTop.addStretch()
        self.checkBoxRBPMajor = QCheckBox("主", self)
        self.checkBoxRBPMajor.setProperty("curveColor", "#101010")
        self.checkBoxRBPMinor = QCheckBox("副", self)
        self.checkBoxRBPMinor.setProperty("curveColor", "#101010")
        formLayoutRBP.addRow("右刹车压力:", self.checkBoxRBPMajor)
        formLayoutRBP.addRow("", self.checkBoxRBPMinor)

        # LRP
        formLayoutLRP = QFormLayout()
        formLayoutLRP.setFormAlignment(Qt.AlignVCenter)
        formLayoutLRP.setLabelAlignment(Qt.AlignRight)
        horiLayoutTop.addLayout(formLayoutLRP)
        horiLayoutTop.addStretch()
        self.checkBoxLRPTheory = QCheckBox("理论", self)
        self.checkBoxLRPTheory.setProperty("curveColor", "#101010")
        self.checkBoxLRPReal = QCheckBox("实际", self)
        self.checkBoxLRPReal.setProperty("curveColor", "#101010")
        formLayoutLRP.addRow("左转速:", self.checkBoxLRPTheory)
        formLayoutLRP.addRow("", self.checkBoxLRPReal)

        # RRP
        formLayoutRRP = QFormLayout()
        formLayoutRRP.setFormAlignment(Qt.AlignVCenter)
        formLayoutRRP.setLabelAlignment(Qt.AlignRight)
        horiLayoutTop.addLayout(formLayoutRRP)
        horiLayoutTop.addStretch()
        self.checkBoxRRPTheory = QCheckBox("理论", self)
        self.checkBoxRRPTheory.setProperty("curveColor", "#101010")
        self.checkBoxRRPReal = QCheckBox("实际", self)
        self.checkBoxRRPReal.setProperty("curveColor", "#101010")
        formLayoutRRP.addRow("右转速:", self.checkBoxRRPTheory)
        formLayoutRRP.addRow("", self.checkBoxRRPReal)

        # button-update
        buttonUpdate = QPushButton(self)
        buttonUpdate.setObjectName("buttonUpdate")
        horiLayoutTop.addWidget(buttonUpdate)
        horiLayoutTop.addStretch()

#.........这里部分代码省略.........
开发者ID:iclosure,项目名称:carmonitor,代码行数:101,代码来源:history_widget.py

示例11: HistoryWidget

class HistoryWidget(QDialog):
    """
    class HistonWidget
    """

    _v_curve_colors = [Qt.white, Qt.gray, Qt.red, Qt.green, Qt.blue, Qt.cyan, Qt.magenta, Qt.darkYellow]
    _v_curve_checked = [True, True, True, True, True, True, True, True]

    def __init__(self, parent=None):
        super(HistoryWidget, self).__init__(parent)
        self.setObjectName("HistoryWidget")
        self.resize(800, 480)
        self.setWindowTitle("历史数据查看")

        # layout - top
        horiLayoutTop = QHBoxLayout()

        buttonQuit = QPushButton(self)
        buttonQuit.setObjectName("buttonQuit")
        horiLayoutTop.addSpacing(25)
        horiLayoutTop.addWidget(buttonQuit, 0, Qt.AlignLeft)
        horiLayoutTop.addStretch()

        # button-export
        buttonExport = QPushButton(self)
        buttonExport.setObjectName("buttonExport")
        horiLayoutTop.addWidget(buttonExport)
        horiLayoutTop.addStretch()

        # button-open
        buttonOpen = QPushButton(self)
        buttonOpen.setObjectName("buttonOpen")
        horiLayoutTop.addWidget(buttonOpen)
        horiLayoutTop.addStretch()

        formLayoutTime = QFormLayout()
        formLayoutTime.setFormAlignment(Qt.AlignVCenter)
        horiLayoutTop.addLayout(formLayoutTime)
        horiLayoutTop.addStretch()

        self.dateTimeEditStart = QDateTimeEdit(self)
        self.dateTimeEditStart.setObjectName("dateTimeEditStart")
        self.dateTimeEditStart.setDisplayFormat("yyyy-MM-dd HH:mm:ss")
        formLayoutTime.addRow("起始时间:", self.dateTimeEditStart)

        self.dateTimeEditEnd = QDateTimeEdit(self)
        self.dateTimeEditEnd.setObjectName("dateTimeEditEnd")
        self.dateTimeEditEnd.setDisplayFormat("yyyy-MM-dd HH:mm:ss")
        formLayoutTime.addRow("结束时间:", self.dateTimeEditEnd)

        # LBP
        formLayoutLBP = QFormLayout()
        formLayoutLBP.setFormAlignment(Qt.AlignVCenter)
        formLayoutLBP.setLabelAlignment(Qt.AlignRight)
        horiLayoutTop.addLayout(formLayoutLBP)
        horiLayoutTop.addStretch()
        self.checkBoxLBPMajor = QCheckBox("主", self)
        self.checkBoxLBPMajor.setProperty("curveColor", "#101010")
        self.checkBoxLBPMinor = QCheckBox("副", self)
        self.checkBoxLBPMinor.setProperty("curveColor", "#101010")
        formLayoutLBP.addRow("左刹车压力:", self.checkBoxLBPMajor)
        formLayoutLBP.addRow("", self.checkBoxLBPMinor)

        # RBP
        formLayoutRBP = QFormLayout()
        formLayoutRBP.setFormAlignment(Qt.AlignVCenter)
        formLayoutRBP.setLabelAlignment(Qt.AlignRight)
        horiLayoutTop.addLayout(formLayoutRBP)
        horiLayoutTop.addStretch()
        self.checkBoxRBPMajor = QCheckBox("主", self)
        self.checkBoxRBPMajor.setProperty("curveColor", "#101010")
        self.checkBoxRBPMinor = QCheckBox("副", self)
        self.checkBoxRBPMinor.setProperty("curveColor", "#101010")
        formLayoutRBP.addRow("右刹车压力:", self.checkBoxRBPMajor)
        formLayoutRBP.addRow("", self.checkBoxRBPMinor)

        # LRP
        formLayoutLRP = QFormLayout()
        formLayoutLRP.setFormAlignment(Qt.AlignVCenter)
        formLayoutLRP.setLabelAlignment(Qt.AlignRight)
        horiLayoutTop.addLayout(formLayoutLRP)
        horiLayoutTop.addStretch()
        self.checkBoxLRPTheory = QCheckBox("理论", self)
        self.checkBoxLRPTheory.setProperty("curveColor", "#101010")
        self.checkBoxLRPReal = QCheckBox("实际", self)
        self.checkBoxLRPReal.setProperty("curveColor", "#101010")
        formLayoutLRP.addRow("左转速:", self.checkBoxLRPTheory)
        formLayoutLRP.addRow("", self.checkBoxLRPReal)

        # RRP
        formLayoutRRP = QFormLayout()
        formLayoutRRP.setFormAlignment(Qt.AlignVCenter)
        formLayoutRRP.setLabelAlignment(Qt.AlignRight)
        horiLayoutTop.addLayout(formLayoutRRP)
        horiLayoutTop.addStretch()
        self.checkBoxRRPTheory = QCheckBox("理论", self)
        self.checkBoxRRPTheory.setProperty("curveColor", "#101010")
        self.checkBoxRRPReal = QCheckBox("实际", self)
        self.checkBoxRRPReal.setProperty("curveColor", "#101010")
        formLayoutRRP.addRow("右转速:", self.checkBoxRRPTheory)
#.........这里部分代码省略.........
开发者ID:iclosure,项目名称:carmonitor,代码行数:101,代码来源:history_widget.py


注:本文中的PyQt5.Qt.QDateTimeEdit类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。