Ejemplo n.º 1
0
 def __createOneAxis(self, motor):
     pad = QubPad(self)
     pad.setAxis(QubPad.HORIZONTAL_AXIS)
     plug = _AxisPlug(self, motor, None, None)
     pad.setPlug(plug)
     self["formatString"] = self.getProperty("formatString").getUserValue()
     plug.init()
     self.__pads.append(pad)
     self.__plugs.append(plug)
     self.__padLayout.addWidget(pad, 0, 0)
Ejemplo n.º 2
0
    def __createPlugNPad(self, equipment):
        try:
            verticalMotor = equipment.getDeviceByRole("vertical")
        except BaseException:
            verticalMotor = None
        try:
            horizontalMotor = equipment.getDeviceByRole("horizontal")
        except BaseException:
            horizontalMotor = None
        try:
            rotationMotor = equipment.getDeviceByRole("rotation")
        except BaseException:
            rotationMotor = None

        pad, plug = None, None
        if verticalMotor is None and horizontalMotor is None and rotationMotor is None:
            logging.getLogger().error(
                "%s: could not find vertical or horizontal or rotation motors in Hardware Object %s",
                str(self.name()),
                equipment.name(),
            )
        else:
            pad = QubPad(self)
            padAxisType = 0
            if verticalMotor is not None:
                padAxisType |= QubPad.VERTICAL_AXIS
            if horizontalMotor is not None:
                padAxisType |= QubPad.HORIZONTAL_AXIS
            if rotationMotor is not None:
                padAxisType |= QubPad.ROTATION_AXIS
            pad.setAxis(padAxisType)
            plug = _AxisPlug(self, horizontalMotor, verticalMotor,
                             rotationMotor)
            pad.setPlug(plug)
            # refresh labels
            self["formatString"] = self.getProperty(
                "formatString").getUserValue()
            plug.init()
        return (plug, pad)