def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.motor = None  #Hardware Object

        #
        # add properties and brick signals
        #
        self.addProperty('mnemonic', 'string', '')
        self.addProperty('showButtons', 'boolean', False)
        self.addProperty('mode', 'combo', ('expert', 'user'), 'user')

        #
        # create GUI components
        #
        self.buttons = []
        self.lblUsername = QLabel('motor :', self)
        self.posButtonsPanel = QVButtonGroup(self)
        self.lstPositions = QComboBox(self)
        self.expertPanel = QVBox(self)
        self.motorWidget = MotorBrick.MotorBrick(self.expertPanel)
        expertPanelButtonsBox = QGrid(2, Qt.Vertical, self.expertPanel)
        QLabel('pos. name :', expertPanelButtonsBox)
        self.txtPositionName = QLineEdit(expertPanelButtonsBox)
        QLabel('', expertPanelButtonsBox)  #just a spacer in fact
        self.cmdSetPosition = QPushButton('Set pos.', expertPanelButtonsBox)

        #
        # configure GUI components
        #
        self.lstPositions.setEditable(False)
        QToolTip.add(self.lstPositions,
                     'Select a predefined position to move motor to')
        self.motorWidget['appearance'] = 'tiny'
        self.motorWidget['allowDoubleClick'] = True
        self.posButtonsPanel.setInsideMargin(5)
        self.posButtonsPanel.setInsideSpacing(0)
        self.posButtonsPanel.setFrameStyle(QFrame.NoFrame)
        self.posButtonsPanel.setExclusive(True)
        expertPanelButtonsBox.setMargin(5)
        expertPanelButtonsBox.setSpacing(5)

        #
        # connect signals / slots
        #
        QObject.connect(self.lstPositions, SIGNAL('activated( int )'),
                        self.lstPositionsClicked)
        QObject.connect(self.cmdSetPosition, SIGNAL('clicked()'),
                        self.cmdSetPositionClicked)

        #
        # layout
        #
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)

        QVBoxLayout(self, 5, 5)
        self.layout().addWidget(self.lblUsername, 0)
        self.layout().addWidget(self.lstPositions, 0)
        self.layout().addWidget(self.posButtonsPanel, 0)
        self.layout().addWidget(self.expertPanel, 0)
Beispiel #2
0
    def openCurrentMotor(self):
        motor_username = str(self.motorsList.currentText())
        try:
            motor_specname = self.motors[motor_username]
        except KeyError:
            pass
        else:
            if motor_username not in self.dialogs:
                m = SpecMotor.SpecVersionMotor(self.listObj.getSpecVersion(),
                                               motor_specname, motor_username)
                dialog = MotorBrick.MotorControlDialog(self, motor_username)

                s = self.font().pointSize()
                f = dialog.font()
                f.setPointSize(s)
                dialog.setFont(f)
                dialog.motorWidget["fontSize"] = s
                dialog.updateGeometry()
                dialog.setFixedSize(dialog.sizeHint())

                dialog.setMotorObject(m)
                self.dialogs[motor_username] = dialog
            else:
                dialog = self.dialogs[motor_username]
            dialog.show()
            dialog.setActiveWindow()
            dialog.raiseW()
Beispiel #3
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        self.motor = None  # Hardware Object

        #
        # add properties and brick signals
        #
        self.addProperty("mnemonic", "string", "")
        self.addProperty("showButtons", "boolean", False)
        self.addProperty("mode", "combo", ("expert", "user"), "user")

        #
        # create GUI components
        #
        self.buttons = []
        self.lblUsername = QLabel("motor :", self)
        self.posButtonsPanel = QVButtonGroup(self)
        self.lstPositions = QComboBox(self)
        self.expertPanel = QVBox(self)
        self.motorWidget = MotorBrick.MotorBrick(self.expertPanel)
        expertPanelButtonsBox = QGrid(2, Qt.Vertical, self.expertPanel)
        QLabel("pos. name :", expertPanelButtonsBox)
        self.txtPositionName = QLineEdit(expertPanelButtonsBox)
        QLabel("", expertPanelButtonsBox)  # just a spacer in fact
        self.cmdSetPosition = QPushButton("Set pos.", expertPanelButtonsBox)

        #
        # configure GUI components
        #
        self.lstPositions.setEditable(False)
        QToolTip.add(self.lstPositions,
                     "Select a predefined position to move motor to")
        self.motorWidget["appearance"] = "tiny"
        self.motorWidget["allowDoubleClick"] = True
        self.posButtonsPanel.setInsideMargin(5)
        self.posButtonsPanel.setInsideSpacing(0)
        self.posButtonsPanel.setFrameStyle(QFrame.NoFrame)
        self.posButtonsPanel.setExclusive(True)
        expertPanelButtonsBox.setMargin(5)
        expertPanelButtonsBox.setSpacing(5)

        #
        # connect signals / slots
        #
        QObject.connect(self.lstPositions, SIGNAL("activated( int )"),
                        self.lstPositionsClicked)
        QObject.connect(self.cmdSetPosition, SIGNAL("clicked()"),
                        self.cmdSetPositionClicked)

        #
        # layout
        #
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)

        QVBoxLayout(self, 5, 5)
        self.layout().addWidget(self.lblUsername, 0)
        self.layout().addWidget(self.lstPositions, 0)
        self.layout().addWidget(self.posButtonsPanel, 0)
        self.layout().addWidget(self.expertPanel, 0)
 def editMotorClicked(self):
     #
     # show full motor control in another window
     #
     if self.controlDialog is None:
         from BlissFramework.Bricks import MotorBrick
         self.controlDialog = MotorBrick.MotorControlDialog(self.cmdMotorPosition, '')
         QObject.connect(self.controlDialog, PYSIGNAL('motorControlDialogClosed'), self.controlDialogClosed)
         self.controlDialog.setMotorMnemonic(self.motor.name())
         self.controlDialog.exec_loop() #modal
     else:
         self.controlDialog.setActiveWindow()
	def setEquipment(self, equipment):			
		self.vbox.close(True)
		self.buttonGroup.close(True)
		self.radios = {}
		self.buttonGroup = QVButtonGroup("", self)
		self.vbox = QVBox(self)
		
		self.buttonGroup.setTitle(equipment.username) 
		for key in equipment.positionsIndex:
			self.radios[key] = QRadioButton(key, self.buttonGroup)

		for mot in equipment["motors"]:
			MotorBrick.MotorBrick(self.vbox)["mnemonic"] = mot.name()

		self.buttonGroup.show()
		self.vbox.show()
Beispiel #6
0
 def editMotorClicked(self):
     #
     # show full motor control in another window
     #
     if self.controlDialog is None:
         self.controlDialog = MotorBrick.MotorControlDialog(
             self.cmdMotorPosition, ""
         )
         QObject.connect(
             self.controlDialog,
             PYSIGNAL("motorControlDialogClosed"),
             self.controlDialogClosed,
         )
         self.controlDialog.setMotorMnemonic(self.motor.name())
         self.controlDialog.exec_loop()  # modal
     else:
         self.controlDialog.setActiveWindow()
Beispiel #7
0
    def updateGUI(self):
        self.hardwareObject = self.getHardwareObject(self['mnemonic'])

        for motor in self.motors:
            motor.close()

        for panel in self.panels.values():
            self.frame.layout().remove(panel)
            panel.close()

        self.panels = {}
        self.motors = []

        if self.hardwareObject:
            if self.hardwareObject.hasObject('motors'):
                ho = self.hardwareObject['motors']
            else:
                print(self.hardwareObject.userName(),
                      'is not an Equipment : no <motors> section.')
                return

            for panelName in ho.objectsNames():
                newPanel = QWidget(self.frame)
                newPanel.setSizePolicy(QSizePolicy.MinimumExpanding,
                                       QSizePolicy.MinimumExpanding)
                QVBoxLayout(newPanel, 0, 0)
                lbl = QLabel('<b>%s</b>' % panelName, newPanel)
                lbl.setAlignment(Qt.AlignCenter)
                self.panels[panelName] = newPanel
                self.frame.layout().addWidget(newPanel, 0, Qt.AlignTop)

                container = QGrid(4, Qt.Vertical, newPanel)
                container.setMargin(0)
                container.setSpacing(5)

                newPanel.layout().addWidget(lbl)
                newPanel.layout().addWidget(container)

                for motor in ho[panelName].getDevices():
                    newMotorWidget = MotorBrick.MotorBrick(
                        container, motor.name())
                    newMotorWidget['mnemonic'] = str(motor.name())
                    newMotorWidget['formatString'] = self.getProperty(
                        'formatString').getUserValue()
                    newMotorWidget['appearance'] = 'normal'
                    newMotorWidget['allowConfigure'] = True
                    self.motors.append(newMotorWidget)
                    if self.isRunning():
                        newMotorWidget.run()

                newPanel.show()

            if len(self.panels) == 0:
                #
                # object has no sections defined
                #
                newPanel = QWidget(self.frame)
                newPanel.setSizePolicy(QSizePolicy.MinimumExpanding,
                                       QSizePolicy.MinimumExpanding)
                QVBoxLayout(newPanel, 5, 5)
                self.panels[' '] = newPanel
                self.frame.layout().addWidget(newPanel, 0, Qt.AlignTop)

                container = QGrid(4, Qt.Vertical, newPanel)
                container.setMargin(0)
                container.setSpacing(5)

                newPanel.layout().addWidget(container)

                for motor in ho.getDevices():
                    newMotorWidget = MotorBrick.MotorBrick(
                        container, motor.name())
                    newMotorWidget.setMnemonic(motor.name())
                    newMotorWidget.getProperty('formatString').setValue(
                        self.getProperty('formatString').getUserValue())
                    newMotorWidget.getProperty('appearance').setValue('normal')
                    newMotorWidget.getProperty('allowConfigure').setValue(True)
                    newMotorWidget.readProperties()
                    self.motors.append(newMotorWidget)
                    if self.isRunning():
                        newMotorWidget.run()

                newPanel.show()