Esempio n. 1
0
 def _showGrabScan(self, aFlag):
     BaseGraphicScan._showGrabScan(self, aFlag)
     for item in self.__getIterator():
         if aFlag:
             item.drawingManager.show()
         else:
             item.drawingManager.hide()
 def _showGrabScan(self,aFlag) :
     BaseGraphicScan._showGrabScan(self,aFlag)
     for item in self.__getIterator() :
         if aFlag:
             item.drawingManager.show()
         else:
             item.drawingManager.hide()
    def __init__(self,parent,name,uifile = 'LookupScan.ui',cmd_name = 'ltscan',**kwargs) :
        BaseGraphicScan.__init__(self, parent, name, uifile=uifile, cmd_name=cmd_name, **kwargs)
        self._graphicSelection = None
        self.__polyNb = 0
        self.__gridPoints = None
        self._matchPoints = None
        self.__offsetMeasure = 1e3
        self._ltinit = None
        
        self.addProperty('offsetmeasure','float',1e3)
        
        table = self._widgetTree.child('__gridTable')
        qt.QObject.connect(table,qt.SIGNAL('valueChanged(int,int)'),self._valueChangedScanParam)

        timeWidget = self._widgetTree.child('__time')
        timeWidget.setValidator(qt.QDoubleValidator(timeWidget))
        # PopUp Menu
        self.__polygonListWidget = self._widgetTree.child('__polygonList')
        self.__polygonListWidget.setSelectionMode(qt.QListView.Extended)

        self.__polygonPopUpMenu = qt.QPopupMenu(self.__polygonListWidget)
        for itemName,cbk in [('Create new',self.__createPolygon),
                             ('Remove',self.__removeSelectedPolygon),
                             ('Revert selection',self.__revertSelectedPolygon)] :
            self.__polygonPopUpMenu.insertItem(itemName,cbk)

        self.connect(self.__polygonListWidget,qt.SIGNAL('rightButtonPressed(QListViewItem*,const QPoint &,int)'),
                     self.__polygonPopUpDisplay)

        timeWidget = self._widgetTree.child('__time')
        self.connect(timeWidget,qt.SIGNAL('returnPressed()'),self.__refreshInfoText)
        self.connect(timeWidget,qt.SIGNAL('lostFocus()'),self.__refreshInfoText)
Esempio n. 4
0
 def propertyChanged(self,property,oldValue,newValue):
     if property == 'offsetmeasure':
         self.__offsetMeasure = newValue
     elif property == 'command':
         pass
     else:
         BaseGraphicScan.propertyChanged(self,property,oldValue,newValue)
Esempio n. 5
0
 def propertyChanged(self, property, oldValue, newValue):
     if property == 'offsetmeasure':
         self.__offsetMeasure = newValue
     elif property == 'command':
         pass
     else:
         BaseGraphicScan.propertyChanged(self, property, oldValue, newValue)
    def __init__(self,parent,name,uifile = 'LookupScan.ui',cmd_name = 'ltscan',**kwargs) :
        BaseGraphicScan.__init__(self, parent, name, uifile=uifile, cmd_name=cmd_name, **kwargs)
        self._graphicSelection = None
        self.__polyNb = 0
        self.__gridPoints = None
        self._matchPoints = None
        self.__offsetMeasure = 1e3
        self._ltinit = None
        
        self.addProperty('offsetmeasure','float',1e3)
        
        table = self._widgetTree.child('__gridTable')
        qt.QObject.connect(table,qt.SIGNAL('valueChanged(int,int)'),self._valueChangedScanParam)

        timeWidget = self._widgetTree.child('__time')
        timeWidget.setValidator(qt.QDoubleValidator(timeWidget))
        # PopUp Menu
        self.__polygonListWidget = self._widgetTree.child('__polygonList')
        self.__polygonListWidget.setSelectionMode(qt.QListView.Extended)

        self.__polygonPopUpMenu = qt.QPopupMenu(self.__polygonListWidget)
        for itemName,cbk in [('Create new',self.__createPolygon),
                             ('Remove',self.__removeSelectedPolygon),
                             ('Revert selection',self.__revertSelectedPolygon)] :
            self.__polygonPopUpMenu.insertItem(itemName,cbk)

        self.connect(self.__polygonListWidget,qt.SIGNAL('rightButtonPressed(QListViewItem*,const QPoint &,int)'),
                     self.__polygonPopUpDisplay)

        timeWidget = self._widgetTree.child('__time')
        self.connect(timeWidget,qt.SIGNAL('returnPressed()'),self.__refreshInfoText)
        self.connect(timeWidget,qt.SIGNAL('lostFocus()'),self.__refreshInfoText)
Esempio n. 7
0
    def __init__(self, parent, name, **kwargs):
        BaseGraphicScan.__init__(self,
                                 parent,
                                 name,
                                 uifile='Mesh.ui',
                                 cmd_name='mesh',
                                 **kwargs)

        self.__rect = None

        meshTable = self._widgetTree.child('__table')
        qt.QObject.connect(meshTable, qt.SIGNAL('valueChanged(int,int)'),
                           self._valueChangedScanParam)
        gButton = self._widgetTree.child('__grabButton')
        meshTable.setColumnReadOnly(5, True)

        filloutButton = self._widgetTree.child('__fillout')
        qt.QObject.connect(filloutButton, qt.SIGNAL('clicked()'),
                           self.__fillout)

        # TABLE SIZE HACKED
        height = meshTable.rowHeight(0) * (meshTable.numRows() + 1) + 5
        vheaders = meshTable.verticalHeader()
        hheaders = meshTable.horizontalHeader()
        width = vheaders.headerWidth() + hheaders.headerWidth() + 5
        meshTable.setMaximumSize(width, height)
        meshTable.setMinimumSize(width, height)
Esempio n. 8
0
 def __init__(self,parent,name,**kwargs) :
     BaseGraphicScan.__init__(self,parent,name,uifile = 'A2Scan.ui',cmd_name='a2scan',**kwargs)
     self.__points = []
                    ####### INIT GUI #######
     aTable = self._widgetTree.child('__table')
     qt.QObject.connect(aTable,qt.SIGNAL('valueChanged(int,int)'),self._valueChangedScanParam)
     aTable.setColumnReadOnly(4,True)
             
     intervals = self._widgetTree.child('__intervals')
     intervals.setValidator(qt.QIntValidator(intervals))
     qt.QObject.connect(intervals,qt.SIGNAL('returnPressed ()'),self.__intervalsChanged)
     qt.QObject.connect(intervals,qt.SIGNAL('lostFocus()'),self.__intervalsChanged)
     
     timeWidget = self._widgetTree.child('__time')
     timeWidget.setValidator(qt.QDoubleValidator(timeWidget))
Esempio n. 9
0
    def _updateGUI(self) :
        BaseGraphicScan._updateGUI(self)
        aTable = self._widgetTree.child('__table')
        (startMot1,v1),(stopMot1,v2) = [aTable.text(0,column).toFloat() for column in range(1,3)]
        if not v1 or not v2 : return
        
        (startMot2,v1),(stopMot2,v2) = [aTable.text(1,column).toFloat() for column in range(1,3)]
        if not v1 or not v2 : return

        try:
            angle = math.atan((stopMot2 - startMot2) / (stopMot1 - startMot1))
        except ZeroDivisionError:
            angle = math.pi / 2
        aTable.setText(2,0,'%.2f' % (angle * 180 / math.pi))

        self._valueChangedScanParam(2,3)
    def propertyChanged(self,property,oldValue,newValue) :
        if property == 'offsetmeasure':
            self.__offsetMeasure = newValue
        elif property == 'command' :
            BaseGraphicScan.propertyChanged(self,property,oldValue,newValue)
            ho = self.getHardwareObject(newValue)
            if ho is not None:
                try:
                    self._ltinit = ho.getCommandObject('ltinit')
                    self._ltinit.connectSignal('commandReplyArrived',self.__ltinitFinished)
                except:
                    self._ltinit = None
                    logging.getLogger().error('ltinit not find in command file')
                    startButton = self._widgetTree.child('__startScan')
                    startButton.setEnabled(False)

        else:
            BaseGraphicScan.propertyChanged(self,property,oldValue,newValue)
    def propertyChanged(self,property,oldValue,newValue) :
        if property == 'offsetmeasure':
            self.__offsetMeasure = newValue
        elif property == 'command' :
            BaseGraphicScan.propertyChanged(self,property,oldValue,newValue)
            ho = self.getHardwareObject(newValue)
            if ho is not None:
                try:
                    self._ltinit = ho.getCommandObject('ltinit')
                    self._ltinit.connectSignal('commandReplyArrived',self.__ltinitFinished)
                except:
                    self._ltinit = None
                    logging.getLogger().error('ltinit not find in command file')
                    startButton = self._widgetTree.child('__startScan')
                    startButton.setEnabled(False)

        else:
            BaseGraphicScan.propertyChanged(self,property,oldValue,newValue)
Esempio n. 12
0
    def _updateGUI(self):
        BaseGraphicScan._updateGUI(self)
        aTable = self._widgetTree.child('__table')
        (startMot1, v1), (stopMot1, v2) = [
            aTable.text(0, column).toFloat() for column in range(1, 3)
        ]
        if not v1 or not v2: return

        (startMot2, v1), (stopMot2, v2) = [
            aTable.text(1, column).toFloat() for column in range(1, 3)
        ]
        if not v1 or not v2: return

        try:
            angle = math.atan((stopMot2 - startMot2) / (stopMot1 - startMot1))
        except ZeroDivisionError:
            angle = math.pi / 2
        aTable.setText(2, 0, '%.2f' % (angle * 180 / math.pi))

        self._valueChangedScanParam(2, 3)
Esempio n. 13
0
    def __init__(self,parent,name,**kwargs) :
        BaseGraphicScan.__init__(self,parent,name,uifile = 'Mesh.ui',cmd_name = 'mesh',**kwargs)

        self.__rect = None

        meshTable = self._widgetTree.child('__table')
        qt.QObject.connect(meshTable,qt.SIGNAL('valueChanged(int,int)'),self._valueChangedScanParam)
        gButton = self._widgetTree.child('__grabButton')
        meshTable.setColumnReadOnly(5,True)
        
        filloutButton = self._widgetTree.child('__fillout')
        qt.QObject.connect(filloutButton,qt.SIGNAL('clicked()'),self.__fillout)
        
        # TABLE SIZE HACKED
        height = meshTable.rowHeight(0) * (meshTable.numRows() + 1) + 5
        vheaders = meshTable.verticalHeader()
        hheaders = meshTable.horizontalHeader()
        width = vheaders.headerWidth() + hheaders.headerWidth() + 5
        meshTable.setMaximumSize(width,height)
        meshTable.setMinimumSize(width,height)
Esempio n. 14
0
    def __init__(self,parent,name,uifile = 'MxLookupScan.ui',**kwargs) :
        BaseGraphicScan.__init__(self, parent, name, uifile=uifile, **kwargs)
        self._graphicSelection = None
        self.__gridPoints = None
        self._matchPoints = None
        self.__offsetMeasure = 1e3
        self.old_mot1_pos = None
        self.old_mot2_pos = None
        self._shape_history = None
        
        self.addProperty('offsetmeasure','float',1e3)
        self.defineSignal("addToQueue", ())
        self.defineSignal('clearQueue', ())
        self.defineSignal("dataCollectParametersRequest", ())
        self.defineSignal("goToCollect", ())

        table = self._widgetTree.child('__gridTable')
        qt.QObject.connect(table,qt.SIGNAL('valueChanged(int,int)'),self._valueChangedScanParam)

        timeWidget = self._widgetTree.child('__time')
        timeWidget.setValidator(qt.QDoubleValidator(timeWidget))
        timeWidget = self._widgetTree.child('__time')
Esempio n. 15
0
    def __init__(self, parent, name, **kwargs):
        BaseGraphicScan.__init__(self,
                                 parent,
                                 name,
                                 uifile='A2Scan.ui',
                                 cmd_name='a2scan',
                                 **kwargs)
        self.__points = []
        ####### INIT GUI #######
        aTable = self._widgetTree.child('__table')
        qt.QObject.connect(aTable, qt.SIGNAL('valueChanged(int,int)'),
                           self._valueChangedScanParam)
        aTable.setColumnReadOnly(4, True)

        intervals = self._widgetTree.child('__intervals')
        intervals.setValidator(qt.QIntValidator(intervals))
        qt.QObject.connect(intervals, qt.SIGNAL('returnPressed ()'),
                           self.__intervalsChanged)
        qt.QObject.connect(intervals, qt.SIGNAL('lostFocus()'),
                           self.__intervalsChanged)

        timeWidget = self._widgetTree.child('__time')
        timeWidget.setValidator(qt.QDoubleValidator(timeWidget))
Esempio n. 16
0
    def run(self):
        BaseGraphicScan.run(self)
        startButton = self._widgetTree.child('__startScan')
        startButton.hide()

        stopButton = self._widgetTree.child('__stopScan')
        stopButton.hide()
        
        if self._horizontalMotors and self._verticalMotors:
       
          startButton.setEnabled(True)
          mot1 = self._horizontalMotors[0]
          mot2 = self._verticalMotors[0]
          self.old_mot1_pos = mot1.getPosition()
          self.old_mot2_pos = mot2.getPosition()
          mot1.connect('positionChanged', self.mot1_position_changed)
          mot2.connect('positionChanged', self.mot2_position_changed)
 
        table = self._widgetTree.child('__gridTable')
        table.setText(0, 0, "2")
        table.setText(1, 0, "2")

        dispatcher.connect(self._askedForGrid, "grid")
Esempio n. 17
0
    def run(self):
        BaseGraphicScan.run(self)
        startButton = self._widgetTree.child('__startScan')
        startButton.hide()

        stopButton = self._widgetTree.child('__stopScan')
        stopButton.hide()

        if self._horizontalMotors and self._verticalMotors:

            startButton.setEnabled(True)
            mot1 = self._horizontalMotors[0]
            mot2 = self._verticalMotors[0]
            self.old_mot1_pos = mot1.getPosition()
            self.old_mot2_pos = mot2.getPosition()
            mot1.connect('positionChanged', self.mot1_position_changed)
            mot2.connect('positionChanged', self.mot2_position_changed)

        table = self._widgetTree.child('__gridTable')
        table.setText(0, 0, "2")
        table.setText(1, 0, "2")

        dispatcher.connect(self._askedForGrid, "grid")
Esempio n. 18
0
    def __init__(self, parent, name, uifile='MxLookupScan.ui', **kwargs):
        BaseGraphicScan.__init__(self, parent, name, uifile=uifile, **kwargs)
        self._graphicSelection = None
        self.__gridPoints = None
        self._matchPoints = None
        self.__offsetMeasure = 1e3
        self.old_mot1_pos = None
        self.old_mot2_pos = None
        self._shape_history = None

        self.addProperty('offsetmeasure', 'float', 1e3)
        self.defineSignal("addToQueue", ())
        self.defineSignal('clearQueue', ())
        self.defineSignal("dataCollectParametersRequest", ())
        self.defineSignal("goToCollect", ())

        table = self._widgetTree.child('__gridTable')
        qt.QObject.connect(table, qt.SIGNAL('valueChanged(int,int)'),
                           self._valueChangedScanParam)

        timeWidget = self._widgetTree.child('__time')
        timeWidget.setValidator(qt.QDoubleValidator(timeWidget))
        timeWidget = self._widgetTree.child('__time')
        timeWidget.hide()
Esempio n. 19
0
 def _setColor(self, color):
     BaseGraphicScan._setColor(self, color)
     for item in self.__getIterator():
         item.drawingManager.setColor(color)
Esempio n. 20
0
 def _setColor(self, color):
     BaseGraphicScan._setColor(self, color)
 def _setColor(self,color) :
     BaseGraphicScan._setColor(self,color)
     for item in self.__getIterator() :
         item.drawingManager.setColor(color)
Esempio n. 22
0
 def _showGrabScan(self, aFlag):
     BaseGraphicScan._showGrabScan(self, aFlag)
Esempio n. 23
0
 def _showGrabScan(self,aFlag) :
     BaseGraphicScan._showGrabScan(self,aFlag)
Esempio n. 24
0
 def _setColor(self,color) :
     BaseGraphicScan._setColor(self,color)