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


Python QtCore.QTimer方法代码示例

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


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

示例1: shutdown

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def shutdown(self, *args):
        global bitmaskd
        if self.closing:
            return
        self.closing = True

        bitmaskd.join()
        terminate(pid)
        cleanup()
        print('[bitmask] shutting down gui...')

        try:
            self.stop()
            try:
                global pixbrowser
                pixbrowser.stop()
                del pixbrowser
            except:
                pass
            QtCore.QTimer.singleShot(0, qApp.deleteLater)

        except Exception as ex:
            print('exception catched: %r' % ex)
            sys.exit(1) 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:26,代码来源:app.py

示例2: __init__

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def __init__(self):
        super(a2p_ConstraintPanel,self).__init__()
        self.resize(200,250)
        cc = a2p_ConstraintCollection(None)
        self.setWidget(cc)
        self.setWindowTitle("Constraint Tools")
        #
        mw = FreeCADGui.getMainWindow()
        mw.addDockWidget(QtCore.Qt.RightDockWidgetArea,self)
        #
        self.setFloating(True)
        self.activateWindow()
        self.setAllowedAreas(QtCore.Qt.NoDockWidgetArea)
        self.move(getMoveDistToStoredPosition(self))

        a2plib.setConstraintDialogRef(self)
        #
        self.timer = QtCore.QTimer()
        QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.onTimer)
        self.timer.start(100) 
开发者ID:kbwbe,项目名称:A2plus,代码行数:22,代码来源:a2p_constraintDialog.py

示例3: __init__

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def __init__(self):
        self._attached = False
        self.timer = QtCore.QTimer()
        self.timer.setSingleShot(True)
        self.timer.timeout.connect(self.onTimer)
        self.cmds = []
        self.elements = dict()
        self.attach()

        # Check for SoFCSwitch to see if we are running in a version of FC that
        # actually supports ShowSelectionOnTop.
        if coin.SoType.fromName("SoFCSwitch").isBad():
            self.viewParam = None
        else:
            self.viewParam = FreeCAD.ParamGet('User parameter:BaseApp/Preferences/View') 
开发者ID:realthunder,项目名称:FreeCAD_assembly3,代码行数:17,代码来源:gui.py

示例4: _handle_kill

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def _handle_kill(*args, **kw):
    global pixbrowser
    global closing
    if closing:
        sys.exit()
    win = kw.get('win')
    if win:
        win.user_closed = True
        QtCore.QTimer.singleShot(0, win.close)
    if pixbrowser:
        QtCore.QTimer.singleShot(0, pixbrowser.close)
    closing = True 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:14,代码来源:app.py

示例5: launch_gui

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def launch_gui(with_window=True):
    global qApp
    global browser

    if IS_WIN:
        freeze_support()

    launch_backend()
    qApp = QApplication([])
    try:
        browser = BrowserWindow(None)
    except NoAuthTokenError as e:
        print('ERROR: ' + e.message)
        sys.exit(1)

    browser.setupSysTray()

    qApp.setQuitOnLastWindowClosed(True)
    qApp.lastWindowClosed.connect(browser.shutdown)

    signal.signal(
        signal.SIGINT,
        partial(_handle_kill, win=browser))

    # Avoid code to get stuck inside c++ loop, returning control
    # to python land.
    timer = QtCore.QTimer()
    timer.timeout.connect(lambda: None)
    timer.start(500)

    if with_window:
        browser.show()

    sys.exit(qApp.exec_()) 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:36,代码来源:app.py

示例6: Activated

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def Activated(self):
        doc = FreeCAD.activeDocument()
        selection = [s for s in FreeCADGui.Selection.getSelectionEx() if s.Document == doc ]
        self.partMover = PartMover(
            FreeCADGui.activeDocument().activeView(),
            duplicateImportedPart(selection[0].Object),
            deleteOnEscape = True
            )
        self.timer = QtCore.QTimer()
        QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.onTimer)
        self.timer.start( 100 ) 
开发者ID:kbwbe,项目名称:A2plus,代码行数:13,代码来源:a2p_importpart.py

示例7: Activated

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def Activated(self):
        if FreeCADGui.ActiveDocument == None:
            FreeCAD.newDocument()
        view = FreeCADGui.activeDocument().activeView()
        #filename, filetype = QtGui.QFileDialog.getOpenFileName(
        #    QtGui.QApplication.activeWindow(),
        #    "Select FreeCAD document to import part from",
        #    "",# "" is the default, os.path.dirname(FreeCAD.ActiveDocument.FileName),
        #    "FreeCAD Document (*.fcstd)"
        #    )
        dialog = QtGui.QFileDialog(
            QtGui.QApplication.activeWindow(),
            "Select FreeCAD document to import part from"
            )
        dialog.setNameFilter("Supported Formats (*.FCStd *.brep *.brp *.imp *.iges *.igs *.obj *.step *.stp);;All files (*.*)")
        if dialog.exec_():
            filename = dialog.selectedFiles()[0]
        else:
            return
        importedObject = importPart( filename )
        FreeCAD.ActiveDocument.recompute()
        if not importedObject.fixedPosition: #will be true for the first imported part
            PartMover( view, importedObject )
        else:
            from PySide import QtCore
            self.timer = QtCore.QTimer()
            QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.GuiViewFit)
            self.timer.start( 200 ) #0.2 seconds 
开发者ID:hamish2014,项目名称:FreeCAD_assembly2,代码行数:30,代码来源:__init__.py

示例8: _startAnimation

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def _startAnimation(self, degreesOfFreedomToAnimate):
        frames_per_DOF =  self.form.spinBox_frames_per_DOF.value()
        ms_per_frame = self.form.spinBox_ms_per_frame.value()
        rotationAmplification = self.form.doubleSpinBox_rotMag.value()
        linearDispAmplification = self.form.doubleSpinBox_linMag.value()
        if len(self.constraintSystem.degreesOfFreedom) > 0:
            moduleVars['animation'] = AnimateDOF(self.constraintSystem, degreesOfFreedomToAnimate, ms_per_frame, frames_per_DOF, rotationAmplification, linearDispAmplification)
            #moduleVars['animation'] assignment required to protect the QTimer from the garbage collector
        else:
            FreeCAD.Console.PrintError('Aborting Animation! Constraint system has no degrees of freedom.')
            FreeCADGui.Control.closeDialog() 
开发者ID:hamish2014,项目名称:FreeCAD_assembly2,代码行数:13,代码来源:degreesOfFreedomAnimation.py

示例9: __init__

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def __init__(self, constraintSystem, degreesOfFreedomToAnimate, tick=50, framesPerDOF=40, rotationAmplification=1.0, linearDispAmplification=1.0):
        self.constraintSystem = constraintSystem
        self.degreesOfFreedomToAnimate = degreesOfFreedomToAnimate
        self.Y0 = numpy.array([ d.getValue() for d in degreesOfFreedomToAnimate] )
        self.X_before_animation = constraintSystem.variableManager.X.copy()
        self.framesPerDOF = framesPerDOF
        self.rotationAmplification = rotationAmplification
        self.linearDispAmplification = linearDispAmplification
        debugPrint(2,'beginning degrees of freedom animation')
        self.count = 0
        self.dof_count = 0
        self.updateAmplitude()
        self.timer = QtCore.QTimer()
        QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.renderFrame)
        self.timer.start( tick ) 
开发者ID:hamish2014,项目名称:FreeCAD_assembly2,代码行数:17,代码来源:degreesOfFreedomAnimation.py

示例10: __init__

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def __init__( self, X, variableManager, ms_per_frame=25, loop=False ):
        self.X = X
        self.variableManager = variableManager
        self.timer =  QtCore.QTimer()
        self.timer.timeout.connect( self.renderFrame )
        self.update_ms_per_frame( ms_per_frame )
        self.loop = loop 
开发者ID:hamish2014,项目名称:FreeCAD_assembly2,代码行数:9,代码来源:animate_constraint.py

示例11: CursorChangedEvent

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def CursorChangedEvent(self, obj, evt):
        """Called when the CursorChangedEvent fires on the render window."""
        logging.debug("In QVTKRenderWindowInteractor::CursorChangedEvent()")
        # This indirection is needed since when the event fires, the current
        # cursor is not yet set so we defer this by which time the current
        # cursor should have been set.
        QtCore.QTimer.singleShot(0, self.ShowCursor) 
开发者ID:mmolero,项目名称:pcloudpy,代码行数:9,代码来源:QVTKRenderWindowInteractor.py

示例12: __init__

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def __init__(self):
        # type: () -> None
        super(Timer, self).__init__()

        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.update_time)

        self.start_time = None 
开发者ID:wehr-lab,项目名称:autopilot,代码行数:10,代码来源:plots.py

示例13: __init__

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def __init__(self, obj, timeout=0):
        QtCore.QObject.__init__(self)
        self.obj = obj
        timer = QtCore.QTimer(self)
        timer.timeout.connect(self.update)
        timer.start(timeout) 
开发者ID:PySimulator,项目名称:PySimulator,代码行数:8,代码来源:plotWidget.py

示例14: _simulate

# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QTimer [as 别名]
def _simulate(self):
        ''' Starts the simulation of the current model with the current settings in the GUI '''
        self.models[self.currentNumberedModelName].integrationStatistics.finished = False
        self.run.setEnabled(False)
        self.closebutton.setEnabled(False)
        # Delete pluginData because new simulation will start
        self.models[self.currentNumberedModelName].pluginData.clear()
        self._setSettingsFromIntegratorControlGUI(self.currentNumberedModelName)
        # Close the corresponding result file to have write access
        self.models[self.currentNumberedModelName].integrationResults.close()
        try:
            os.remove(self.models[self.currentNumberedModelName].integrationResults.fileName)
        except:
            pass

        self.models[self.currentNumberedModelName].integrationResultFileSemaphore = threading.Semaphore()
        if hasattr(self.models[self.currentNumberedModelName], 'integrationResults'):
            self.models[self.currentNumberedModelName].integrationResults.fileName = ''

        # Define some variables before simulation can start
        self.models[self.currentNumberedModelName].integrationStatistics.cpuTime = None
        self.models[self.currentNumberedModelName].integrationStatistics.nTimeEvents = 0
        self.models[self.currentNumberedModelName].integrationStatistics.nStateEvents = 0
        self.models[self.currentNumberedModelName].integrationStatistics.nGridPoints = 0
        self.models[self.currentNumberedModelName].integrationStatistics.reachedTime = self.models[self.currentNumberedModelName].integrationSettings.startTime

        # Define Timers for result updates and simulation info updates
        self.updateData = QtCore.QTimer()
        self.updateData.timeout.connect(self.triggerdResultUpdate)

        self.updateSimulationInfo = QtCore.QTimer()
        self.updateSimulationInfo.timeout.connect(self.showSimulationInfo)

        # Define a new thread for the simulation task
        self._simThread = simulationThread(self)

        self._simThread.model = self.models[self.currentNumberedModelName]
        self._simThread.model.simulationStopRequest = False

        self.lastCurrentTime = self._simThread.model.integrationStatistics.reachedTime
        self.showSimulationInfo()

        # Start the timers and the simulation thread
        self._simThread.SimulationFinished = self.SimulationFinished
        self.updateData.start(1000)
        self.updateSimulationInfo.start(500)
        self._cpuStartTime = time.clock()
        self.stop.setEnabled(True)
        self._simThread.start(QtCore.QThread.LowPriority) 
开发者ID:PySimulator,项目名称:PySimulator,代码行数:51,代码来源:IntegratorControl.py


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