Here are the examples of the python api PyQt5.QtCore.QTimer taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
104 Examples
4
Example 1
Project: Cura Source File: AutoSave.py
def __init__(self):
super().__init__()
Preferences.getInstance().preferenceChanged.connect(self._triggerTimer)
self._global_stack = None
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalStackChanged)
self._onGlobalStackChanged()
Preferences.getInstance().addPreference("cura/autosave_delay", 1000 * 10)
self._change_timer = QTimer()
self._change_timer.setInterval(Preferences.getInstance().getValue("cura/autosave_delay"))
self._change_timer.setSingleShot(True)
self._change_timer.timeout.connect(self._onTimeout)
self._saving = False
4
Example 2
def __init__(self, space):
self._timer = QTimer(singleShot=True, timeout=self.slotTimeout)
self._waittimer = QTimer(singleShot=True, timeout=self.slotTimeout)
self._label = QLabel()
space.status.layout().insertWidget(1, self._label)
self._view = lambda: None
space.viewChanged.connect(self.slotViewChanged)
view = space.activeView()
if view:
self.slotViewChanged(view)
4
Example 3
Project: qutebrowser Source File: messageview.py
def __init__(self, parent=None):
super().__init__(parent)
self._vbox = QVBoxLayout(self)
self._vbox.setContentsMargins(0, 0, 0, 0)
self._vbox.setSpacing(0)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self._clear_timer = QTimer()
self._clear_timer.timeout.connect(self._clear_messages)
self._set_clear_timer_interval()
objreg.get('config').changed.connect(self._set_clear_timer_interval)
self._last_text = None
self._messages = []
4
Example 4
def __init__(self, widget):
"""Initializes ourselves to draw on the widget."""
super(Blinker, self).__init__(widget)
self._color = None
self._animation = ()
self._timer = QTimer(singleShot=True, timeout=self._updateAnimation)
3
Example 5
def __init__(self, app):
super().__init__(app)
self._app = app
self._stalled_timer = QTimer(self)
self.error.connect(self.on_error_occured)
self.mediaChanged.connect(self.on_media_changed)
self.mediaStatusChanged.connect(self.on_media_status_changed)
self._stalled_timer.timeout.connect(self._wait_to_seek_back)
self._music_error_times = 0
self._retry_latency = 3
self._music_error_maximum = 3
self._media_stalled = False
3
Example 6
Project: enki Source File: dock.py
def __init__(self, *args):
QAbstractItemModel.__init__(self, *args)
self._tags = []
self.currentTagIndex = QModelIndex()
defBaseColor = QApplication.instance().palette().base().color()
# yellow or maroon
brightBg = QColor('#ffff80') if defBaseColor.lightnessF() > 0.5 else QColor('#800000')
self._currentTagBrush = QBrush(brightBg)
core.workspace().cursorPositionChanged.connect(self._onCursorPositionChanged)
self._updateCurrentTagTimer = QTimer(self)
self._updateCurrentTagTimer.setInterval(300)
self._updateCurrentTagTimer.timeout.connect(self._updateCurrentTagAndEmitSignal)
3
Example 7
def __init__(self):
core.restoreSession.connect(self._onRestoreSession)
core.aboutToTerminate.connect(self._saveSession)
self._timer = QTimer(core)
self._timer.timeout.connect(self._autoSaveSession)
self._timer.setInterval(_AUTO_SAVE_INTERVAL_MS)
self._timer.start()
3
Example 8
def repeat(self, interval, function, *args):
timer = QTimer()
timer.setSingleShot(False)
self.params[timer] = (interval, function, args)
timer.start(0)
timer.timeout.connect(self.timeout, Qt.QueuedConnection)
3
Example 9
def __init__(self, handle, controller, parent):
super().__init__('Local Map', parent)
self.basepath = handle.basepath
self.controller = controller
self.widget = uic.loadUi(os.path.join(self.basepath, 'ui', 'localmapwidget.ui'))
self.setWidget(self.widget)
self._logger = logging.getLogger('pypipboyapp.map.localmap')
self.mapZoomLevel = 1.0
self.mapReqTimer = QtCore.QTimer()
3
Example 10
def __init__(self, currency, nodes, session):
"""
Constructor of a network
:param str currency: The currency name of the community
:param list nodes: The root nodes of the network
"""
super().__init__()
self._root_nodes = nodes
self._nodes = []
for n in nodes:
self.add_node(n)
self.currency = currency
self._must_crawl = False
self._block_found = self.current_blockUID
self._timer = QTimer()
self._client_session = session
self._discovery_stack = []
3
Example 11
Project: pkmeter Source File: pkmixins.py
def attribute_showif(self, data, value):
if value and not self.layout().count():
self.layout().addWidget(self.subwidgets[0])
elif not value and self.layout().count():
self.layout().takeAt(0).widget()
timer = QtCore.QTimer()
timer.singleShot(10, self.control.resize_to_min)
3
Example 12
Project: enki Source File: mainwindow.py
def __init__(self, *args):
QStatusBar.__init__(self, *args)
self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Expanding)
self.setSizeGripEnabled(False)
self.setStyleSheet("QStatusBar {border: 0} QStatusBar::item {border: 0}")
self._label = QLabel(self)
self._label.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
self._label.setStyleSheet("color: red")
self.addWidget(self._label)
self._timer = QTimer()
self._timer.setSingleShot(True)
self._timer.timeout.connect(self.clearMessage)
3
Example 13
Project: frescobaldi Source File: keysequencewidget.py
def __init__(self, parent=None):
super(KeySequenceButton, self).__init__(parent)
self.setIcon(icons.get("configure"))
self._modifierlessAllowed = False
self._seq = QKeySequence()
self._timer = QTimer()
self._timer.setSingleShot(True)
self._isrecording = False
self.clicked.connect(self.startRecording)
self._timer.timeout.connect(self.doneRecording)
3
Example 14
Project: enki Source File: preview_sync.py
def _initTextToPreviewSync(self):
"""Called when constructing the PreviewDoc. It performs item 1 above."""
# Create a timer which will sync the preview with the text cursor a
# short time after cursor movement stops.
self._cursorMovementTimer = QTimer()
self._cursorMovementTimer.setInterval(300)
self._cursorMovementTimer.timeout.connect(self.syncTextToPreview)
# Restart this timer every time the cursor moves.
core.workspace().cursorPositionChanged.connect(self._onCursorPositionChanged)
# Set up a variable to tell us when the preview to text sync just fired,
# disabling this sync. Otherwise, that sync would trigger this sync,
# which is unnecessary.
self._previewToTextSyncRunning = False
# Run the approximate match in a separate thread. Cancel it if the
# docuement changes.
self._runLatest = RunLatest('QThread', self)
self._runLatest.ac.defaultPriority = QThread.LowPriority
core.workspace().currentDocuementChanged.connect(self._onDocuementChanged)
3
Example 15
def showMessage(self, message):
with self._message_lock:
if message not in self._visible_messages:
self._visible_messages.append(message)
message.setTimer(QTimer())
self.visibleMessageAdded.emit(message)
3
Example 16
Project: unicodemoticon Source File: __init__.py
def init_preview(self):
self.previews, self.timer = [], QTimer(self)
self.fader, self.previous_pic = FaderWidget(self), None
self.timer.setSingleShot(True)
self.timer.timeout.connect(lambda: [_.close() for _ in self.previews])
self.taimer, self.preview = QTimer(self), QLabel("Preview")
self.taimer.setSingleShot(True)
self.taimer.timeout.connect(lambda: self.preview.hide())
font = self.preview.font()
font.setPixelSize(100)
self.preview.setFont(font)
self.preview.setDisabled(True)
self.preview.setWindowFlags(Qt.FramelessWindowHint | Qt.Tool)
self.preview.setAttribute(Qt.WA_TranslucentBackground, True)
3
Example 17
def __init__(self):
super(DeepinPlayer, self).__init__()
self.initApplication()
self.initView()
self.initControllers()
self.initConnect()
self.initQMLContext()
self.loadDB()
self.timer = QTimer()
self.timer.timeout.connect(self.clearCache)
self.timer.start(2000)
3
Example 18
def __init__(self, mhandle, parent):
super().__init__('Date/Time', parent)
self.widget = uic.loadUi(os.path.join(mhandle.basepath, 'ui', 'datetimewidget.ui'))
self.setWidget(self.widget)
self.pipPlayerInfo = None
self.dateYear = 0
self.dateMonth = 0
self.dateDay = 0
self.timeHour = 0
self.timeMin = 0
self.realClockTimer = QtCore.QTimer()
self.realClockTimer.timeout.connect(self._realClockUpdate)
self._signalInfoUpdated.connect(self._slotInfoUpdated)
3
Example 19
def _handle_reply(self, reply):
"""Handle a new QNetworkReply."""
if reply.isFinished():
self.on_reply_finished(reply)
else:
timer = QTimer(self)
timer.setInterval(10000)
timer.timeout.connect(reply.abort)
timer.start()
self._timers[reply] = timer
reply.finished.connect(functools.partial(
self.on_reply_finished, reply))
3
Example 20
Project: moneyguru Source File: qt.py
def __init__(self, parent):
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
QProgressDialog.__init__(self, '', "Cancel", 0, 100, parent, flags)
self.setModal(True)
self.setAutoReset(False)
self.setAutoClose(False)
self._timer = QTimer()
self._jobid = ''
self._timer.timeout.connect(self.updateProgress)
3
Example 21
def __init__(self, color=Qt.white, parent=None):
QScrollBar.__init__(self, parent)
self._color = color
# self.setAttribute(Qt.WA_TranslucentBackground)
self.timer = QTimer()
self.timer.setInterval(500)
self.timer.setSingleShot(True)
self.timer.timeout.connect(lambda: self.parent().hideWidget(self))
self.valueChanged.connect(lambda v: self.timer.start())
self.valueChanged.connect(lambda: self.parent().showWidget(self))
3
Example 22
Project: manuskript Source File: storylineView.py
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.setupUi(self)
self._mdlPlots = None
self.scene = QGraphicsScene()
self.view.setScene(self.scene)
self.reloadTimer = QTimer()
self.reloadTimer.timeout.connect(self.refresh)
self.reloadTimer.setSingleShot(True)
self.reloadTimer.setInterval(500)
self.btnRefresh.clicked.connect(self.refresh)
self.sldTxtSize.sliderMoved.connect(self.reloadTimer.start)
self.generateMenu()
3
Example 23
Project: moneyguru Source File: progress_window.py
def __init__(self, parent, model, **kwargs):
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
super().__init__('', "Cancel", 0, 100, parent, flags, **kwargs)
self.model = model
model.view = self
# We don't have access to QProgressDialog's labels directly, so we se the model label's view
# to self and we'll refresh them together.
self.model.jobdesc_textfield.view = self
self.model.progressdesc_textfield.view = self
self.setModal(True)
self.setAutoReset(False)
self.setAutoClose(False)
self._timer = QTimer(self)
self._timer.timeout.connect(self.model.pulse)
3
Example 24
Project: imperialism-remake Source File: server_monitor.py
def __init__(self):
super().__init__()
self.layout = QtWidgets.QVBoxLayout(self)
self.status = QtWidgets.QLabel('No information yet.')
self.layout.addWidget(self.status)
self.layout.addStretch()
local_network_client.connect_to_channel(constants.C.SYSTEM, self.update_monitor)
# one initial update
self.request_update()
# set timer for following updates
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self.request_update)
self.timer.setInterval(10000)
self.timer.start()
3
Example 25
Project: frescobaldi Source File: view.py
def __init__(self, parent=None):
super(View, self).__init__(parent)
self.setAlignment(Qt.AlignCenter)
self.setBackgroundRole(QPalette.Dark)
self.setMouseTracking(True)
self._viewMode = FixedScale
self._wheelZoomEnabled = True
self._wheelZoomModifier = Qt.CTRL
# delayed resize
self._centerPos = False
self._resizeTimer = QTimer(singleShot = True, timeout = self._resizeTimeout)
3
Example 26
Project: domanager Source File: CustomMenu.py
def __init__(self, parent=None):
super(CustomMenu, self).__init__(parent)
self.setFocus(Qt.MouseFocusReason)
self.setFocusPolicy(Qt.StrongFocus)
self.setMouseTracking(True)
self._checkTimer = QtCore.QTimer(self)
self._checkTimer.timeout.connect(self._checkMouse)
self._closeTimer = QtCore.QTimer(self)
self._closeTimer.timeout.connect(self.close)
3
Example 27
Project: enki Source File: locator.py
def __init__(self, parent, commandClasses):
QDialog.__init__(self, parent)
self._terminated = False
self._commandClasses = commandClasses
self._createUi()
self._loadingTimer = QTimer(self)
self._loadingTimer.setSingleShot(True)
self._loadingTimer.setInterval(200)
self._loadingTimer.timeout.connect(self._applyLoadingCompleter)
self._completerLoaderThread = _CompleterLoaderThread(self)
self.finished.connect(self._terminate)
self._command = None
self._updateCurrentCommand()
3
Example 28
def __init__(self, doc):
QObject.__init__(self, doc)
self._depth_cache = [] # cache result of depth()
self._all_visible = None # True when all are certainly visible
doc.contentsChange.connect(self.slot_contents_change)
self._timer = QTimer(singleShot=True, timeout=self.check_consistency)
3
Example 29
Project: enki Source File: editortoolbar.py
def __init__(self, parent):
QToolButton.__init__(self, parent)
self.setToolTip(self.tr("Cursor position"))
self.setEnabled(False)
self._setCursorPosition(-1, -1)
minWidth = QFontMetrics(self.font()).width("Line: xxxxx Column: xxx")
minWidth += 30 # for the button borders
self.setMinimumWidth(minWidth) # Avoid flickering when text width changed
core.workspace().currentDocuementChanged.connect(self._onCurrentDocuementChanged)
core.workspace().cursorPositionChanged.connect(self._onCursorPositionChanged)
self._timer = QTimer()
self._timer.setInterval(200)
self._timer.setSingleShot(True)
self._timer.timeout.connect(self._onUpdatePositionTimer)
self._passedUpdate = False
3
Example 30
Project: enki Source File: core.py
def _prepareToCatchSigInt(self):
"""Catch SIGINT signal to close the application
"""
signal.signal(signal.SIGINT, lambda signum, frame: QApplication.instance().closeAllWindows())
self._checkSignalsTimer = QTimer()
self._checkSignalsTimer.start(500)
self._checkSignalsTimer.timeout.connect(lambda: None) # Let the interpreter run each 500 ms.
3
Example 31
Project: enki Source File: __init__.py
def __init__(self):
QObject.__init__(self)
self._dock = None
core.workspace().currentDocuementChanged.connect(self._onDocuementChanged)
core.workspace().textChanged.connect(self._onTextChanged)
core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
core.uiSettingsManager().dialogAccepted.connect(self._scheduleDocuementProcessing)
# If we update Tree on every key pressing, freezes are sensible (GUI thread draws tree too slowly
# This timer is used for drawing Preview 1000 ms After user has stopped typing text
self._typingTimer = QTimer()
self._typingTimer.setInterval(1000)
self._typingTimer.setSingleShot(True)
self._typingTimer.timeout.connect(self._scheduleDocuementProcessing)
self._thread = ProcessorThread()
3
Example 32
Project: pireal Source File: notification.py
def __init__(self, parent=None):
super(Notification, self).__init__(parent)
box = QVBoxLayout(self)
box.setContentsMargins(50, 0, 0, 0)
self.notificator = QLabel("")
box.addWidget(self.notificator)
# Timer
self.timer = QTimer(self)
self.timer.timeout.connect(self.clear)
# Install service
Pireal.load_service("notification", self)
3
Example 33
Project: enki Source File: repl.py
def __init__(self, language, fullName, interpreterPath):
QObject.__init__(self)
self._fullName = fullName
self._term = self._createTermWidget()
self._term.setLanguage(language)
self._interpreterPath = interpreterPath
self._processOutputTimer = QTimer() # I use Qt timer, because we must append data to GUI in the GUI thread
self._processOutputTimer.timeout.connect(self._processOutput)
self._processOutputTimer.setInterval(100)
self._buffPopen = enki.lib.buffpopen.BufferedPopen(interpreterPath)
self._processIsRunning = False
self._term.appendHint("Execute any command to run the interpreter\n")
3
Example 34
Project: frescobaldi Source File: popplerwidget.py
def createHighlighters(self):
self._highlightFormat = QTextCharFormat()
self._highlightMusicFormat = Highlighter()
self._highlightRange = None
self._highlightTimer = QTimer(singleShot=True, interval= 250, timeout=self.updateHighlighting)
self._highlightRemoveTimer = QTimer(singleShot=True, timeout=self.clearHighlighting)
3
Example 35
def _startTimer(self):
"""Init a timer.
It is used for monitoring file after deletion.
Git removes file, than restores it.
"""
if self._timer is None:
self._timer = QTimer()
self._timer.setInterval(500)
self._timer.timeout.connect(self._onCheckIfDeletedTimer)
self._timer.start()
3
Example 36
def __init__(self):
self._timer = QTimer(QApplication.instance())
self._timer.setSingleShot(True)
self._timer.timeout.connect(self._onTimer)
self._scheduledCallbacks = []
3
Example 37
def __init__(self, app, parent=None):
super().__init__(parent)
self._app = app
self.setObjectName('message_label')
self._interval = 3
self.timer = QTimer()
self.queue = []
self.hide()
self.timer.timeout.connect(self.access_message_queue)
3
Example 38
def schedule(self, interval, function, *args):
timer = QTimer()
timer.setInterval(interval * 1000)
timer.setSingleShot(True)
self.params[timer] = (None, function, args)
timer.timeout.connect(self.timeout)
timer.start()
3
Example 39
Project: frescobaldi Source File: widget.py
def __init__(self):
QLabel.__init__(self, wordWrap=True)
self.setSizePolicy(QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred))
self.setStyleSheet(css.lcd_screen)
self._tempoTimer = QTimer(interval=1500, singleShot=True,
timeout=self.setTempo)
self._statusTimer = QTimer(interval=2000, singleShot=True,
timeout=self.statusMessage)
self._tempo = None
self._status = None
self.reset()
app.translateUI(self)
3
Example 40
def __init__(self, startEnabled, startSetting, startLimit, formID):
self.Enabled = startEnabled
self.Setting = startSetting
self.Limit = startLimit
self.FormID = formID
self.Num = 0
self.Active = False
self.UseFlag = False
self.UseTimer = QtCore.QTimer()
self.UseTimer.setSingleShot(True)
self.UseTimer.timeout.connect(self.UseTimerTimeout)
self.UseTimerDelay = 2000
self.FreezeUseFlag = False
3
Example 41
def initialize(self, *agrs, **kwargs):
self.setDict(kwargs)
self.start_size = 0
self.stopDownloaded = False
self.isFinished = False
self.isConnected = False
self.filename = DownloadSongWorker.getSongPath(self.singerName,
self.name, self.ext)
self.temp_filename = '%s.tmp' % self.filename
self.speedTimer = QTimer()
self.speedTimer.setInterval(100)
self.speedTimer.timeout.connect(self.calSpeed)
self.initConnect()
3
Example 42
def run(self):
self._timer = QTimer(singleShot=True, timerType=Qt.PreciseTimer)
self._timer.timeout.connect(self.timer_timeout, Qt.DirectConnection)
self.timer_start_playing()
self.stateChanged.emit(True)
if self.exec_():
self.timer_stop_playing()
self._timer = None
self.stateChanged.emit(False)
3
Example 43
Project: pkmeter Source File: pkmixins.py
def attribute_iter(self, data, value):
count = 0
length = len(value) if value else 0
for i in range(length):
count += 1
subwidget = self._get_subwidget(i)
data['this'] = value[i]
for action in subwidget.actions:
action.apply(data)
if self.itermax and i >= self.itermax-1:
break
for subwidget in self.subwidgets[count:]:
utils.remove_widget(subwidget)
self.subwidgets = self.subwidgets[:count]
timer = QtCore.QTimer()
timer.singleShot(10, self.control.resize_to_min)
3
Example 44
Project: sakia Source File: mainwindow.py
@pyqtSlot()
def update_time(self):
dateTime = QDateTime.currentDateTime()
self.label_time.setText("{0}".format(QLocale.toString(
QLocale(),
QDateTime.currentDateTime(),
QLocale.dateTimeFormat(QLocale(), QLocale.NarrowFormat)
)))
timer = QTimer()
timer.timeout.connect(self.update_time)
timer.start(1000)
3
Example 45
def __init__(self, parent, callback, errback, timeout=0):
self.name = str(uuid.uuid1())
self._used_up = False
self._callback = callback
self._errback = errback
if timeout < 0:
raise ValueError('OneShotCallbackProxy timeout must be >= 0.')
elif timeout == 0:
self._timer = None
elif timeout > 0:
self._timer = QTimer()
self._timer.setSingleShot(True)
self._timer.timeout.connect(self._timed_out)
self._timer.start(timeout * 1000)
super(OneShotCallbackProxy, self).__init__(parent)
3
Example 46
Project: Cura Source File: PlatformPhysics.py
def __init__(self, controller, volume):
super().__init__()
self._controller = controller
self._controller.getScene().sceneChanged.connect(self._onSceneChanged)
self._controller.toolOperationStarted.connect(self._onToolOperationStarted)
self._controller.toolOperationStopped.connect(self._onToolOperationStopped)
self._build_volume = volume
self._enabled = True
self._change_timer = QTimer()
self._change_timer.setInterval(100)
self._change_timer.setSingleShot(True)
self._change_timer.timeout.connect(self._onChangeTimerFinished)
self._move_factor = 1.1 # By how much should we multiply overlap to calculate a new spot?
self._max_overlap_checks = 10 # How many times should we try to find a new spot per tick?
Preferences.getInstance().addPreference("physics/automatic_push_free", True)
Preferences.getInstance().addPreference("physics/automatic_drop_down", True)
3
Example 47
Project: enki Source File: locator.py
def __init__(self, *args):
QLineEdit.__init__(self, *args)
self._inlineCompletionIsSet = False # to differentiate inline completion and selection
# Timer is used to delay completion update until user has finished typing
self._updateCurrentCommandTimer = QTimer(self)
self._updateCurrentCommandTimer.setInterval(100)
self._updateCurrentCommandTimer.setSingleShot(True)
self._updateCurrentCommandTimer.timeout.connect(self.updateCurrentCommand)
3
Example 48
def __init__(self, locator):
"""Works in the GUI thread
"""
Thread.__init__(self)
self._locator = locator
self._taskQueue = Queue() # completer or None as exit signal
self._resultQueue = Queue()
self._checkResultQueueTimer = QTimer()
self._checkResultQueueTimer.setInterval(50)
self._checkResultQueueTimer.timeout.connect(self._checkResultQueue)
self._checkResultQueueTimer.start()
self._stopEvent = Event()
Thread.start(self)
2
Example 49
Project: splash Source File: network_manager.py
def _set_reply_timeout(self, reply, timeout_ms):
request_id = self._get_request_id(reply.request())
# reply is used as a parent for the timer in order to destroy
# the timer when reply is destroyed. It segfaults otherwise.
timer = QTimer(reply)
timer.setSingleShot(True)
timer_callback = functools.partial(self._on_reply_timeout,
reply=reply,
timer=timer,
request_id=request_id)
timer.timeout.connect(timer_callback)
self._reply_timeout_timers[request_id] = timer
timer.start(timeout_ms)
2
Example 50
def __init__(self, cmd, win_id, parent=None):
super().__init__(parent)
self._win_id = win_id
self._cmd = cmd
self._ignore_change = False
self._timer = QTimer()
self._timer.setSingleShot(True)
self._timer.setInterval(0)
self._timer.timeout.connect(self._update_completion)
self._last_cursor_pos = None
self._last_text = None
self._cmd.update_completion.connect(self.schedule_completion_update)