本文整理匯總了Python中PyQt4.QtCore.QTimer.singleShot方法的典型用法代碼示例。如果您正苦於以下問題:Python QTimer.singleShot方法的具體用法?Python QTimer.singleShot怎麽用?Python QTimer.singleShot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.QtCore.QTimer
的用法示例。
在下文中一共展示了QTimer.singleShot方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: enterEvent
# 需要導入模塊: from PyQt4.QtCore import QTimer [as 別名]
# 或者: from PyQt4.QtCore.QTimer import singleShot [as 別名]
def enterEvent(self, event):
self.setFixedSize(self._activeSize)
QTimer.singleShot(500, lambda : self.setFixedSize(self.sizeHint()))
示例2: goToHome
# 需要導入模塊: from PyQt4.QtCore import QTimer [as 別名]
# 或者: from PyQt4.QtCore.QTimer import singleShot [as 別名]
def goToHome(self):
self.GoTo(homepage)
loop = QEventLoop()
QTimer.singleShot(10, loop.quit)
loop.exec_()
document = self.tabWidget.currentWidget().page().mainFrame().documentElement()
gallery = document.findFirst('div')
for i, fav in enumerate(self.favourites):
title, url, img = fav[0], fav[1], thumbnails_dir+fav[2]
child = '<div class="photo"> <a href="{}"><img src="{}"></a><div class="desc">{}</div></div>'.format(url, img, title)
gallery.appendInside(child)
示例3: tick
# 需要導入模塊: from PyQt4.QtCore import QTimer [as 別名]
# 或者: from PyQt4.QtCore.QTimer import singleShot [as 別名]
def tick(self):
logging.debug('TICK')
features = []
for f in self.features:
p1 = (f.attribute('From X'),
f.attribute('From Y'),
f.attribute('From Z'))
p2 = (f.attribute('To X'),
f.attribute('To Y'),
f.attribute('To Z'))
geom = LineString([p1, p2])
new_feature = QgsFeature()
new_feature.setGeometry(qgeom_from_wkt(geom.wkt.replace(' Z', 'Z')))
attrs = f.attributes()
attrs += [self.my_id]
new_feature.setAttributes(attrs)
self.my_id = self.my_id + 1
features += [new_feature]
self.dialog.setValue(self.my_id)
if len(features) == 1000:
break
insert_features_in_layer(features, self.new_layer)
if self.dialog.wasCanceled():
pass
elif self.features.isClosed():
pass
else:
self.timer = QTimer.singleShot(0, self.tick)
示例4: test_PyQt4_QtWebKit
# 需要導入模塊: from PyQt4.QtCore import QTimer [as 別名]
# 或者: from PyQt4.QtCore.QTimer import singleShot [as 別名]
def test_PyQt4_QtWebKit(pyi_builder):
pyi_builder.test_source(
"""
from PyQt4.QtGui import QApplication
from PyQt4.QtWebKit import QWebView
from PyQt4.QtCore import QTimer
app = QApplication([])
view = QWebView()
view.show()
# Exit Qt when the main loop becomes idle.
QTimer.singleShot(0, app.exit)
# Run the main loop, displaying the WebKit widget.
app.exec_()
""")
示例5: _start_timer
# 需要導入模塊: from PyQt4.QtCore import QTimer [as 別名]
# 或者: from PyQt4.QtCore.QTimer import singleShot [as 別名]
def _start_timer(self, wait_seconds):
self._stop_timer()
if wait_seconds is not None:
self._timer = QTimer.singleShot(wait_seconds * 1000, self._process_jobs)
示例6: adjustSizeWithTimer
# 需要導入模塊: from PyQt4.QtCore import QTimer [as 別名]
# 或者: from PyQt4.QtCore.QTimer import singleShot [as 別名]
def adjustSizeWithTimer(self):
self.ensurePolished()
if self.layout():
self.layout().activate()
QTimer.singleShot(0, self.adjustSize)
示例7: ledLogic
# 需要導入模塊: from PyQt4.QtCore import QTimer [as 別名]
# 或者: from PyQt4.QtCore.QTimer import singleShot [as 別名]
def ledLogic(self, led, state):
if state == True:
if led == 1:
if self.settings.LED1Autoflash.isChecked():
self.timerLED1.start(500)
if self.settings.LED1Timedflash.isChecked():
self.timerLED1.start(500)
QTimer.singleShot(20000, self.unsetLED1)
self.setLED1(state)
if led == 2:
if self.settings.LED2Autoflash.isChecked():
self.timerLED2.start(500)
if self.settings.LED2Timedflash.isChecked():
self.timerLED2.start(500)
QTimer.singleShot(20000, self.unsetLED2)
self.setLED2(state)
if led == 3:
if self.settings.LED3Autoflash.isChecked():
self.timerLED3.start(500)
if self.settings.LED3Timedflash.isChecked():
self.timerLED3.start(500)
QTimer.singleShot(20000, self.unsetLED3)
self.setLED3(state)
if led == 4:
if self.settings.LED4Autoflash.isChecked():
self.timerLED4.start(500)
if self.settings.LED4Timedflash.isChecked():
self.timerLED4.start(500)
QTimer.singleShot(20000, self.unsetLED4)
self.setLED4(state)
if state == False:
if led == 1:
self.setLED1(state)
self.timerLED1.stop()
if led == 2:
self.setLED2(state)
self.timerLED2.stop()
if led == 3:
self.setLED3(state)
self.timerLED3.stop()
if led == 4:
self.setLED4(state)
self.timerLED4.stop()