Python PySide.QtCore.QTimer() Examples
The following are 14
code examples of PySide.QtCore.QTimer().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PySide.QtCore
, or try the search function
.
![](https://www.programcreek.com/common/static/images/search.png)
Example #1
Source File: app.py From bitmask-dev with GNU General Public License v3.0 | 6 votes |
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)
Example #2
Source File: a2p_constraintDialog.py From A2plus with GNU Lesser General Public License v2.1 | 6 votes |
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)
Example #3
Source File: gui.py From FreeCAD_assembly3 with GNU General Public License v3.0 | 5 votes |
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')
Example #4
Source File: app.py From bitmask-dev with GNU General Public License v3.0 | 5 votes |
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
Example #5
Source File: app.py From bitmask-dev with GNU General Public License v3.0 | 5 votes |
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_())
Example #6
Source File: a2p_importpart.py From A2plus with GNU Lesser General Public License v2.1 | 5 votes |
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 )
Example #7
Source File: __init__.py From FreeCAD_assembly2 with GNU Lesser General Public License v2.1 | 5 votes |
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
Example #8
Source File: degreesOfFreedomAnimation.py From FreeCAD_assembly2 with GNU Lesser General Public License v2.1 | 5 votes |
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()
Example #9
Source File: degreesOfFreedomAnimation.py From FreeCAD_assembly2 with GNU Lesser General Public License v2.1 | 5 votes |
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 )
Example #10
Source File: animate_constraint.py From FreeCAD_assembly2 with GNU Lesser General Public License v2.1 | 5 votes |
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
Example #11
Source File: QVTKRenderWindowInteractor.py From pcloudpy with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #12
Source File: plots.py From autopilot with Mozilla Public License 2.0 | 5 votes |
def __init__(self): # type: () -> None super(Timer, self).__init__() self.timer = QtCore.QTimer() self.timer.timeout.connect(self.update_time) self.start_time = None
Example #13
Source File: plotWidget.py From PySimulator with GNU Lesser General Public License v3.0 | 5 votes |
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)
Example #14
Source File: IntegratorControl.py From PySimulator with GNU Lesser General Public License v3.0 | 4 votes |
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)