本文整理汇总了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()