コード例 #1
0
    def get_custom_config(self):
        """
        Gets a pyforms BaseWidget to complete configuration for LinearAxis
        """

        if self._widget is None:
            widget = BaseWidget("Linear Axis Config")

            widget.device_list = ControlCombo(label="Device")

            widget.device_list += ('None', None)

            for device in DEVICES:
                widget.device_list += device

            if self._linear_stage is not None:
                widget.value = self._linear_stage.serial_number

                print("Stage:", self._linear_stage.serial_number)
                print("Widget:", widget.value)

            widget.device_list.current_index_changed_event = self._update_stage

            widget.formset = ['device_list', '']

            self._widget = widget

            self._update_stage(0)

        if self._linear_stage is not None:
            self._linear_stage.identify()

        return self._widget
コード例 #2
0
    def get_custom_config(self):
        """
        Gets a pyforms BaseWidget to complete configuration for RotationAxis
        """

        if self._widget is None:
            widget = BaseWidget("Rotate Axis Config")

            widget.device_list = ControlCombo(label="Device")

            widget.device_list += ('None', None)

            for device in DEVICES:
                widget.device_list += device

            if self._rotation_stage is not None:
                widget.value = self._rotation_stage.serial_number

            widget.device_list.current_index_changed_event = self._update_stage

            widget.distance_field = ControlNumber(
                label="Distance to Surface",
                default=self._distance_to_surface,
                minimum=0,
                maximum=float('inf'),
                decimals=5)

            widget.distance_field.key_pressed_event = self._update_distance_to_surface

            widget.formset = ['device_list', 'distance_field', '']

            self._widget = widget

            self._update_stage(0)

        if self._rotation_stage is not None:
            self._rotation_stage.identify()

        return self._widget