当前位置: 首页>>代码示例>>Python>>正文


Python QTimer.singleShot方法代码示例

本文整理汇总了Python中PySide.QtCore.QTimer.singleShot方法的典型用法代码示例。如果您正苦于以下问题:Python QTimer.singleShot方法的具体用法?Python QTimer.singleShot怎么用?Python QTimer.singleShot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtCore.QTimer的用法示例。


在下文中一共展示了QTimer.singleShot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: reverseCalculationWorker

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
 def reverseCalculationWorker(self, seconds_before_start):
     self.message.sendMessage('second_' + str(seconds_before_start))
     if seconds_before_start == 0:
         self.timer.start()
         self.animation_timer.start()
         QTimer.singleShot(1000, self.message.noMessage)
     self.repaint()
开发者ID:IvanShafran,项目名称:mr-ant,代码行数:9,代码来源:game_run_to_anthill.py

示例2: error

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
 def error(self, error):
     if error == QNetworkSession.UnknownSessionError:
         msgBox = QMessageBox(self.parent())
         msgBox.setText('This application requires network access to function.')
         msgBox.setInformativeText('Press Cancel to quit the application.')
         msgBox.setStandardButtons(QMessageBox.Retry | QMessageBox.Cancel)
         msgBox.setIcon(QMessageBox.Information)
         msgBox.setDefaultButton(QMessageBox.Retry)
         ret = msgBox.exec_()
         if ret == QMessageBox.Retry:
             QTimer.singleShot(0, self.session.open)
         elif ret == QMessageBox.Cancel:
             self.close()
     elif error == QNetworkSession.SessionAbortedError:
         msgBox = QMessageBox(self.parent())
         msgBox.setText('Out of range of network')
         msgBox.setInformativeText('Move back into range and press Retry, or press Cancel to quit the application')
         msgBox.setStandardButtons(QMessageBox.Retry | QMessageBox.Cancel)
         msgBox.setIcon(QMessageBox.Information)
         msgBox.setDefaultButton(QMessageBox.Retry)
         ret = msgBox.exec_()
         if ret == QMessageBox.Retry:
             QTimer.singleShot(0, self.session.open)
         elif ret == QMessageBox.Cancel:
             self.close()
开发者ID:AmerGit,项目名称:Examples,代码行数:27,代码来源:mapviewer.py

示例3: __init__

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
    def __init__(self, parent):
        super(QNEMainWindow, self).__init__(parent)

        self.logger = logging.getLogger("zne")
        self.logger.setLevel(logging.DEBUG)

        self.setMinimumSize(560,360)
        self.setWindowTitle("ZOCP Node Editor")
        self.setWindowIcon(QIcon('assets/icon.png'))

        self.scene = QGraphicsScene(self)
        self.view = QGraphicsView(self)
        self.view.setScene(self.scene)
        self.setCentralWidget(self.view)

        self.nodesEditor = QNodesEditor(self, self.scene, self.view)

        self.nodesEditor.onAddConnection = self.onAddConnection
        self.nodesEditor.onRemoveConnection = self.onRemoveConnection
        self.nodesEditor.onBlockMoved = self.onBlockMoved

        self.scale = 1
        self.installActions()

        self.initZOCP()

        self.nodes = {}
        self.pendingSubscribers = {}

        QTimer.singleShot(250, lambda: self.scene.invalidate())
开发者ID:z25,项目名称:pyZNodeEditor,代码行数:32,代码来源:zne.py

示例4: testFontInfo

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
 def testFontInfo(self):
     w = MyWidget()
     w._app = self.app
     w._info = None
     QTimer.singleShot(300, w.show)
     self.app.exec_()
     self.assert_(w._info)
开发者ID:Hasimir,项目名称:PySide,代码行数:9,代码来源:bug_750.py

示例5: __init__

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
  def __init__(self):

    global gEnableResourceMonitoring
    self.enableResourceMonitoring  = gEnableResourceMonitoring
    self.bar = hiero.ui.mainWindow().statusBar()

    self.updateMonitorIntervalMS = gUpdateIntervalMS # The monitor update time in milliseconds.
    self.timer = QTimer()
    self.timer.setSingleShot(False)
    self.timer.timeout.connect(self.updateStatusBar)

    self.currentDiskIOBytes = psutil.disk_io_counters().read_bytes
    self.currentNetworkBytesReceived = psutil.net_io_counters().bytes_recv

    # This observes the current pid (the App process id) via psutil, and reports back
    if self.enableResourceMonitoring:
      self.processHelper = PSUtilProcessWrapper()

    # The frameServer instance
    self.frameServerInstance = nukestudio.frameServer

    # Initialise the Status Bar
    self.setupUI()

    # We haven't started monitoring at this point
    self.isMonitoring = False

    # Begin monitoring after a few secs to give frame server time to start up properly
    QTimer.singleShot(gInitialDelayMS, self.startMonitoring)
开发者ID:Aeium,项目名称:dotStudio,代码行数:31,代码来源:statusbar.py

示例6: wait_for_signal

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
def wait_for_signal(signal, timeout=10000):
    """Waits the given signal to be emitted, or breaks after a timeout

    This context manager wraps a method of using a nested event loop to
    wait for a signal, but additionally adds a timeout in case the signal
    was prematurely emitted (in which case we will never catch it) or if
    there is some kind of error and the signal is never emitted.

    This context manager used here is inspired by code from a blob by John
    Reaver, of which an archive can be found here:

    https://web.archive.org/web/20160126155634/http://jdreaver.com/
    posts/2014-07-03-waiting-for-signals-pyside-pyqt.html
    """
    loop = QEventLoop()

    # When the signal is caught, the loop will break
    signal.connect(loop.quit)

    # The content in the context manager will now be executed
    # The timeout doesn't start until this block is finished, so make sure
    # there is no blocking calls in the with block.
    yield

    if timeout is not None:  # Not False as possible 0ms timeout would be False
        QTimer.singleShot(timeout, loop.quit)
    loop.exec_()
开发者ID:jepayne1138,项目名称:QtPDFPrinter,代码行数:29,代码来源:converter.py

示例7: wc

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
def wc(stream_update=None, object_transfer=None):
    """
    Connect to the woodchuck server and initialize any state.

    stream_update is a function that is passed two arguments: an
    account identifier and the name of the stream to update (e.g.,
    'HomeTimeline').

    object_transfer is a function that is passed three arguments: an
    account identifier, a name of the stream and the post to transfer.

    If channel_update and episode_download are None, then Woodchuck
    upcalls will be disabled.
    """
    global _w
    if _w is not None:
        return _w

    _w = mywoodchuck(stream_update, object_transfer)

    if not _w.available():
        logging.info("Woodchuck support disabled: unable to contact Woodchuck server.")
        print "Woodchuck support disabled: unable to contact Woodchuck server."
        return _w

    logging.info("Woodchuck appears to be available.")

    if stream_update is not None:
        QTimer.singleShot(10 * 1000, _w.synchronize_config)

    return _w
开发者ID:khertan,项目名称:Khweeteur,代码行数:33,代码来源:wc.py

示例8: __init__

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
    def __init__(self, parent=None):
        super(MaeBird, self).__init__(parent)
        
        self.models = ModelFactory()

        self.table = None
        self.languages = {'perimary': 'Fin', 'secondary': 'Eng', 
                         'tertiary': 'Swe'}
        
        self.dbtype = __DB__
        self.dbfile = None
        self.db = None
        
        self.matches = []
        self.currentsearchitem = 0
        
        self.fullscreen = False
        self.setupUi(self)
        
        self.setWindowTitle(__APPNAME__ + ' ' + __VERSION__)
        
        # TODO: loading settings should be moved to a separate method
        settings = QSettings()
        
        # Set up logging
        loggingdir = settings.value("Logging/loggingDir")
        if loggingdir is None:
            loggingdir = __USER_DATA_DIR__
        self.logger = Logger('root', loggingdir=loggingdir)
        if settings.value("Settings/debugging"):
            self.logger.debugging = int(settings.value("Settings/debugging"))
            self.logger.debug('Logging initialized')
        
        # Try to load previous session
        if settings.value("Settings/saveSettings"):
            self.saveSettings = int(settings.value("Settings/saveSettings"))
        else:
            self.saveSettings = 1
                      
        if self.saveSettings:
            QTimer.singleShot(0, self.load_initial_data)
            #QTimer.singleShot(0, self.load_initial_model)
        
        self.header = self.tableView.horizontalHeader()
        self.header.sectionDoubleClicked.connect(self.sort_table)
        
        self.search.textEdited.connect(self.update_ui)
        self.search.setFocus()
        self.searchNextButton.clicked.connect(self.update_ui)
        self.searchPrevButton.clicked.connect(self.update_ui)
        
        self.tableView.pressed.connect(self.update_ui)
        
        self.tableView.doubleClicked.connect(
                    lambda: self.handle_observation(ObservationDialog.SHOW))
        self.addButton.clicked.connect(
                    lambda: self.handle_observation(ObservationDialog.ADD))
        self.deleteButton.clicked.connect(
                    lambda: self.handle_observation(ObservationDialog.DELETE))
开发者ID:jlehtoma,项目名称:MaeBird,代码行数:61,代码来源:main.py

示例9: testSetPenWithPenStyleEnum

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
 def testSetPenWithPenStyleEnum(self):
     """Calls QPainter.setPen with both enum and integer. Bug #511."""
     w = Painting()
     w.show()
     QTimer.singleShot(1000, self.app.quit)
     self.app.exec_()
     self.assertEqual(w.penFromEnum.style(), Qt.NoPen)
     self.assertEqual(w.penFromInteger.style(), Qt.SolidLine)
开发者ID:holmeschiu,项目名称:PySide,代码行数:10,代码来源:qpen_test.py

示例10: connectToExistingApp

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
 def connectToExistingApp(self):
     if len(sys.argv)>1 and sys.argv[1] is not None:
         self.m_socket.write(sys.argv[1])
         self.m_socket.bytesWritten.connect(self.quit)
     else:
         QMessageBox.warning(None, self.tr("Already running"), self.tr("The program is already running."))
         # Quit application in 250 ms
         QTimer.singleShot(250, self.quit)
开发者ID:ptphp,项目名称:ptgui,代码行数:10,代码来源:qSingleApplication.py

示例11: discover

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
    def discover(self):
        mwin = WaitForServiceProvider()
        mwin.show()

        QTimer.singleShot(1000, self.zdiscover)
        self.app.exec_()

        return self.url
开发者ID:gonicus,项目名称:clacks,代码行数:10,代码来源:qt_gui.py

示例12: onLoadFinished

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
 def onLoadFinished(self, result):
     global functionID
     self.assertEqual(self._functionID, functionID)
     if self._functionID == (len(FUNCTIONS_LIST) - 1):
         QTimer.singleShot(300, self.app.quit)
     else:
         #new test
         self._functionID += 1
         self.createInstance()
开发者ID:Hasimir,项目名称:PySide,代码行数:11,代码来源:bug_959.py

示例13: del_

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
 def del_(self):
     """Explicitly called destructor.
     Removes widget from the qpart
     """
     self._closeIfNotUpdatedTimer.stop()
     self._qpart.removeEventFilter(self)
     self._qpart.cursorPositionChanged.disconnect(self._onCursorPositionChanged)
     
     # if object is deleted synchronously, Qt crashes after it on events handling
     QTimer.singleShot(0, lambda: self.setParent(None))
开发者ID:Darriall,项目名称:editor,代码行数:12,代码来源:completer.py

示例14: setUp

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
        def setUp(self, timeout=100):
            '''Setups this Application.

            timeout - timeout in milisseconds'''
            global _timed_instance
            if _timed_instance is None:
                _timed_instance = QApplication([])

            self.app = _timed_instance
            QTimer.singleShot(timeout, self.app.quit)
开发者ID:KwadroNaut,项目名称:bitmask_client,代码行数:12,代码来源:pyside_tests_helper.py

示例15: _check_download

# 需要导入模块: from PySide.QtCore import QTimer [as 别名]
# 或者: from PySide.QtCore.QTimer import singleShot [as 别名]
 def _check_download():
     if entry.stop_download:
         handler.remove()
         entry.remove_file()
     self._update_pause_state(entry, handler)
     if handler.finished or entry.stop_download:
         self.downloaded.emit(entry, tick)
     else:
         QTimer.singleShot(100, _check_download)
     self.download_progress.emit(entry, handler.percent)
开发者ID:xRayDev,项目名称:series_list,代码行数:12,代码来源:downloads.py


注:本文中的PySide.QtCore.QTimer.singleShot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。