Exemplo n.º 1
0
  def __init__(self):
    qt.QObject.__init__(self)

    self.idleTimer = qt.QTimer(self)
    self.idleTimer.setSingleShot(True)
    self.idling = False
    self.timeSinceLastEvent = vtk.vtkTimerLog.GetUniversalTime()
Exemplo n.º 2
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)
        self.__pid = -1
        self.__cmd = None
        self.__userHost = None
        self.__stringFont = None
        self.__startIdle = qt.QTimer(self)
        qt.QObject.connect(self.__startIdle, qt.SIGNAL("timeout()"),
                           self.__idleRun)

        self.__container = qttools.QtXEmbedContainer(self)
        qt.QObject.connect(self.__container, qt.SIGNAL("clientClosed()"),
                           self.run)
        layout = qt.QVBoxLayout(self)
        layout.addWidget(self.__container)
        self.__container.setSizePolicy(qt.QSizePolicy.Expanding,
                                       qt.QSizePolicy.Expanding)
        self.__container.setSizeIncrement(1, 12)
        qt.QObject.connect(qt.qApp, qt.SIGNAL("aboutToQuit()"),
                           self.__killTerm)

        ####### PROPERTY #######
        self.addProperty("command", "string", "")
        self.addProperty("users@host", "string", "")
        self.addProperty("font", "string", "")
Exemplo n.º 3
0
    def eventFilter(self, ob, ev):

        if (hasattr(plplot, "semaphore")):
            if (plplot.owner is not self):
                plplot.semaphore.acquire()
                plplot.owner = self
        plplot.plsstrm(self.ipls)

        print " intercettato event ", ev.type()

        if (self.count == 1):
            self.Init()
            self.is_created = 1
            self.count = 2

        if (self.is_created):
            print " EVENTO = ", ev.type(), " ", qt.QEvent.Resize
            if (ev.type() == qt.QEvent.Paint):
                plplot_widget.plexpose()
                timer = qt.QTimer(self)
                self.connect(timer, qt.SIGNAL("timeout()"), self.exposeQUIET)
                timer.start(0, 1)
                return 1
            elif (ev.type() == qt.QEvent.Resize):
                print " RESIZE "
                self.resizeQUIET()
                return 1
            else:
                if (ev.type() == 12):
                    plplot_widget.plexpose()
        if (hasattr(plplot, "semaphore")):
            plplot.semaphore.release()

        return 0
Exemplo n.º 4
0
def main():
    global timer
    timer = qt.QTimer()
    timer.connect(timer, qt.SIGNAL("timeout()"), msg)
    scribus.messageBox("Scribus - Python Timer",
                       "About to start a 5 second timer", scribus.BUTTON_OK)
    timer.start(5 * 1000, True)
Exemplo n.º 5
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.firstTime = True

        self.addProperty('mnemonic', 'string', '')

        # Hadrware Object.
        self.hwo = None

        # electrometer
        self.elec = None
        self._name = None
        self._number = None

        # Electrometer Widget.
        self.elecWidget = None

        qt.QHBoxLayout(self, 0, 0)

        self.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.Fixed)
        """
        GRAPHICAL INTERFACE
        """
        self.buildInterface()
        self.__idle = qt.QTimer()
        self.connect(self.__idle, qt.SIGNAL("timeout()"), self.__lastInit)
Exemplo n.º 6
0
 def beginReplay(self, sequenceBrowserNode, endFrameIndex, tumorModelNode,
                 leftViewNode, rightViewNode, tableNode):
     self.endFrameIndex = endFrameIndex
     self.sequenceBrowserNode = sequenceBrowserNode
     self.sequenceBrowserNode.SetPlaybackRateFps(9.5)
     self.sequenceBrowserNode.SetPlaybackActive(True)
     self.leftViewNode = leftViewNode
     self.rightViewNode = rightViewNode
     self.tumorModelNode = tumorModelNode
     self.tableNode = tableNode
     self.tableColumnIndices = vtk.vtkIntArray()
     self.tableColumnIndices.SetName("Index")
     self.tableColumnTime = vtk.vtkDoubleArray()
     self.tableColumnTime.SetName("Time (s)")
     self.tableColumnLeftMinimumX = vtk.vtkDoubleArray()
     self.tableColumnLeftMinimumX.SetName("Left View Minimum X Extent")
     self.tableColumnLeftMaximumX = vtk.vtkDoubleArray()
     self.tableColumnLeftMaximumX.SetName("Left View Maximum X Extent")
     self.tableColumnLeftMinimumY = vtk.vtkDoubleArray()
     self.tableColumnLeftMinimumY.SetName("Left View Minimum Y Extent")
     self.tableColumnLeftMaximumY = vtk.vtkDoubleArray()
     self.tableColumnLeftMaximumY.SetName("Left View Maximum Y Extent")
     self.tableColumnRightMinimumX = vtk.vtkDoubleArray()
     self.tableColumnRightMinimumX.SetName("Right View Minimum X Extent")
     self.tableColumnRightMaximumX = vtk.vtkDoubleArray()
     self.tableColumnRightMaximumX.SetName("Right View Maximum X Extent")
     self.tableColumnRightMinimumY = vtk.vtkDoubleArray()
     self.tableColumnRightMinimumY.SetName("Right View Minimum Y Extent")
     self.tableColumnRightMaximumY = vtk.vtkDoubleArray()
     self.tableColumnRightMaximumY.SetName("Right View Maximum Y Extent")
     self.timer = qt.QTimer()
     self.timer.setSingleShot(False)
     self.timer.setInterval(100)  # Once every 10th of a second
     self.timer.connect('timeout()', self.onTimeout)
     self.timer.start()
Exemplo n.º 7
0
    def __init__(self, parent=None):
        self.testingServer = None

        # state management for compressing events
        # - each time an update is requested, start the singleShot timer
        # - if the update is requested before the timeout, the call to timer.start() resets it
        # - the actual update only happens when the the full time elapses since the last request
        self.updateRecentActivityTimer = qt.QTimer()
        self.updateRecentActivityTimer.setSingleShot(True)
        self.updateRecentActivityTimer.interval = 500
        self.updateRecentActivityTimer.connect(
            'timeout()', self.onUpateRecentActivityRequestTimeout)

        if not parent:
            self.parent = slicer.qMRMLWidget()
            self.parent.setLayout(qt.QVBoxLayout())
            self.parent.setMRMLScene(slicer.mrmlScene)
            self.layout = self.parent.layout()
            self.setup()
            self.parent.show()
        else:
            self.parent = parent
            self.layout = parent.layout()

        globals()['d'] = self
    def __init__(self):
        self.verbose = False
        # when python is initialized inside slicer there is no argv
        # so create a fake one if needed
        try:
            argv0 = sys.argv[0]
        except AttributeError:
            sys.argv = []
            sys.argv.append("")
        self.tcl = tkinter.Tcl()
        self.tcl.createcommand("py_eval", self.py_eval)
        self.tcl.createcommand("py_package", self.py_package)
        self.tcl.createcommand("py_type", self.py_type)
        self.tcl.createcommand("py_del", self.py_del)
        self.tcl.createcommand("py_puts", self.py_puts)
        self.tcl.createcommand("py_after", self.py_after)
        self.tcl.createcommand("py_vtkInstanceName", self.py_vtkInstanceName)

        self.timer = qt.QTimer()
        self.timer.setSingleShot(True)
        self.timer.setInterval(0)
        self.timer.connect('timeout()', self.after_callback)

        if sys.platform == 'win32':
            # Update environment variables set by application - unlike other platforms,
            # on windows this does not happen automatically so we do it here
            # Note that subsequent env changes will not be reflected
            for key in os.environ.keys():
                self.tcl_putenv(key, os.environ[key])

        # This path is Slicer-specific
        self.tcl.eval('source "%s/bin/Python/tpycl/tpycl.tcl"' %
                      slicer.app.slicerHome)
Exemplo n.º 9
0
    def __init__(self, scriptedEffect):
        # Indicates that effect does not operate on one segment, but the whole segmentation.
        # This means that while this effect is active, no segment can be selected
        scriptedEffect.perSegment = False
        AbstractScriptedSegmentEditorEffect.__init__(self, scriptedEffect)

        self.minimumNumberOfSegments = 1
        self.clippedMasterImageDataRequired = False

        # Stores merged labelmap image geometry (voxel data is not allocated)
        self.mergedLabelmapGeometryImage = None
        self.selectedSegmentIds = None
        self.selectedSegmentModifiedTimes = {
        }  # map from segment ID to ModifiedTime
        self.clippedMasterImageData = None

        # Observation for auto-update
        self.observedSegmentation = None
        self.segmentationNodeObserverTags = []

        # Wait this much after the last modified event before starting aut-update:
        autoUpdateDelaySec = 1.0
        self.delayedAutoUpdateTimer = qt.QTimer()
        self.delayedAutoUpdateTimer.setSingleShot(True)
        self.delayedAutoUpdateTimer.interval = autoUpdateDelaySec * 1000
        self.delayedAutoUpdateTimer.connect('timeout()', self.onPreview)
Exemplo n.º 10
0
  def __init__(self, parent=None):
    ScriptedLoadableModuleLogic.__init__(self, parent)
    VTKObservationMixin.__init__(self)

    self.parameterNode = None

    self.timerTableColumnTypes = {}
    for name in self.timerTableColumnNames:
      if name == self.DURATION_COLUMN_NAME:
        self.timerTableColumnTypes[name] = 'double'
      else:
        self.timerTableColumnTypes[name] = 'string'

    self.editorNode = None
    self.userActivity = self.ACTIVITY_ACTIVE
    self.importInProgress = False
    self.closeInProgress = False

    slicer.util.moduleSelector().moduleSelected.connect(self.updateTable)
    self.addObserver(slicer.mrmlScene, slicer.mrmlScene.NodeAddedEvent, self.onNodeAdded)

    self.waitDetectionLastTimeout = vtk.vtkTimerLog.GetUniversalTime()
    self.waitDetectionTimer = qt.QTimer()
    self.waitDetectionTimer.setInterval(self.WAIT_TIMEOUT_SECONDS * 1000)
    self.waitDetectionTimer.setSingleShot(False)
    self.waitDetectionTimer.timeout.connect(self.onWaitDetectionTimer)

    self.screenshotEnabled = False
    self.autoRowCreationTimer = qt.QTimer()
    self.autoRowCreationTimer.setInterval(self.AUTO_ROW_CREATION_INTERVAL_SECONDS * 1000)
    self.autoRowCreationTimer.setSingleShot(False)
    self.autoRowCreationTimer.timeout.connect(self.onAutoRowCreationTimer)

    self.takeScreenshotTimer = qt.QTimer()
    self.takeScreenshotTimer.setInterval(1)
    self.takeScreenshotTimer.setSingleShot(True)
    self.takeScreenshotTimer.timeout.connect(self.onTakeScreenshot)

    self.idleDetectionEventFilter = IdleDetectionEventFilter()
    self.idleDetectionEventFilter.setInterval(self.IDLE_TIMEOUT_SECONDS * 1000)
    slicer.app.installEventFilter(self.idleDetectionEventFilter)
    self.idleDetectionEventFilter.idleStarted.connect(self.onIdleStarted)
    self.idleDetectionEventFilter.idleEnded.connect(self.onIdleEnded)

    self.getUserStatisticsTableNode()
    self.updateUserStatisticsTimers()
Exemplo n.º 11
0
    def __init__(self,
                 name,
                 attribute_name,
                 tangoname=None,
                 username=None,
                 polling=None,
                 timeout=10000,
                 **kwargs):
        ChannelObject.__init__(self, name, username, **kwargs)

        self.attributeName = attribute_name
        self.deviceName = tangoname
        self.device = None
        self.value = None
        self.polling = polling
        self.__connections = 0
        self.__value = None
        self.pollingTimer = None
        self.timeout = int(timeout)

        logging.getLogger("HWR").debug(
            "creating Tango attribute %s/%s, polling=%s, timeout=%d",
            self.deviceName,
            self.attributeName,
            polling,
            self.timeout,
        )

        try:
            self.device = PyTango.DeviceProxy(self.deviceName)
        except PyTango.DevFailed as traceback:
            last_error = traceback[-1]
            logging.getLogger("HWR").error("%s: %s", str(self.name()),
                                           last_error["desc"])
        else:
            try:
                self.device.ping()
            except PyTango.ConnectionFailed:
                self.device = None
                raise ConnectionError
            else:
                self.device.set_timeout_millis(self.timeout)

                if isinstance(polling, int):
                    self.pollingTimer = qt.QTimer()
                    self.pollingTimer.connect(self.pollingTimer,
                                              qt.SIGNAL("timeout()"),
                                              self.poll)
                    self.pollingTimer.start(polling)
                else:
                    if polling == "events":
                        # try to register event
                        try:
                            self.device.subscribe_event(
                                self.attributeName, PyTango.EventType.CHANGE,
                                self, [])
                        except PyTango.EventSystemFailed:
                            pass
Exemplo n.º 12
0
 def appendSendJob(self, string):
     """"""
     self._pending_send_jobs.append(Job(string))
     if not self._pending_send_job_timer:
         self._pending_send_job_timer = qt.QTimer()
         self._pending_send_job_timer.connect(self._pending_send_job_timer,
                                              qt.SIGNAL('timeout()'),
                                              self.doSendJobs)
     self._pending_send_job_timer.start(0)
Exemplo n.º 13
0
 def onStartClicked(self):
     if self.jobthread.running():
         qt.QMessageBox.information(self, "Error", "It's still running!")
         return
     self.edit.clear()
     self.timer = qt.QTimer(self, "Interval timer")
     self.connect(self.timer, qt.SIGNAL("timeout()"), self.onTimeout)
     self.timer.start(800, False)  # msec, sshot
     self.jobthread.start()
Exemplo n.º 14
0
    def __init__(self, parent=None, name=None, *args, **kw):
        # the current button
        self._ActiveButton = 0

        # private attributes
        self.__oldFocus = None
        self.__saveX = 0
        self.__saveY = 0
        self.__saveState = 0
        self.__connected = 0  # is QT->VTK connection done?

        # do special handling of some keywords:
        # stereo, rw

        stereo = 0

        if kw.has_key('stereo'):
            if kw['stereo']:
                stereo = 1
            del kw['stereo']

        rw = None

        if kw.has_key('rw'):
            rw = kw['rw']
            del kw['rw']

        # create qt-level widget
        # You cannot pass kw anymore, you'll a TypeError: keyword arguments are not supported
        # http://goldenspud.com/webrog/archives/2004/07/20/pyqt-platform-inconsistencies/
        apply(qt.QWidget.__init__, (self, parent, name) + args)

        if rw:  # user-supplied render window
            self._RenderWindow = rw
        else:
            self._RenderWindow = vtk.vtkRenderWindow()

        if stereo:  # stereo mode
            self._RenderWindow.StereoCapableWindowOn()
            self._RenderWindow.SetStereoTypeToCrystalEyes()

        self._Iren = vtk.vtkGenericRenderWindowInteractor()
        self._Iren.SetRenderWindow(self._RenderWindow)

        # do all the necessary qt setup
        self.setBackgroundMode(qt.Qt.NoBackground)
        self.setMouseTracking(1)  # get all mouse events
        self.setFocusPolicy(qt.QWidget.ClickFocus)
        if parent == None:
            self.show()

        self._Timer = qt.QTimer(self, 'timer handler')
        self.connect(self._Timer, qt.SIGNAL('timeout()'), self.TimerEvent)

        self._Iren.AddObserver('CreateTimerEvent', self.CreateTimer)
        self._Iren.AddObserver('DestroyTimerEvent', self.DestroyTimer)
Exemplo n.º 15
0
    def create(self):
        super().create()

        self.thresholdLabel = qt.QLabel("Threshold Range:", self.frame)
        self.thresholdLabel.setToolTip(
            "Set the range of the background values that should be labeled.")
        self.frame.layout().addWidget(self.thresholdLabel)
        self.widgets.append(self.thresholdLabel)
        self.threshold = ctk.ctkRangeWidget(self.frame)
        self.threshold.spinBoxAlignment = 0xff  # put enties on top
        self.threshold.singleStep = 0.01
        # set min/max based on current range
        success, lo, hi = self.getBackgroundScalarRange()
        if success:
            self.threshold.minimum, self.threshold.maximum = lo, hi
            self.threshold.singleStep = (hi - lo) / 1000.
        self.frame.layout().addWidget(self.threshold)
        self.widgets.append(self.threshold)

        self.useForPainting = qt.QPushButton("Use For Paint", self.frame)
        self.useForPainting.setToolTip(
            "Transfer the current threshold settings to be used for labeling operations such as Paint and Draw."
        )
        self.frame.layout().addWidget(self.useForPainting)
        self.widgets.append(self.useForPainting)

        self.apply = qt.QPushButton("Apply", self.frame)
        self.apply.objectName = self.__class__.__name__ + 'Apply'
        self.apply.setToolTip(
            "Apply current threshold settings to the label map.")
        self.frame.layout().addWidget(self.apply)
        self.widgets.append(self.apply)

        self.timer = qt.QTimer()
        self.previewState = 0
        self.previewStep = 1
        self.previewSteps = 5
        self.timer.start(200)

        self.connections.append((self.timer, 'timeout()', self.preview))
        self.connections.append(
            (self.useForPainting, 'clicked()', self.onUseForPainting))
        self.connections.append(
            (self.threshold, 'valuesChanged(double,double)',
             self.onThresholdValuesChanged))
        self.connections.append((self.apply, 'clicked()', self.onApply))

        HelpButton(
            self.frame,
            "Set labels based on threshold range.  Note: this replaces the current label map values."
        )

        # Add vertical spacer
        self.frame.layout().addStretch(1)
Exemplo n.º 16
0
  def setup(self):
    ScriptedLoadableModuleWidget.setup(self)
    self.logic = UserStatisticsLogic()

    # Load widget from .ui file (created by Qt Designer)
    uiWidget = slicer.util.loadUI(self.resourcePath('UI/UserStatistics.ui'))
    self.layout.addWidget(uiWidget)

    self.ui = slicer.util.childWidgetVariables(uiWidget)
    self.ui.tableNodeSelector.addAttribute("vtkMRMLTableNode", "UserStatistics.TableNode", "")
    self.ui.mergeTablesNodeSelector.addAttribute("vtkMRMLTableNode", "UserStatistics.TableNode", "")
    self.ui.userStatistics.setMRMLScene(slicer.mrmlScene)

    self.importInProgress = False
    self.sceneImportTimer = qt.QTimer()
    self.sceneImportTimer.setInterval(1)
    self.sceneImportTimer.setSingleShot(True)
    self.sceneClosedTimer = qt.QTimer()
    self.sceneClosedTimer.setInterval(1)
    self.sceneClosedTimer.setSingleShot(True)

    # Observers
    self.addObserver(slicer.mrmlScene, slicer.mrmlScene.StartCloseEvent, self.onSceneStartClose)
    self.addObserver(slicer.mrmlScene, slicer.mrmlScene.EndCloseEvent, self.onSceneEndClose)
    self.addObserver(slicer.mrmlScene, slicer.mrmlScene.StartImportEvent, self.onSceneStartImport)
    self.addObserver(slicer.mrmlScene, slicer.mrmlScene.EndImportEvent, self.onSceneEndImport)

    # Connections
    self.ui.enabledCheckBox.checked = self.logic.getUserStatisticsEnabled()
    self.ui.enabledCheckBox.stateChanged.connect(self.onUserStatisticsEnabledCheckboxChanged)
    self.ui.tableNodeSelector.nodeAddedByUser.connect(self.onNodeAddedByUser)
    self.ui.tableNodeSelector.currentNodeChanged.connect(self.onCurrentNodeChanged)
    self.ui.mergeTablesButton.clicked.connect(self.onMergeStatisticTablesClicked)
    self.ui.screenshotEnabledCheckbox.stateChanged.connect(self.onScreenshotEnabledChanged)
    self.ui.screenshotDirectoryButton.directoryChanged.connect(self.onScreenshotDirectoryChanged)
    self.sceneClosedTimer.timeout.connect(self.onSceneClosed)
    self.sceneImportTimer.timeout.connect(self.onSceneImport)

    # This will use createParameterNode with the provided default options
    self.setParameterNode(self.logic.getParameterNode())
    self.ui.mainWidget.setEnabled(self.logic.getUserStatisticsEnabled())
Exemplo n.º 17
0
  def setup(self):
    ScriptedLoadableModuleWidget.setup(self)

    # Load widget from .ui file (created by Qt Designer)
    uiWidget = slicer.util.loadUI(self.resourcePath('UI/LiverBiopsy.ui'))
    self.layout.addWidget(uiWidget)
    self.ui = slicer.util.childWidgetVariables(uiWidget)
    
    # Set up 
    self.setupCustomViews()
    
    self.calibrationErrorThresholdMm = 0.9
    
    self.logic = LiverBiopsyLogic()
    
    
    # Set up slicer scene
    self.setupScene()

    self.ui.fromProbeToUSFiducialWidget.setMRMLScene(slicer.mrmlScene)
    self.ui.toProbeToUSFiducialWidget.setMRMLScene(slicer.mrmlScene)
    self.ui.fromCTToReferenceFiducialWidget.setMRMLScene(slicer.mrmlScene)
    self.ui.toCTToReferenceFiducialWidget.setMRMLScene(slicer.mrmlScene)

    # connections
    
    self.ui.saveButton.connect('clicked(bool)', self.onSaveScene)
    self.ui.connectPLUSButton.connect('clicked(bool)', self.onConnectPLUS)
    self.ui.layoutComboBox.connect('activated(const QString &)', self.onChangeLayout)
    self.ui.needleSpinCalibrationButton.connect('clicked(bool)', self.needleSpinCalibration)
    self.ui.needlePivotCalibrationButton.connect('clicked(bool)', self.needlePivotCalibration)
    self.ui.stylusSpinCalibrationButton.connect('clicked(bool)', self.stylusSpinCalibration)
    self.ui.stylusPivotCalibrationButton.connect('clicked(bool)', self.stylusPivotCalibration)
    self.ui.USCalibrationButton.connect('clicked(bool)', self.USCalibration)
    self.ui.initialCTRegistrationButton.connect('clicked(bool)', self.initialCTRegistration)
    self.ui.placeToCTToReferenceFiducialButton.connect('clicked(bool)', self.placeToCTToReferenceFiducial)
    self.ui.freezeUltrasoundButton.connect('clicked(bool)', self.onFreezeUltrasound)

    self.toolCalibrationTimer = qt.QTimer()
    self.toolCalibrationTimer.setInterval(500)
    self.toolCalibrationTimer.connect('timeout()', self.toolCalibrationTimeout)

    self.ui.fromProbeToUSFiducialWidget.setCurrentNode(slicer.util.getFirstNodeByName('FromProbeToUSFiducialNode', className='vtkMRMLMarkupsFiducialNode'))
    self.ui.fromProbeToUSFiducialWidget.setNodeColor(qt.QColor(207,26,0,255))
    self.ui.toProbeToUSFiducialWidget.setCurrentNode(slicer.util.getFirstNodeByName('ToProbeToUSFiducialNode', className='vtkMRMLMarkupsFiducialNode'))
    self.ui.toProbeToUSFiducialWidget.setNodeColor(qt.QColor(103,0,225,255))
    
    self.ui.fromCTToReferenceFiducialWidget.setCurrentNode(slicer.util.getFirstNodeByName('FromCTToReferenceFiducials', className='vtkMRMLMarkupsFiducialNode'))
    self.ui.fromCTToReferenceFiducialWidget.setNodeColor(qt.QColor(85,255,0,255))
    self.ui.toCTToReferenceFiducialWidget.setCurrentNode(slicer.util.getFirstNodeByName('ToCTToReferenceFiducials', className='vtkMRMLMarkupsFiducialNode'))
    self.ui.toCTToReferenceFiducialWidget.setNodeColor(qt.QColor(255,170,0,255))
    
    self.ui.testButton.connect('clicked(bool)', self.onTestFunction)
Exemplo n.º 18
0
 def _singleShot(msec, receiverOrCallable, member=None):
     """Calls either a python function or a slot after a given time interval."""
     # Add 'moduleManager' as parent to prevent the premature destruction of the timer.
     # Doing so, we ensure that the QTimer will be deleted before PythonQt is cleanup.
     # Indeed, the moduleManager is destroyed before the pythonManager.
     timer = qt.QTimer(slicer.app.moduleManager())
     timer.setSingleShot(True)
     if callable(receiverOrCallable):
         timer.connect("timeout()", receiverOrCallable)
     else:
         timer.connect("timeout()", receiverOrCallable, member)
     timer.start(msec)
Exemplo n.º 19
0
    def init(self):

       if self.device is not None:
           print "initializing camera object"

           self.pollingTimer = qt.QTimer()
           self.pollingTimer.connect(self.pollingTimer, qt.SIGNAL("timeout()"), self.poll)

           if self.getProperty("interval"):
               self.pollInterval = self.getProperty("interval")
   
           self.getChannelObject('UdiffVersion').connectSignal('update', self.udiffVersionChanged)
Exemplo n.º 20
0
 def rock(self):
     if not self.rocking:
         self.rockTimer = None
         self.fadeSlider.value = 0.5
     if self.rocking:
         if not self.rockTimer:
             self.rockTimer = qt.QTimer()
             self.rockTimer.start(50)
             self.rockTimer.connect('timeout()', self.rock)
         import math
         self.fadeSlider.value = 0.5 + math.sin(self.rockCount / 10.) / 2.
         self.rockCount += 1
Exemplo n.º 21
0
 def __init__(self, parent=None):
     ScriptedLoadableModuleWidget.__init__(self, parent)
     self.cameraNode = None
     self.cameraNodeObserverTag = None
     self.cameraObserverTag = None
     # Flythough variables
     self.transform = None
     self.path = None
     self.camera = None
     self.skip = 0
     self.timer = qt.QTimer()
     self.timer.setInterval(20)
     self.timer.connect('timeout()', self.flyToNext)
Exemplo n.º 22
0
    def connectNotify(self, signal):
        self.__nb_connections += 1

        if self.__nb_connections == 1:
            logging.getLogger("HWR").debug(
                "%s: starting polling on serial line Device Server %s",
                self.name(), self.tacoName())

            # start polling
            self.__timer = qt.QTimer(None)
            qt.QObject.connect(self.__timer, qt.SIGNAL("timeout()"),
                               self.readChannels)
            self.__timer.start(self.interval)
Exemplo n.º 23
0
 def flicker(self):
     if not self.flickering:
         self.flickerTimer = None
         self.fadeSlider.value = 0.5
     if self.flickering:
         if not self.flickerTimer:
             if self.fadeSlider.value == 0.5:
                 self.fadeSlider.value = 0.25
             self.flickerTimer = qt.QTimer()
             self.flickerTimer.start(300)
             self.flickerTimer.connect('timeout()', self.flicker)
         import math
         self.fadeSlider.value = 1.0 - self.fadeSlider.value
    def __init__(self, scriptedEffect):
        AbstractScriptedSegmentEditorEffect.__init__(self, scriptedEffect)
        scriptedEffect.name = 'Threshold'

        # Effect-specific members
        self.timer = qt.QTimer()
        self.previewState = 0
        self.previewStep = 1
        self.previewSteps = 5
        self.timer.connect('timeout()', self.preview)

        self.previewPipelines = {}
        self.setupPreviewDisplay()
Exemplo n.º 25
0
    def mainloop(self):
        import qt, sys
        if qt.QApplication.startingUp():
            a = qt.QApplication.QApplication(sys.argv)
        self.timer = qt.QTimer()
        qt.QObject.connect(self.timer, qt.SIGNAL('timeout()'), self.on_timer)

        self.start()
        self.timer.start(self.TIMEOUT, True)
        while True:
            if self.IP._kill: break
            qt.qApp.exec_loop()
        self.join()
Exemplo n.º 26
0
 def __init__(self,*args) :
     BlissWidget.__init__(self,*args)
     self.__view = None
     self.__drawing = None
     self.__line = None
     self.__pointSelected = None
     self.__graphs = None
     self.__refreshTimer = qt.QTimer(self)
     qt.QObject.connect(self.__refreshTimer,qt.SIGNAL('timeout()'),self.__refreshGraph)
     # Properties
                     ####### SIGNAL #######
     self.defineSignal('getView',())
     self.defineSignal('getImage',())
     self.setFixedSize(0,0)
Exemplo n.º 27
0
    def __init__(self):
        super(StatusDisplayWidget, self).__init__(None)

        self.setMinimumHeight(200)
        self.setStyleSheet("background-color:black;")

        self.margin_x = 10
        self.margin_y = 10
        self.inner_margin_x = 5
        self.inner_margin_y = 5
        self.font_h = 12
        self.font_w = 8
        self.led_r_h = 10
        self.led_r_w = 10
        self.led_intv_x = 32
        self.name_w = 160

        self.color_fg_base = qt.QColor(140, 140, 140)
        self.color_fg_high = qt.QColor(240, 240, 240)
        self.color_fg_low = qt.QColor(100, 100, 100)
        self.color_fg_act = qt.QColor(50, 255, 50)
        self.color_fg_war = qt.QColor(255, 255, 50)
        self.color_fg_err = qt.QColor(255, 50, 50)

        self.pen_fg_base_frame = qt.QPen(self.color_fg_base, 2)
        self.pen_fg_base = qt.QPen(self.color_fg_base, 2)
        self.pen_fg_high = qt.QPen(self.color_fg_high, 2)
        self.pen_fg_act = qt.QPen(self.color_fg_act, 2)
        self.pen_fg_on = qt.QPen(self.color_fg_high, 2)
        self.pen_fg_off = qt.QPen(self.color_fg_low, 2)

        self.pen_led_on = qt.QPen(self.color_fg_high, 2)
        self.pen_led_off = qt.QPen(self.color_fg_low, 1)
        self.pen_led_rcv = qt.QPen(self.color_fg_act, 2)
        self.pen_led_war = qt.QPen(self.color_fg_war, 2)
        self.pen_led_err = qt.QPen(self.color_fg_err, 2)

        self.connector_box_h = self.font_h + self.inner_margin_y * 2
        self.connector0_text_x = self.margin_x + self.inner_margin_x * 2 + self.name_w
        self.connector1_text_x = self.inner_margin_x * 3 + self.name_w
        self.connector_text_y = self.margin_y + self.inner_margin_y + self.font_h
        self.catheter_base_x = self.margin_x + self.inner_margin_x + self.name_w + self.inner_margin_x
        self.catheter_base_y = self.margin_y + self.font_h + self.inner_margin_y * 4
        self.catheter_row_h = self.led_r_h * 2 + self.inner_margin_y

        self.repaintTimer = qt.QTimer()

        # MRTrackingIGTLConnector
        self.connectors = []
        self.catheters = None
 def __init__(self):
     # Create the queue
     self.queue = Queue.Queue()
     # Set up the GUI part
     self.gui = GuiPart(self.queue, self.endApplication)
     self.gui.show()
     # A timer to periodically call periodicCall
     self.timer = qt.QTimer()
     qt.QObject.connect(self.timer, qt.SIGNAL("timeout()"),
                        self.periodicCall)
     # Start the timer -- this replaces the initial call to periodicCall
     self.timer.start(200)
     # Set up the thread to do asynchronous I/O
     # More can be made if necessary
     self.running = True
     self.thread1 = threading.Thread(target=self.workerThread1)
     self.thread1.start()
Exemplo n.º 29
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)
        self.__pid = -1
        self.__startIdle = qt.QTimer(self)
        qt.QObject.connect(self.__startIdle, qt.SIGNAL('timeout()'),
                           self.__idleRun)

        self.__container = qttools.QtXEmbedContainer(self)
        qt.QObject.connect(self.__container, qt.SIGNAL('clientClosed()'),
                           self.run)
        layout = qt.QVBoxLayout(self)
        layout.addWidget(self.__container)
        self.__container.setSizePolicy(qt.QSizePolicy.Expanding,
                                       qt.QSizePolicy.Expanding)

        qt.QObject.connect(qt.qApp, qt.SIGNAL('aboutToQuit()'),
                           self.__killOxidis)
Exemplo n.º 30
0
    def poll(self):
        try:
	   value = self.device.read_attribute(self.attributeName).value
        except:
           logging.getLogger("HWR").exception("%s: could not poll attribute %s", str(self.name()), self.attributeName)

           self.pollingTimer.stop()
           if not hasattr(self, "_statePollingTimer"):
             self._statePollingTimer = qt.QTimer()
             self._statePollingTimer.connect(self._statePollingTimer, qt.SIGNAL("timeout()"), self.statePolling)
           self.device.set_timeout_millis(50)
           self._statePollingTimer.start(5000)
           value = None
           self.emit("update", (None, ))
        else:
           if value != self.value:
              self.update(value)