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


Python QtCore.QTime方法代码示例

本文整理汇总了Python中PyQt5.QtCore.QTime方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QTime方法的具体用法?Python QtCore.QTime怎么用?Python QtCore.QTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtCore的用法示例。


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

示例1: populate_from_profile

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def populate_from_profile(self):
        profile = self.profile()
        self.schedulerRadioMapping[profile.schedule_mode].setChecked(True)

        self.scheduleIntervalHours.setValue(profile.schedule_interval_hours)
        self.scheduleIntervalMinutes.setValue(profile.schedule_interval_minutes)
        self.scheduleFixedTime.setTime(
            QtCore.QTime(profile.schedule_fixed_hour, profile.schedule_fixed_minute)
        )

        # Set checking options
        self.validationCheckBox.setCheckState(profile.validation_on)
        self.validationSpinBox.setValue(profile.validation_weeks)

        self.pruneCheckBox.setCheckState(profile.prune_on)
        self.validationCheckBox.setTristate(False)
        self.pruneCheckBox.setTristate(False)

        self._draw_next_scheduled_backup()
        self.init_wifi() 
开发者ID:Mebus,项目名称:restatic,代码行数:22,代码来源:schedule_tab.py

示例2: test_schedule_tab

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def test_schedule_tab(app, qtbot):
    main = app.main_window
    tab = main.scheduleTab
    qtbot.mouseClick(tab.scheduleApplyButton, QtCore.Qt.LeftButton)
    assert tab.nextBackupDateTimeLabel.text() == "None scheduled"

    tab.scheduleIntervalRadio.setChecked(True)
    tab.scheduleIntervalHours.setValue(5)
    tab.scheduleIntervalMinutes.setValue(10)
    qtbot.mouseClick(tab.scheduleApplyButton, QtCore.Qt.LeftButton)
    assert tab.nextBackupDateTimeLabel.text().startswith("20")

    tab.scheduleOffRadio.setChecked(True)
    qtbot.mouseClick(tab.scheduleApplyButton, QtCore.Qt.LeftButton)
    assert tab.nextBackupDateTimeLabel.text() == "None scheduled"

    tab.scheduleFixedRadio.setChecked(True)
    tab.scheduleFixedTime.setTime(QtCore.QTime(23, 59))
    qtbot.mouseClick(tab.scheduleApplyButton, QtCore.Qt.LeftButton)
    next_backup = dt.combine(date.today(), time(23, 59))
    assert tab.nextBackupDateTimeLabel.text() == next_backup.strftime("%Y-%m-%d %H:%M") 
开发者ID:Mebus,项目名称:restatic,代码行数:23,代码来源:test_schedule.py

示例3: test_schedule_tab

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def test_schedule_tab(qapp, qtbot):
    main = qapp.main_window
    tab = main.scheduleTab
    qtbot.mouseClick(tab.scheduleApplyButton, QtCore.Qt.LeftButton)
    assert tab.nextBackupDateTimeLabel.text() == 'None scheduled'

    tab.scheduleIntervalRadio.setChecked(True)
    tab.scheduleIntervalHours.setValue(5)
    tab.scheduleIntervalMinutes.setValue(10)
    qtbot.mouseClick(tab.scheduleApplyButton, QtCore.Qt.LeftButton)
    assert tab.nextBackupDateTimeLabel.text().startswith('20')

    tab.scheduleOffRadio.setChecked(True)
    qtbot.mouseClick(tab.scheduleApplyButton, QtCore.Qt.LeftButton)
    assert tab.nextBackupDateTimeLabel.text() == 'None scheduled'

    tab.scheduleFixedRadio.setChecked(True)
    tab.scheduleFixedTime.setTime(QtCore.QTime(23, 59))
    qtbot.mouseClick(tab.scheduleApplyButton, QtCore.Qt.LeftButton)
    next_backup = dt.combine(date.today(), time(23, 59))
    assert tab.nextBackupDateTimeLabel.text() == next_backup.strftime('%Y-%m-%d %H:%M') 
开发者ID:borgbase,项目名称:vorta,代码行数:23,代码来源:test_schedule.py

示例4: save_event

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def save_event(self):
        event = {
            'category': self.event_category.currentText(),
            'time': (
                None
                if self.allday_check.isChecked()
                else self.event_time.time()
                ),
            'title': self.event_title.text(),
            'detail': self.event_detail.toPlainText()
            }

        date = self.calendar.selectedDate()
        event_list = self.events.get(date, [])
        event_number = self.event_list.currentRow()

        # if no events are selected, this is a new event
        if event_number == -1:
            event_list.append(event)
        else:
            event_list[event_number] = event

        event_list.sort(key=lambda x: x['time'] or qtc.QTime(0, 0))
        self.events[date] = event_list
        self.populate_list() 
开发者ID:PacktPublishing,项目名称:Mastering-GUI-Programming-with-Python,代码行数:27,代码来源:calendar_app.py

示例5: conv2fahrenheit

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def conv2fahrenheit(self):
        try:
            self.svValue = fromCtoF(self.svValue)
            self.svSliderMin = fromCtoF(self.svSliderMin)
            self.svSliderMax = fromCtoF(self.svSliderMax)
            # establish ne limits on sliders
            self.aw.sliderSV.setMinimum(self.svSliderMin)
            self.aw.sliderSV.setMaximum(self.svSliderMax)
            self.pidKp = self.pidKp / (9/5.)
            self.pidKi = self.pidKi / (9/5.)
            self.pidKd = self.pidKd / (9/5.)
            for i in range(self.svValues):
                self.svValues[i] = fromCtoF(self.svValues[i])
        except Exception:
            pass
    
    # takes an "Arduino" float time in seconds and returns the corresponding QTime() object 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:19,代码来源:pid_control.py

示例6: get_current_table_values

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def get_current_table_values(self):
        """Used to read all the current table values from the recipeSteps table
        and build a dictionary of all the values."""
        recipeSteps = []
        for row in range(0, self.recipeSteps.rowCount()):
            currentRow = {}
            currentRow["sectionTime"] = QtCore.QTime(0, 0, 0).secsTo(self.recipeSteps.cellWidget(row, 2).time())
            currentRow["fanSpeed"] = int(self.recipeSteps.cellWidget(row, 1).currentText())

            # Get Temperature or cooling
            if self.recipeSteps.cellWidget(row, 0).currentText() == "Cooling":
                currentRow["cooling"] = True
            else:
                currentRow["targetTemp"] = int(self.recipeSteps.cellWidget(row, 0).currentText())

            recipeSteps.append(currentRow)

        # Return copied rows
        return recipeSteps 
开发者ID:Roastero,项目名称:Openroast,代码行数:21,代码来源:recipeeditorwindow.py

示例7: populate_from_profile

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def populate_from_profile(self):
        profile = self.profile()
        self.schedulerRadioMapping[profile.schedule_mode].setChecked(True)

        self.scheduleIntervalHours.setValue(profile.schedule_interval_hours)
        self.scheduleIntervalMinutes.setValue(profile.schedule_interval_minutes)
        self.scheduleFixedTime.setTime(
            QtCore.QTime(profile.schedule_fixed_hour, profile.schedule_fixed_minute))

        # Set checking options
        self.validationCheckBox.setCheckState(profile.validation_on)
        self.validationSpinBox.setValue(profile.validation_weeks)

        self.pruneCheckBox.setCheckState(profile.prune_on)
        self.validationCheckBox.setTristate(False)
        self.pruneCheckBox.setTristate(False)

        self.preBackupCmdLineEdit.setText(profile.pre_backup_cmd)
        self.postBackupCmdLineEdit.setText(profile.post_backup_cmd)
        self.postBackupCmdLineEdit.textEdited.connect(
            lambda new_val, attr='post_backup_cmd': self.save_backup_cmd(attr, new_val))
        self.preBackupCmdLineEdit.textEdited.connect(
            lambda new_val, attr='pre_backup_cmd': self.save_backup_cmd(attr, new_val))

        self._draw_next_scheduled_backup()
        self.init_wifi() 
开发者ID:borgbase,项目名称:vorta,代码行数:28,代码来源:schedule_tab.py

示例8: renderClips

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def renderClips(self, cliptimes: list) -> int:
        self.clear()
        externalCount = 0
        for index, clip in enumerate(cliptimes):
            chapterName, endItem = '', ''
            if isinstance(clip[1], QTime):
                endItem = clip[1].toString(self.parent.timeformat)
                self.parent.totalRuntime += clip[0].msecsTo(clip[1])
            listitem = QListWidgetItem(self)
            listitem.setToolTip('Drag to reorder clips')
            if len(clip[3]):
                listitem.setToolTip(clip[3])
                externalCount += 1
            if self.parent.createChapters:
                chapterName = clip[4] if clip[4] is not None else 'Chapter {}'.format(index + 1)
            listitem.setStatusTip('Reorder clips with mouse drag & drop or right-click menu on the clip to be moved')
            listitem.setTextAlignment(Qt.AlignVCenter)
            listitem.setData(Qt.DecorationRole + 1, clip[2])
            listitem.setData(Qt.DisplayRole + 1, clip[0].toString(self.parent.timeformat))
            listitem.setData(Qt.UserRole + 1, endItem)
            listitem.setData(Qt.UserRole + 2, clip[3])
            listitem.setData(Qt.UserRole + 3, chapterName)
            listitem.setFlags(Qt.ItemIsSelectable | Qt.ItemIsDragEnabled | Qt.ItemIsEnabled)
            self.addItem(listitem)
            if isinstance(clip[1], QTime) and not len(clip[3]):
                self.parent.seekSlider.addRegion(clip[0].msecsSinceStartOfDay(), clip[1].msecsSinceStartOfDay())
        return externalCount 
开发者ID:ozmartian,项目名称:vidcutter,代码行数:29,代码来源:videolist.py

示例9: set_time_limits

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def set_time_limits(self):
        selected_date = self.calendar_widget.selectedDate()
        if selected_date == QDate(*self.creation_date):
            self.time_edit.setMinimumTime(QTime(*self.creation_time))
        else:
            self.time_edit.clearMinimumTime()
        if selected_date == QDate(*self.now_date):
            self.time_edit.setMaximumTime(QTime(*self.now_time))
        else:
            self.time_edit.clearMaximumTime() 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:12,代码来源:timestamped_workspace_widget.py

示例10: on_duration_changed

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def on_duration_changed(self, duration):
        duration = duration * 1000
        m, s = parse_ms(duration)
        t = QTime(0, m, s)
        self.progress_slider.set_duration(duration)
        self.duration_label.setText(t.toString('mm:ss')) 
开发者ID:feeluown,项目名称:FeelUOwn,代码行数:8,代码来源:player_control_panel.py

示例11: on_position_changed

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def on_position_changed(self, position):
        if position is None:
            return
        position = position * 1000
        m, s = parse_ms(position)
        t = QTime(0, m, s)
        self.position_label.setText(t.toString('mm:ss'))
        self.progress_slider.update_state(position) 
开发者ID:feeluown,项目名称:FeelUOwn,代码行数:10,代码来源:player_control_panel.py

示例12: clear_form

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def clear_form(self):
        self.event_title.clear()
        self.event_category.setCurrentIndex(0)
        self.event_time.setTime(qtc.QTime(8, 0))
        self.allday_check.setChecked(False)
        self.event_detail.setPlainText('') 
开发者ID:PacktPublishing,项目名称:Mastering-GUI-Programming-with-Python,代码行数:8,代码来源:calendar_app.py

示例13: time2QTime

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def time2QTime(self,t):
        return QTime(0,t/60,t%60) 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:4,代码来源:pid_control.py

示例14: update_section_time

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def update_section_time(self):
        self.sectTimeSlider.setValue(self.roaster.time_remaining)

        self.sectTimeSpinBox.setTime(QtCore.QTime.fromString(str(time.strftime("%H:%M:%S",
            time.gmtime(self.roaster.time_remaining)))))

        self.sectionTimeLabel.setText(str(time.strftime("%M:%S",
            time.gmtime(self.roaster.time_remaining)))) 
开发者ID:Roastero,项目名称:Openroast,代码行数:10,代码来源:roasttab.py

示例15: update_sect_time_spin_box

# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QTime [as 别名]
def update_sect_time_spin_box(self):
        self.sectionTimeLabel.setText(str(time.strftime("%M:%S",
            time.gmtime(QtCore.QTime(0, 0, 0).secsTo(self.sectTimeSpinBox.time())))))

        self.sectTimeSlider.setValue(QtCore.QTime(0, 0, 0).secsTo(self.sectTimeSpinBox.time()))

        self.roaster.time_remaining = QtCore.QTime(0, 0, 0).secsTo(self.sectTimeSpinBox.time()) 
开发者ID:Roastero,项目名称:Openroast,代码行数:9,代码来源:roasttab.py


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