Beispiel #1
0
 def configValue(self):
     """
     build interface
     """
     if self.orientation is not None:
         self.buildInterface()
         
     """
     title
     """
     if self.title is not None and self.displayWidget is not None:
         title = self.title.replace(" ", " ")
         title = "<B>%s<B>"%title
         self.displayWidget.setTitle(title)
     
     """
     connect
     """
     if self.hwId is not None and self.varType is not None:
         if self.varType == "motor":
             self.connect(self.hwId, qt.PYSIGNAL('positionChanged'),
                          self.valueChanged)
             self.connect(self.hwId, qt.PYSIGNAL('stateChanged'),
                          self.stateChanged)
         else:
             self.connect(self.hwId, qt.PYSIGNAL('update'),
                          self.valueChanged)
Beispiel #2
0
    def propertyChanged(self, property, oldValue, newValue):
        if property == 'horizontal' or property == 'vertical':
            try:
                hardwareObject = self.getHardwareObject(newValue)
                if hardwareObject is None:
                    return
            except:
                return
            motors = []
            l = qt.QStringList()
            if not hardwareObject.hasObject('motors'):
                try:
                    l.append(hardwareObject.getMotorMnemonic())
                    motors.append(hardwareObject)
                except:
                    logging.getLogger().error(
                        'is not a motor device nor an Equipment : no <motors> section'
                    )
            else:
                ho = hardwareObject['motors']
                for motor in ho:
                    motors.append(motor)
                    l.append(motor.getMotorMnemonic())

            if property == 'horizontal':
                self._horizontalMotors = motors
            else:
                self._verticalMotors = motors

            self._setMotor(property, l)

        elif property == 'command':
            ho = self.getHardwareObject(newValue)
            if ho is not None:
                try:
                    spec_cmd = ho.getCommandObject(self.__commandName)
                except:
                    self._SpecCmd = None
                else:
                    self._SpecCmd = SpecCmd(ho, self.__commandName)

                if self._SpecCmd is not None:
                    startButton = self._widgetTree.child('__startScan')
                    startButton.setEnabled(True)
                    qt.QObject.connect(self._SpecCmd,
                                       qt.PYSIGNAL("commandReplyArrived"),
                                       self._scanFinished)
                    qt.QObject.connect(self._SpecCmd,
                                       qt.PYSIGNAL("commandAborted"),
                                       self._scanAborted)
                    qt.QObject.connect(self._SpecCmd,
                                       qt.PYSIGNAL("commandFailed"),
                                       self._scanAborted)
                try:
                    self.SCAN_N = ho.getChannelObject('SCAN_N')
                except:
                    self.SCAN_N = None

        elif property == 'formatString':
            self._formatString = self['formatString']
    def propertyChanged(self, prop, oldValue, newValue):
        if prop == "zoom":
            if self.hwZoom is not None:
                self.disconnect(self.hwZoom, qt.PYSIGNAL("positionReached"),
                                self.zoomChanged)
                self.disconnect(self.hwZoom, qt.PYSIGNAL("noPosition"),
                                self.zoomChanged)

            self.hwZoom = self.getHardwareObject(newValue)

            if self.hwZoom is not None:
                self.connect(self.hwZoom, qt.PYSIGNAL("positionReached"),
                             self.zoomChanged)
                self.connect(self.hwZoom, qt.PYSIGNAL("noPosition"),
                             self.zoomChanged)

        if prop == "vertical motor":
            self.vmot = self.getHardwareObject(newValue)
            mne = self.vmot.getMotorMnemonic()
            self.relZLabel.setText("Delta on \"%s\" " % mne)
            self.vmotUnit = self.vmot.getProperty("unit")
            if self.vmotUnit is None:
                self.vmotUnit = 1e-3

        if prop == "horizontal motor":
            self.hmot = self.getHardwareObject(newValue)
            mne = self.hmot.getMotorMnemonic()
            self.relYLabel.setText("Delta on \"%s\" " % mne)
            self.hmotUnit = self.hmot.getProperty("unit")
            if self.hmotUnit is None:
                self.hmotUnit = 1e-3

        if not self.firstTime:
            self.initInterface()
            self.zoomChanged()
Beispiel #4
0
    def __init__(self, parent=None, name=None, fl=0):
        CreateTaskBase.__init__(self, parent, name, fl, 'Standard')

        if not name:
            self.setName("create_discrete_widget")

        self.previous_energy = None
        self.init_models()

        #
        # Layout
        #
        v_layout = qt.QVBoxLayout(self, 2, 5, "v_layout")
        self._acq_gbox = qt.QVGroupBox('Acquisition', self, 'acq_gbox')
        self._acq_widget = \
            AcquisitionWidget(self._acq_gbox,
                              "acquisition_widget",
                              layout='vertical',
                              acq_params=self._acquisition_parameters,
                              path_template=self._path_template)

        self._data_path_gbox = qt.QVGroupBox('Data location', self,
                                             'data_path_gbox')        
        self._data_path_widget = \
            DataPathWidget(self._data_path_gbox,
                           'create_dc_path_widget',
                           data_model=self._path_template,
                           layout='vertical')

        self._processing_gbox = qt.QVGroupBox('Processing', self,
                                              'processing_gbox')

        self._processing_widget = \
            ProcessingWidget(self._processing_gbox,
                             data_model=self._processing_parameters)
        
        v_layout.addWidget(self._acq_gbox)
        v_layout.addWidget(self._data_path_gbox)
        v_layout.addWidget(self._processing_gbox)
        v_layout.addStretch()

        dp_layout = self._data_path_widget.data_path_widget_layout
        self.connect(self._acq_widget, qt.PYSIGNAL('mad_energy_selected'),
                     self.mad_energy_selected)
        
        self.connect(dp_layout.child('prefix_ledit'),
                     qt.SIGNAL("textChanged(const QString &)"),
                     self._prefix_ledit_change)

        self.connect(dp_layout.child('run_number_ledit'),
                     qt.SIGNAL("textChanged(const QString &)"),
                     self._run_number_ledit_change)

        self.connect(self._acq_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)

        self.connect(self._data_path_widget,
                     qt.PYSIGNAL("path_template_changed"),
                     self.handle_path_conflict)
Beispiel #5
0
    def pointSelected(self, drawingMgr):
        if self.horMotHwo is not None and self.verMotHwo is not None:
            if  self.YSize is not None and \
                self.ZSize is not None and \
                self.YBeam is not None and \
                self.ZBeam is not None :

                self.drawingMgr = drawingMgr

                (y, z) = drawingMgr.point()

                self.drawingMgr.stopDrawing()

                sign = 1
                if self.horMotHwo.unit < 0:
                    sign = -1
                movetoy = -sign * (self.YBeam - y) * self.YSize

                sign = 1
                if self.verMotHwo.unit < 0:
                    sign = -1
                movetoz = -sign * (self.ZBeam - z) * self.ZSize

                self.motorArrived = 0

                self.connect(self.horMotHwo, qt.PYSIGNAL("moveDone"),
                             self.moveFinished)
                self.connect(self.verMotHwo, qt.PYSIGNAL("moveDone"),
                             self.moveFinished)

                self.horMotHwo.moveRelative(movetoy)
                self.verMotHwo.moveRelative(movetoz)
Beispiel #6
0
        def _pageChanged(self, page):
            index = self.indexOf(page)
            self.countChanged[index] = False

            tab_label = str(self.tabLabel(page))
            label_list = tab_label.split()
            found = False
            try:
                count = label_list[-1]
                try:
                    found = count[0] == "("
                except:
                    pass
                else:
                    try:
                        found = count[-1] == ")"
                    except:
                        pass
            except:
                pass
            if found:
                orig_label = " ".join(label_list[0:-1])
            else:
                orig_label = " ".join(label_list)
            self.emit(qt.PYSIGNAL("notebookPageChanged"), (orig_label, ))
            qt.qApp.emit(qt.PYSIGNAL('tab_changed'), (index, page))

            tab_name = self.name()
            BlissWidget.updateTabWidget(tab_name, index)
    def run(self):
        if self.firstTime:
            self.initInterface()
            self.zoomChanged()
            """
            get view
            """
            view = {}
            self.emit(qt.PYSIGNAL("getView"), (view, ))
            try:
                self.drawing = view["drawing"]

                cvs = self.drawing.canvas()
                matrix = self.drawing.matrix()
                drawingobject = QubCanvasTarget(cvs)
                color = self.drawing.foregroundColor()

                self.drawingMgr = QubPointDrawingMgr(cvs, matrix)
                self.drawingMgr.setDrawingEvent(QubMoveNPressed1Point)
                self.drawingMgr.setAutoDisconnectEvent(True)
                self.drawingMgr.addDrawingObject(drawingobject)
                self.drawingMgr.setEndDrawCallBack(self.pointSelected)
                qt.QWidget.connect(self.drawing,
                                   qt.PYSIGNAL("ForegroundColorChanged"),
                                   self.setColor)

                self.drawing.addDrawingMgr(self.drawingMgr)
            except:
                print "No View"

        self.firstTime = False
Beispiel #8
0
    def setExpertMode(self, state):
        if not self.executionMode:
            return

        if state:
            # switch to expert mode
            qt.QObject.emit(self.topParent, qt.PYSIGNAL("enableExpertMode"),
                            (True, ))

            # go through all bricks and execute the method
            for w in qt.QApplication.allWidgets():
                if isinstance(w, BlissWidget):
                    try:
                        w.setExpertMode(True)
                    except:
                        logging.getLogger().exception(
                            "Could not set %s to expert mode", w.name())
        else:
            # switch to user mode
            #print self, "emitting: enableExpertMode, False"
            qt.QObject.emit(self.topParent, qt.PYSIGNAL("enableExpertMode"),
                            (False, ))

            # go through all bricks and execute the method
            for w in qt.QApplication.allWidgets():
                if isinstance(w, BlissWidget):
                    qt.QWhatsThis.remove(w)
                    try:
                        w.setExpertMode(False)
                    except:
                        logging.getLogger().exception(
                            "Could not set %s to user mode", w.name())
    def calibrationAction(self):
        if self.calibration == 0:

            if self.drawingMgr is not None:
                self.calibration = 1
                self.calibButton.setText("Cancel Calibration")

                self.drawingMgr.startDrawing()

        elif self.calibration == 1:
            self.calibration = 0
            self.calibButton.setText("Start New Calibration")
            self.drawingMgr.stopDrawing()
            self.drawingMgr.hide()

        elif self.calibration == 2:
            self.disconnect(self.vmot, qt.PYSIGNAL("moveDone"),
                            self.moveFinished)
            self.disconnect(self.hmot, qt.PYSIGNAL("moveDone"),
                            self.moveFinished)
            self.hmot.stop()
            self.vmot.stop()
            self.calibration = 0
            self.calibButton.setText("Start New Calibration")
            self.drawingMgr.stopDrawing()
            self.drawingMgr.hide()
Beispiel #10
0
    def run(self):
        key = {}
        self.emit(qt.PYSIGNAL("getView"), (key, ))
        try:
            self.__view = key["view"]
            self.__drawing = key["drawing"]
        except KeyError:
            logging.getLogger().error(
                "%s : You have to connect this brick to the CameraBrick",
                self.name())
            return

        self.__toggleButton = QubToggleAction(
            label="Show profile",
            name="histogram",
            place="toolbar",
            group="Camera",
            autoConnect=True,
        )
        qt.QObject.connect(self.__toggleButton, qt.PYSIGNAL("StateChanged"),
                           self.__showCBK)
        self.__view.addAction([self.__toggleButton])

        self.__line, _, _ = QubAddDrawing(self.__drawing, QubPointDrawingMgr,
                                          QubCanvasHLine, QubCanvasVLine)
        self.__line.setEndDrawCallBack(self.__clickedPoint)

        graphV = _graphPoint(self.__drawing.canvas())
        graphV.setPen(qt.QPen(qt.Qt.red, 2))

        graphH = _graphPoint(self.__drawing.canvas())
        graphH.setPen(qt.QPen(qt.Qt.green, 2))
        graphH.setZ(5)

        self.__graphs = (graphH, graphV)
    def pointSelected(self, drawingMgr):
        point = drawingMgr.point()
        if self.calibration == 1:
            self.y1 = point[0]
            self.z1 = point[1]

            ymne = self.hmot.getMotorMnemonic()
            zmne = self.vmot.getMotorMnemonic()
            self.deltaY = float(str(self.relYText.text()))
            self.deltaZ = float(str(self.relZText.text()))

            self.calibration = 2
            self.calibButton.setText("STOP")
            self.motorArrived = 0

            self.connect(self.hmot, qt.PYSIGNAL("moveDone"), self.moveFinished)
            self.connect(self.vmot, qt.PYSIGNAL("moveDone"), self.moveFinished)

            self.hmot.moveRelative(self.deltaY)
            self.vmot.moveRelative(self.deltaZ)

        elif self.calibration == 3:
            self.y2 = point[0]
            self.z2 = point[1]

            self.calcCalib()

            self.table.setText(self.currIdx, 1, str(int(self.YCalib * 1e9)))
            self.table.setText(self.currIdx, 2, str(int(self.ZCalib * 1e9)))

            self.calibButton.setText("Start New Calibration")
            self.calibration = 0
            self.drawingMgr.hide()
Beispiel #12
0
    def run(self):
        try:
            key = {}
            self.emit(qt.PYSIGNAL("getView"), (key, ))
            try:
                drawing = key["drawing"]
            except BaseException:
                drawing = None

            if drawing is not None:
                if self.__centeringPlug is not None:
                    self.__centeringPlug.setView(drawing)
            else:
                logging.getLogger().error(
                    "view is not connected from CenteringBrick")
            """
            get beam position
            """
            position = {}
            self.emit(qt.PYSIGNAL("getBeamPosition"), (position, ))
            try:
                self.beam_pos = (position["ybeam"], position["zbeam"])
            except BaseException:
                logging.getLogger().debug("%s: No Beam Position", self.name())
            else:
                self.__centeringPlug.bx = position["ybeam"]
                self.__centeringPlug.by = position["zbeam"]
        except BaseException:
            logging.getLogger().exception("%s: exception in run()",
                                          self.name())
Beispiel #13
0
    def __init__(self, parent, session):
        qt.QObject.__init__(self, parent)

        register = session.broker.connection.register
        for name, msg in messageTypes().items():
            parent.connect(self, qt.PYSIGNAL(name), parent, qt.PYSIGNAL(name))
            slot = getattr(self, methodName(name), None)
            register(msg, slot)
Beispiel #14
0
 def __liveOnOff(self, state):
     camera, decomp, plug = self.__camDecompNPlug
     if state:
         self.connect(camera, qt.PYSIGNAL('imageReceived'), decomp.putData)
         plug.show()
     else:
         self.disconnect(camera, qt.PYSIGNAL('imageReceived'),
                         decomp.putData)
         plug.hide()
Beispiel #15
0
 def _rightButtonPressed(self, item, pnt, c):
     if not item:
         return
     value = item._pkg
     if item and hasattr(value, "name"):
         pkgs = self.getSelectedPkgs()
         if len(pkgs) > 1:
             self.emit(qt.PYSIGNAL("packagePopup"), (self, pkgs, pnt))
         else:
             self.emit(qt.PYSIGNAL("packagePopup"), (self, [value], pnt))
Beispiel #16
0
 def _doubleClicked(self, item, pnt, c):
     if not item:
         return
     value = item._pkg
     if not self._expandpackage and hasattr(value, "name"):
         pkgs = self.getSelectedPkgs()
         if len(pkgs) > 1:
             self.emit(qt.PYSIGNAL("packageActivated"), (pkgs, ))
         else:
             self.emit(qt.PYSIGNAL("packageActivated"), ([value], ))
Beispiel #17
0
 def propertyChanged(self, propertyName, oldValue, newValue):
     if propertyName == "mnemonic":
         if self.diffractometer_hwobj is not None:
             self.disconnect(
                 self.diffractometer_hwobj,
                 qt.PYSIGNAL("kappaMoved"),
                 self.kappa_value_changed,
             )
             self.disconnect(
                 self.diffractometer_hwobj,
                 qt.PYSIGNAL("kappPhiMoved"),
                 self.phi_value_changed,
             )
         self.diffractometer_hwobj = self.getHardwareObject(newValue)
         if self.diffractometer_hwobj is not None:
             self.connect(
                 self.diffractometer_hwobj,
                 qt.PYSIGNAL("kappaMoved"),
                 self.kappa_value_changed,
             )
             self.connect(
                 self.diffractometer_hwobj,
                 qt.PYSIGNAL("kappaPhiMoved"),
                 self.phi_value_changed,
             )
     elif propertyName == "label":
         self.setLabel(newValue)
     elif propertyName == "showLabel":
         if newValue:
             self.setLabel(self["label"])
         else:
             self.setLabel(None)
     elif propertyName == "showStop":
         if newValue:
             self.stop_motors_button.show()
         else:
             self.stop_motors_button.hide()
     elif propertyName == "showBox":
         if newValue:
             self.container_hbox.setFrameShape(self.container_hbox.GroupBoxPanel)
             self.container_hbox.setInsideMargin(4)
             self.container_hbox.setInsideSpacing(0)
         else:
             self.container_hbox.setFrameShape(self.container_hbox.NoFrame)
             self.container_hbox.setInsideMargin(0)
             self.container_hbox.setInsideSpacing(0)
         self.setLabel(self["label"])
     elif propertyName == "icons":
         icons_list = newValue.split()
         try:
             self.move_motors_button.setPixmap(Icons.load(icons_list[0]))
         except IndexError:
             pass
     else:
         BlissWidget.propertyChanged(self, propertyName, oldValue, newValue)
Beispiel #18
0
    def __init__(self, motorObject, ind, role):
        qt.QWidget.__init__(self, None)

        self.motor = motorObject
        self.index = ind
        self.__name = role

        self.motor.connect(self.motor, qt.PYSIGNAL("positionChanged"),
                           self.positionChanged)
        self.motor.connect(self.motor, qt.PYSIGNAL("stateChanged"),
                           self.stateChanged)
Beispiel #19
0
 def connectHardwareObject(self):
     if self.hwro is not None:
         self.connect(self.hwro, qt.PYSIGNAL("positionReached"),
                      self.positionChanged)
         self.connect(self.hwro, qt.PYSIGNAL("noPosition"), self.noPosition)
         self.connect(self.hwro, qt.PYSIGNAL("stateChanged"),
                      self.checkState)
         self.connect(self.hwro, qt.PYSIGNAL("equipmentReady"),
                      self.equipmentReady)
         self.connect(self.hwro, qt.PYSIGNAL("equipmentNotReady"),
                      self.equipmentNotReady)
Beispiel #20
0
    def configureAction(self):
        """
        FALCON
        """
        if self.falconMode is not None:
            if self.falconAction is None and self.falconNumber > 1:
                """
                create action
                """
                cameras = []
                for i in range(self.falconNumber):
                    cameras.append("Camera %d" % i)

                self.falconAction = QubListAction(
                    items=cameras,
                    name='Select Falcon Camera',
                    place=self.falconMode,
                    actionInfo='Select Falcon Camera',
                    group='Tools')
                self.connect(self.falconAction, qt.PYSIGNAL("ItemSelected"),
                             self.cameraSelected)

                if self.view is not None:
                    actions = []
                    actions.append(self.falconAction)
                    self.view.addAction(actions)
        else:
            if self.falconAction is not None:
                """
                remove action
                """
                if self.view is not None:
                    self.view.delAction([
                        "Select Falcon Camera",
                    ])
                """
                del action from view
                """
                self.disconnect(self.falconAction, qt.PYSIGNAL("ItemSelected"),
                                self.cameraSelected)
                self.falconAction = None

        if self.falconHwo is not None:
            try:
                data = {'type': 'tango', 'name': 'VideoInput'}
                vi = self.falconHwo.addChannel(data, 'VideoInput')
                videoinput = self.falconHwo.getChannelObject("VideoInput")
                val = int(videoinput.getValue())
                self.falconAction.setItemIndex(val - 1)
            except BaseException:
                s = "Cannot get video input attribute"
                logging.getLogger("Brick").error(s)
        else:
            logging.getLogger("Brick").error("No Falcon defined")
Beispiel #21
0
 def show_sample_tab(self, item):
     self.sample_changer_widget.child('details_button').setText("Show SC-details")
     self.emit(qt.PYSIGNAL("hide_dc_parameters_tab"), (True,))
     self.emit(qt.PYSIGNAL("populate_sample_details"), (item.get_model(),))
     self.emit(qt.PYSIGNAL("hide_dcg_tab"), (True,))
     self.emit(qt.PYSIGNAL("hide_sample_centring_tab"), (False,))
     self.emit(qt.PYSIGNAL("hide_sample_tab"), (False,))
     self.emit(qt.PYSIGNAL("hide_sample_changer_tab"), (True,))
     self.emit(qt.PYSIGNAL("hide_edna_tab"), (True,))
     self.emit(qt.PYSIGNAL("hide_energy_scan_tab"), (True,))
     self.emit(qt.PYSIGNAL("hide_xrf_scan_tab"), (True,))
     self.emit(qt.PYSIGNAL("hide_workflow_tab"), (True,))
Beispiel #22
0
    def propertyChanged(self, prop, oldValue, newValue):
        if prop == "bpm":
            if self.hwo is not None:
                self.disconnect(self.hwo, qt.PYSIGNAL('imageReceived'),
                                self.imageReceived)

            self.hwo = self.getHardwareObject(newValue)

            if self.hwo is not None:
                self.connect(self.hwo, qt.PYSIGNAL('imageReceived'),
                             self.imageReceived)
                self.imageReceived()
Beispiel #23
0
    def run(self):
        """
        get view
        """
        view = {}
        self.emit(qt.PYSIGNAL("getView"), (view,))
        try:
            self.drawing = view["drawing"]
            self.view = view["view"]        
        except:
            print "No View"
        
        """
        get calibration
        """
        calib = {}
        self.emit(qt.PYSIGNAL("getCalibration"), (calib,))
        try:
            # in all this brick we work with pixel calibration in mm
            self.YSize = calib["ycalib"]
            self.ZSize = calib["zcalib"]
            if calib["ycalib"] is not None and calib["zcalib"] is not None:
                self.YSize = self.YSize * 1000
                self.ZSize = self.ZSize * 1000
        except:
            print "No Calibration"
            
        """
        get beam position
        """
        position = {}
        self.emit(qt.PYSIGNAL("getBeamPosition"), (position,))
        try:
            self.YBeam = position["ybeam"]
            self.ZBeam = position["zbeam"]
        except:
            print "No Beam Position"

        """
        get mosaic view
        """
        mosaicView = {}
        self.emit(qt.PYSIGNAL('getMosaicView'),(mosaicView,))
        try:
            self.__mosaicView = mosaicView['view']
            self.__mosaicDraw = mosaicView['drawing']
        except KeyError:
            self.__mosaicView,self.__mosaicDraw = None,None
            
        self.configureAction()
        
        self.firstCall = False
Beispiel #24
0
 def run(self):
     self.emit(qt.PYSIGNAL("hide_dc_parameters_tab"), (True, ))
     self.emit(qt.PYSIGNAL("hide_dcg_tab"), (True, ))
     self.emit(qt.PYSIGNAL("hide_sample_centring_tab"), (False, ))
     self.emit(qt.PYSIGNAL("hide_edna_tab"), (True, ))
     self.emit(qt.PYSIGNAL("hide_sample_changer_tab"), (True, ))
     self.emit(qt.PYSIGNAL("hide_sample_tab"), (True, ))
     self.emit(qt.PYSIGNAL("hide_energy_scan_tab"), (True, ))
     self.emit(qt.PYSIGNAL("hide_xrf_spectrum_tab"), (True, ))
     self.emit(qt.PYSIGNAL("hide_workflow_tab"), (True, ))
Beispiel #25
0
    def run(self):
        self.emit(qt.PYSIGNAL("hide_dc_parameters_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_dcg_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_sample_centring_tab"), (False,))
        self.emit(qt.PYSIGNAL("hide_edna_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_sample_changer_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_sample_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_energy_scan_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_workflow_tab"), (True,))

        camera_brick = None

        for w in qt.QApplication.allWidgets():
            if isinstance(w, BaseComponents.BlissWidget):
                if "CameraBrick" in str(w.__class__):
                    camera_brick = w
                    camera_brick.installEventFilter(self)
                    break

        # workaround for the remote access problem 
        # (have to disable video display when DC is running)
        if BaseComponents.BlissWidget.isInstanceRoleClient():
            # find the video brick, make sure it is hidden when collecting data
            # and that it is shown again when DC is finished 
            def disable_video(w=camera_brick):
              w.disable_update()
            self.__disable_video=disable_video
            def enable_video(w=camera_brick):
              w.enable_update()
            self.__enable_video=enable_video
            dispatcher.connect(self.__disable_video, "collect_started")
            dispatcher.connect(self.__enable_video, "collect_finished")
Beispiel #26
0
    def toggle_sample_changer_tab(self): 
        if self.current_view is self.sample_changer_widget:
            self.current_view = None
            self.emit(qt.PYSIGNAL("hide_sample_changer_tab"), (True,))
            self.dc_tree_widget.sample_list_view_selection()
            self.sample_changer_widget.child('details_button').setText("Show SC-details")

        else:
            self.current_view = self.sample_changer_widget
            self.emit(qt.PYSIGNAL("hide_dc_parameters_tab"), (True,))
            self.emit(qt.PYSIGNAL("hide_dcg_tab"), (True,))
            self.emit(qt.PYSIGNAL("hide_sample_changer_tab"), (False,))
            self.sample_changer_widget.child('details_button').setText("Hide SC-details")
            self.emit(qt.PYSIGNAL("hide_sample_tab"), (True,))
Beispiel #27
0
    def propertyChanged(self, prop, oldValue, newValue):
        if prop == "Hor. Motor":
            if self.horMotHwo is not None:
                self.disconnect(self.horMotHwo, qt.PYSIGNAL('positionChanged'),
                                self.setHorizontalPosition)
                self.disconnect(self.horMotHwo, qt.PYSIGNAL("limitsChanged"),
                                self.setHorizontalLimits)

            self.horMotHwo = self.getHardwareObject(newValue)
            
            if self.horMotHwo is not None:
                self.connect(self.horMotHwo, qt.PYSIGNAL('positionChanged'),
                             self.setHorizontalPosition)
                self.connect(self.horMotHwo, qt.PYSIGNAL("limitsChanged"),
                             self.setHorizontalLimits)

        elif prop == "Vert. Motor":
            if self.verMotHwo is not None:
                self.disconnect(self.verMotHwo, qt.PYSIGNAL('positionChanged'),
                                self.setVerticalPosition)
                self.disconnect(self.verMotHwo, qt.PYSIGNAL("limitsChanged"),
                                self.setVerticalLimits)

            self.verMotHwo = self.getHardwareObject(newValue)
            
            if self.verMotHwo is not None:
                self.connect(self.verMotHwo, qt.PYSIGNAL('positionChanged'),
                             self.setVerticalPosition)
                self.connect(self.verMotHwo, qt.PYSIGNAL("limitsChanged"),
                             self.setVerticalLimits)
        #elif prop == "Focus Motor":
        #    if self.focusMotHwo is not None:
        #        self.disconnect(self.focusMotHwo,qt.PYSIGNAL('positionChanged'),
        #                        self.setFocusPosition)
        #        self.disconnect(self.focusMotHwo,qt.PYSIGNAL('limitsChanged'),
        #                        self.setFocusLimits)

        #    self.focusMotHwo = self.getHardwareObject(newValue)
        #    self.focusState = FocusState(self,self.focusMotHwo)
            
        #    if self.focusMotHwo is not None:
        #        self.connect(self.focusMotHwo,qt.PYSIGNAL('positionChanged'),
        #                     self.setFocusPosition)
        #        self.connect(self.focusMotHwo,qt.PYSIGNAL('limitsChanged'),
        #                     self.setFocusLimits)
        #        self.connect(self.focusMotHwo, qt.PYSIGNAL("moveDone"),
        #                     self.focusMoveFinished)
        elif prop == "Move To": self.movetoMode = _enumTranslate[newValue]
        elif prop == "Limits": self.limitsMode = _enumTranslate[newValue]
        elif prop == "Focus": self.focusMode = _enumTranslate[newValue]
        elif prop == "Measure": self.measureMode = _enumTranslate[newValue]
        elif prop == "Focus min step": self.focusMinStep = newValue
        elif prop == "Move to color when activate" :
            if newValue == "none" :
                self.movetoColorWhenActivate = None
            else:
                self.movetoColorWhenActivate = newValue
        if not self.firstCall:
            self.configureAction()
Beispiel #28
0
    def use_mad(self, state):
        self.acq_widget_layout.child("energies_combo").setEnabled(state)
        if state:
            (name, energy) = self.get_mad_energy()

            if energy != 0:
                self.set_energy(energy, 0)

            self.emit(qt.PYSIGNAL("mad_energy_selected"), (name, energy, state))
        else:
            self.set_energy(self.previous_energy, 0)
            energy = self._beamline_setup.energy_hwobj.getCurrentEnergy()
            self.emit(
                qt.PYSIGNAL("mad_energy_selected"), ("", self.previous_energy, state)
            )
    def moveFinished(self, ver, mne):
        if mne == self.hmot.getMotorMnemonic():
            self.disconnect(self.hmot, qt.PYSIGNAL("moveDone"),
                            self.moveFinished)
            self.motorArrived = self.motorArrived + 1

        if mne == self.vmot.getMotorMnemonic():
            self.disconnect(self.vmot, qt.PYSIGNAL("moveDone"),
                            self.moveFinished)
            self.motorArrived = self.motorArrived + 1

        if self.calibration == 2 and self.motorArrived == 2:
            self.calibration = 3
            self.calibButton.setText("Cancel Calibration")
            self.drawingMgr.startDrawing()
Beispiel #30
0
    def moveFinished(self, ver, mne):
        if mne == self.horMotHwo.getMotorMnemonic():
            self.disconnect(self.horMotHwo, qt.PYSIGNAL("moveDone"),
                            self.moveFinished)
            self.motorArrived = self.motorArrived + 1

        if mne == self.verMotHwo.getMotorMnemonic():
            self.disconnect(self.verMotHwo, qt.PYSIGNAL("moveDone"),
                            self.moveFinished)
            self.motorArrived = self.motorArrived + 1

        if self.motorArrived == 2:
            self.drawingMgr.startDrawing()
            self.motorArrived = 0
            self.emit(qt.PYSIGNAL("moveDone"), (self.YBeam, self.ZBeam))