Python PyQt5.QtCore.QTime() Examples
The following are 22
code examples of PyQt5.QtCore.QTime().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore
, or try the search function
.
Example #1
Source File: test_schedule.py From restatic with GNU General Public License v3.0 | 6 votes |
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")
Example #2
Source File: schedule_tab.py From restatic with GNU General Public License v3.0 | 6 votes |
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()
Example #3
Source File: test_schedule.py From vorta with GNU General Public License v3.0 | 6 votes |
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')
Example #4
Source File: recipeeditorwindow.py From Openroast with GNU General Public License v3.0 | 6 votes |
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
Example #5
Source File: calendar_app.py From Mastering-GUI-Programming-with-Python with MIT License | 6 votes |
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()
Example #6
Source File: pid_control.py From artisan with GNU General Public License v3.0 | 6 votes |
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
Example #7
Source File: calendar_app.py From Mastering-GUI-Programming-with-Python with MIT License | 6 votes |
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()
Example #8
Source File: Timers.py From tdm with GNU General Public License v3.0 | 5 votes |
def loadTimer(self, timer=""): if not timer: timer = self.cbTimer.currentText() payload = self.timers[timer] if payload: self.blockSignals(True) self.cbTimerArm.setChecked(payload['Arm']) self.cbTimerRpt.setChecked(payload['Repeat']) self.cbxTimerAction.setCurrentIndex(payload['Action']) output = payload.get('Output') if output: self.cbxTimerOut.setEnabled(True) self.cbxTimerOut.setCurrentIndex(output - 1) else: self.cbxTimerOut.setEnabled(False) mode = payload.get('Mode', 0) self.TimerMode.button(mode).setChecked(True) h, m = map(int, payload["Time"].split(":")) if h < 0: self.cbxTimerPM.setCurrentText("-") h *= -1 self.teTimerTime.setTime(QTime(h, m)) self.cbxTimerWnd.setCurrentText(str(payload['Window']).zfill(2)) for wd, v in enumerate(payload['Days']): self.TimerWeekday.button(wd).setChecked(int(v)) self.blockSignals(False) self.describeTimer()
Example #9
Source File: gui.py From Yin-Yang with MIT License | 5 votes |
def set_correct_time(self): new_config = config.get_config() d_hour = new_config["switchToDark"].split(":")[0] d_minute = new_config["switchToDark"].split(":")[1] l_hour = new_config["switchToLight"].split(":")[0] l_minute = new_config["switchToLight"].split(":")[1] # giving the time widget the values of the config dark_time = QTime(int(d_hour), int(d_minute)) light_time = QTime(int(l_hour), int(l_minute)) self.ui.dark_time.setTime(dark_time) self.ui.light_time.setTime(light_time)
Example #10
Source File: roasttab.py From Openroast with GNU General Public License v3.0 | 5 votes |
def update_sect_time_slider(self): self.sectionTimeLabel.setText(str(time.strftime("%M:%S", time.gmtime(self.sectTimeSlider.value())))) self.sectTimeSpinBox.setTime(QtCore.QTime.fromString(str(time.strftime("%H:%M:%S", time.gmtime(self.sectTimeSlider.value()))))) self.roaster.time_remaining = self.sectTimeSlider.value()
Example #11
Source File: roasttab.py From Openroast with GNU General Public License v3.0 | 5 votes |
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())
Example #12
Source File: roasttab.py From Openroast with GNU General Public License v3.0 | 5 votes |
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))))
Example #13
Source File: pid_control.py From artisan with GNU General Public License v3.0 | 5 votes |
def time2QTime(self,t): return QTime(0,t/60,t%60)
Example #14
Source File: calendar_app.py From Mastering-GUI-Programming-with-Python with MIT License | 5 votes |
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('')
Example #15
Source File: calendar_app.py From Mastering-GUI-Programming-with-Python with MIT License | 5 votes |
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('')
Example #16
Source File: player_control_panel.py From FeelUOwn with GNU General Public License v3.0 | 5 votes |
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)
Example #17
Source File: player_control_panel.py From FeelUOwn with GNU General Public License v3.0 | 5 votes |
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'))
Example #18
Source File: timestamped_workspace_widget.py From parsec-cloud with GNU Affero General Public License v3.0 | 5 votes |
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()
Example #19
Source File: videolist.py From vidcutter with GNU General Public License v3.0 | 5 votes |
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
Example #20
Source File: schedule_tab.py From vorta with GNU General Public License v3.0 | 5 votes |
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()
Example #21
Source File: gui.py From PUBGIS with GNU General Public License v3.0 | 4 votes |
def process_match(self): map_iter = None output_file = None try: if self.tabWidget.currentIndex() == ProcessMode.VIDEO: if self._validate_inputs(ProcessMode.VIDEO): zero = QTime(0, 0, 0) map_iter = VideoIterator(video_file=self.video_file_edit.text(), landing_time=zero.secsTo(self.landing_time.time()), death_time=zero.secsTo(self.death_time.time()), time_step=float(self.time_step.currentText())) output_file = self.output_file_edit.text() elif self.tabWidget.currentIndex() == ProcessMode.LIVE: if self._validate_inputs(ProcessMode.LIVE): map_iter = LiveFeed(time_step=float(self.time_step.currentText()), monitor=self.monitor_combo.currentIndex() + 1) output_file = os.path.join(self.output_directory_edit.text(), self.generate_output_file_name()) else: raise ValueError if map_iter: output_flags = OutputFlags.NO_OUTPUT output_flags |= OutputFlags.LIVE_PREVIEW output_flags |= OutputFlags.CROPPED_MAP if self.disable_preview_checkbox.isChecked(): output_flags ^= OutputFlags.LIVE_PREVIEW if self.output_json_checkbox.isChecked(): output_flags |= OutputFlags.JSON if self.output_full_map_checkbox.isChecked(): output_flags |= OutputFlags.FULL_MAP match_thread = PUBGISWorkerThread(self, map_iter, output_file, output_flags) self._update_button_state(ButtonGroups.PROCESSING) match_thread.percent_update.connect(self.progress_bar.setValue) match_thread.percent_max_update.connect(self.progress_bar.setMaximum) match_thread.minimap_update.connect(self._update_map_preview) match_thread.finished.connect(self._update_button_state) self.cancel_button.released.connect(match_thread.requestInterruption) match_thread.start() except ResolutionNotSupportedException: QMessageBox.information(self, "Error", "Resolution not supported")
Example #22
Source File: player.py From MusicBox with MIT License | 4 votes |
def setLyricEvent(self, position): # copy from https://github.com/wn0112/PPlayer t = QTime(0, 0, 0) t = t.addMSecs(int(position)) lycF = '' lycL = '' lycM = '' if self.lrc_lst: lenOfLrc = len(self.lrc_lst) for i in range(lenOfLrc): if t.toString("mm:ss") in self.lrc_lst[i][0]: t1 = t if i < lenOfLrc - 1: x = self.lrc_lst[i+1][0].replace('[', '') x = x.replace(']', '') t1 = QTime().fromString(x, 'mm:ss.z') intervel = t.msecsTo(t1) else: t1 = QTime().fromString('00:10.99') intervel = 3000 self.parent.desktopLyric.stopMask() self.parent.desktopLyric.setText(self.lrc_lst[i][1], intervel) self.parent.desktopLyric.startMask() if i > 0: lycM = self.lrc_lst[i-1][1] j = 0 while(j < i-1): lycF += self.lrc_lst[j][1]+'\n' j += 1 j = i while(j < lenOfLrc - 1): lycL += self.lrc_lst[j+1][1]+'\n' j += 1 # self.parent.desktopLyric.setText(lycF, lycM, self.lrc_lst[i][1], lycL, intervel) # self.parent.desktopLyric.setText(lycF, lycM, self.lrc_lst[i][1], lycL, intervel) break # def mediaStatusChangedEvent(self, status): """""" # 8是无效音频。 # if status == 8: # print(self.playList.currentIndex(), "当前下标") # 自定义的QTableWidget, 做了hover一整行的操作,和右键菜单。