Python PyQt5.QtCore 模块,QTime() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用PyQt5.QtCore.QTime()

项目:pysport    作者:sportorg    | 项目源码 | 文件源码
def recover_state(self):
        obj = race()

        self.reserve_check_box.setChecked(obj.get_setting('is_start_preparation_reserve', False))
        self.reserve_prefix.setText(obj.get_setting('reserve_prefix', _('Reserve')))
        self.reserve_group_count_spin_box.setValue(obj.get_setting('reserve_count', 1))
        self.reserve_group_percent_spin_box.setValue(obj.get_setting('reserve_percent', 0))

        self.draw_check_box.setChecked(obj.get_setting('is_start_preparation_draw', False))
        self.draw_groups_check_box.setChecked(obj.get_setting('is_split_start_groups', False))
        self.draw_teams_check_box.setChecked(obj.get_setting('is_split_teams', False))
        self.draw_regions_check_box.setChecked(obj.get_setting('is_split_regions', False))
        self.draw_mix_groups_check_box.setChecked(obj.get_setting('is_mix_groups', False))

        self.start_check_box.setChecked(obj.get_setting('is_start_preparation_time', False))
        self.start_interval_radio_button.setChecked(obj.get_setting('is_fixed_start_interval', False))
        self.start_interval_time_edit.setTime(obj.get_setting('start_interval', QTime()))

        self.numbers_check_box.setChecked(obj.get_setting('is_start_preparation_numbers', False))
        self.numbers_interval_radio_button.setChecked(obj.get_setting('is_fixed_number_interval', False))
        self.numbers_interval_spin_box.setValue(obj.get_setting('numbers_interval', 1))
项目:pysport    作者:sportorg    | 项目源码 | 文件源码
def time_to_otime(t):
    if isinstance(t, datetime.datetime):
        return OTime(0, t.hour, t.minute, t.second, t.microsecond // 1000)
    if isinstance(t, QTime):
        return OTime(0, t.hour(), t.minute(), t.second(), t.msec())
    if isinstance(t, datetime.timedelta):
        return time_to_otime(datetime.datetime(2000, 1, 1, 0, 0, 0) + t)
    if isinstance(t, OTime):
        return t
    return OTime()
项目:pysport    作者:sportorg    | 项目源码 | 文件源码
def time_to_qtime(t):
    otime = time_to_otime(t)
    time = QTime()
    time.setHMS(otime.hour, otime.minute, otime.sec)
    return time
项目:pysport    作者:sportorg    | 项目源码 | 文件源码
def _time_to_sec(value, max_val=86400):  # default max value = 24h

    if isinstance(value, datetime.datetime):
        ret = value.hour * 3600 + value.minute * 60 + value.second + value.microsecond / 1000000
        if max_val:
            ret = ret % max_val
        return ret

    if isinstance(value, QTime):
        return time_to_sec(time_to_datetime(value), max_val)

    return 0
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def artisticSleep(sleepTime):
    time = QTime()
    time.restart()
    while time.elapsed() < sleepTime:
        QApplication.processEvents(QEventLoop.AllEvents, 50)
项目:well-being-diary    作者:SunyataZero    | 项目源码 | 文件源码
def background_function(self, i_hour_it, i_practice_title_sg):
        now = time.time()
        reminder_time_qdatetime = QtCore.QDateTime.currentDateTime()
        reminder_time_qdatetime.setTime(QtCore.QTime(i_hour_it, 50))
        reminder_time_in_seconds_it = reminder_time_qdatetime.toMSecsSinceEpoch() / 1000
        logging.debug("reminder_time_in_seconds_it = " + str(reminder_time_in_seconds_it))
        self.scheduler.enterabs(reminder_time_in_seconds_it + 10, 1, self.popup_function, (i_practice_title_sg,))
        # -Several events can be scheduled, (the enterabs function adds an event rather than replacing)
        self.scheduler.run()  # blocking=False
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def artisticSleep(sleepTime):
    time = QTime()
    time.restart()
    while time.elapsed() < sleepTime:
        QApplication.processEvents(QEventLoop.AllEvents, 50)
项目:pysport    作者:sportorg    | 项目源码 | 文件源码
def set_values_from_model(self):
        cur_race = race()
        zero_time = cur_race.get_setting('sportident_zero_time', (8, 0, 0))
        start_source = cur_race.get_setting('sportident_start_source', 'protocol')
        finish_source = cur_race.get_setting('sportident_finish_source', 'station')
        assign_chip_reading = cur_race.get_setting('sportident_assign_chip_reading', 'off')
        repeated_reading = cur_race.get_setting('sportident_repeated_reading', 'rewrite')
        assignment_mode = cur_race.get_setting('sportident_assignment_mode', False)

        self.item_zero_time.setTime(QTime(zero_time[0], zero_time[1]))

        if start_source == 'protocol':
            self.item_start_protocol.setChecked(True)
        elif start_source == 'station':
            self.item_start_station.setChecked(True)
        elif start_source == 'cp':
            self.item_start_cp.setChecked(True)
        elif start_source == 'gate':
            self.item_start_gate.setChecked(True)

        if finish_source == 'station':
            self.item_finish_station.setChecked(True)
        elif finish_source == 'cp':
            self.item_finish_cp.setChecked(True)
        elif finish_source == 'beam':
            self.item_finish_beam.setChecked(True)

        if assign_chip_reading == 'off':
            self.chip_reading_off.setChecked(True)
        elif assign_chip_reading == 'only_unknown_members':
            self.chip_reading_unknown.setChecked(True)
        elif assign_chip_reading == 'always':
            self.chip_reading_always.setChecked(True)

        if repeated_reading == 'rewrite':
            self.repeated_reading_rewrite.setChecked(True)
        elif repeated_reading == 'add':
            self.repeated_reading_add.setChecked(True)
        elif repeated_reading == 'keep_all_versions':
            self.repeated_reading_keep_all_version.setChecked(True)

        self.assignment_mode.setChecked(assignment_mode)
        self.auto_connect.setChecked(Config().configuration.get('autoconnect'))
项目:DCheat    作者:DCheat    | 项目源码 | 文件源码
def __init__(self, socket, name, testDate, startTime, endTime, banList, allowList, parent=None):
        QtWidgets.QDialog.__init__(self, parent)
        self.ui = uic.loadUi(config.config.ROOT_PATH +'view/updateCourse.ui', self)
        self.sock = socket

        self.name = name
        self.date = testDate.split('-')
        self.startTime = startTime.split(':')
        self.endTime = endTime.split(':')
        self.banList = banList
        self.allowList = allowList

        self.students = []
        self.ui.label_5.setText(self.name)


        self.ui.dateEdit.setDate(QDate(int(self.date[0]), int(self.date[1]), int(self.date[2])))
        self.ui.timeEdit.setTime(QTime(int(self.startTime[0]), int(self.startTime[1])))
        self.ui.timeEdit_2.setTime(QTime(int(self.endTime[0]), int(self.endTime[1])))

        pListWidget = QtWidgets.QWidget()
        self.ui.scrollArea.setWidgetResizable(True)
        self.ui.scrollArea.setWidget(pListWidget)
        pListLayout = QtWidgets.QVBoxLayout()
        pListLayout.setAlignment(Qt.AlignTop)
        pListWidget.setLayout(pListLayout)

        for i in range(1, len(config.config.BAN_PROGRAM)):
            checkBox = QtWidgets.QCheckBox(config.config.BAN_PROGRAM[i])
            checkBox.clicked.connect(self.set_ban_list)

            if i in self.banList:
                checkBox.setChecked(True)

            pListLayout.addWidget(checkBox)


        sListWidget = QtWidgets.QWidget()
        self.ui.scrollArea_2.setWidgetResizable(True)
        self.ui.scrollArea_2.setWidget(sListWidget)
        sListLayout = QtWidgets.QVBoxLayout()
        sListLayout.setAlignment(Qt.AlignTop)
        sListWidget.setLayout(sListLayout)

        for i in range(1, len(config.config.ALLOW_SITE)):
            checkBox = QtWidgets.QCheckBox(config.config.ALLOW_SITE[i])
            checkBox.clicked.connect(self.set_allow_list)

            if i in self.allowList:
                checkBox.setChecked(True)

            sListLayout.addWidget(checkBox)

        self.ui.show()