Example #1
0
    def property_changed(self, property_name, old_value, new_value):
        if property_name == "mnemonic":
            if self.light_ho is not None:
                self.disconnect(self.light_ho,
                                qt_import.SIGNAL("levelChanged"),
                                self.level_changed)
                self.disconnect(self.light_ho,
                                qt_import.SIGNAL("stateChanged"),
                                self.state_changed)

            self.light_ho = self.get_hardware_object(new_value)

            if self.light_ho is not None:
                self.setEnabled(True)
                self.connect(self.light_ho, qt_import.SIGNAL("levelChanged"),
                             self.level_changed)
                self.connect(self.light_ho, qt_import.SIGNAL("stateChanged"),
                             self.state_changed)
                self.light_ho.re_emit_values()
                self.setToolTip(
                    "Control of %s (light level and on/off switch." %
                    self.light_ho.getUserName())
                self.set_level_limits(self.light_ho.get_limits())
                self.set_label(self.light_ho.getUserName())
            else:
                self.setEnabled(False)
        elif property_name == "icons":
            self.set_icons(new_value)
        else:
            BaseWidget.property_changed(self, property_name, old_value,
                                        new_value)
Example #2
0
    def __init__(self, parent, realtime_plot=False):

        qt_import.QWidget.__init__(self, parent)

        self.axis_x_array = []
        self.axis_y_array = []

        self.realtime_plot = realtime_plot

        self.pymca_graph = Plot(self)
        self.pymca_graph.showGrid()
        self.info_label = qt_import.QLabel("", self)
        self.info_label.setAlignment(qt_import.Qt.AlignRight)

        _main_vlayout = qt_import.QVBoxLayout(self)
        _main_vlayout.addWidget(self.pymca_graph)
        _main_vlayout.addWidget(self.info_label)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        self.setSizePolicy(qt_import.QSizePolicy.Expanding,
                           qt_import.QSizePolicy.Expanding)

        if PYMCA_EXISTS:
            qt_import.QObject.connect(
                self.pymca_graph,
                qt_import.SIGNAL("QtBlissGraphSignal"),
                self.handle_graph_signal,
            )

        colors.set_widget_color(self, colors.WHITE)
Example #3
0
    def property_changed(self, property_name, old_value, new_value):
        if property_name == "mnemonic":
            if self.mach_info_hwobj is not None:
                self.disconnect(
                    self.mach_info_hwobj,
                    qt_import.SIGNAL("valuesChanged"),
                    self.set_value,
                )

            self.mach_info_hwobj = self.get_hardware_object(new_value)
            if self.mach_info_hwobj is not None:
                self.setEnabled(True)
                self.connect(
                    self.mach_info_hwobj,
                    qt_import.SIGNAL("valuesChanged"),
                    self.set_value,
                )
                self.mach_info_hwobj.re_emit_values()
            else:
                self.setEnabled(False)
        else:
            BaseWidget.property_changed(self, property_name, old_value,
                                        new_value)
Example #4
0
        def __init__(self, *args):
            QPeriodicTable.QPeriodicTable.__init__(self, *args)

            self.elements_dict = {}
            if PYMCA_IMPORTED == 5:
                self.sigElementClicked.connect(self.table_element_clicked)
            else:
                qt_import.QObject.connect(
                    self, qt_import.SIGNAL("elementClicked"), self.table_element_clicked
                )
            for b in self.eltButton:
                self.eltButton[b].colors[0] = qt_import.QColor(qt_import.Qt.green)
                self.eltButton[b].colors[1] = qt_import.QColor(qt_import.Qt.darkGreen)
                self.eltButton[b].setEnabled(False)
            for el in QPeriodicTable.Elements:
                symbol = el[0]
                self.elements_dict[symbol] = el
Example #5
0
    def property_changed(self, property_name, old_value, new_value):
        self.fast_shut_ho = None
        self.slow_shut_ho = None
        self.photon_shut_ho = None
        self.fe_ho = None

        print("setting %s property to %s", property_name, new_value)

        if property_name == "fast_shutter":
            if self.fast_shut_ho is not None:
                self.disconnect(
                    self.fast_shut_ho,
                    qt_import.SIGNAL("stateChanged"),
                    self.fast_state_changed,
                )

            self.fast_shut_ho = self.get_hardware_object(new_value)

            if self.fast_shut_ho is not None:
                self.connect(
                    self.fast_shut_ho,
                    qt_import.SIGNAL("stateChanged"),
                    self.fast_state_changed,
                )

        elif property_name == "slow_shutter":
            if self.slow_shut_ho is not None:
                self.disconnect(
                    self.slow_shut_ho,
                    qt_import.SIGNAL("stateChanged"),
                    self.slow_state_changed,
                )

            self.slow_shut_ho = self.get_hardware_object(new_value)

            if self.slow_shut_ho is not None:
                self.connect(
                    self.slow_shut_ho,
                    qt_import.SIGNAL("stateChanged"),
                    self.slow_state_changed,
                )

        elif property_name == "photon_shutter":
            if self.photon_shut_ho is not None:
                self.disconnect(
                    self.photon_shut_ho,
                    qt_import.SIGNAL("stateChanged"),
                    self.photon_state_changed,
                )

            self.photon_shut_ho = self.get_hardware_object(new_value)

            if self.photon_shut_ho is not None:
                self.connect(
                    self.photon_shut_ho,
                    qt_import.SIGNAL("stateChanged"),
                    self.photon_state_changed,
                )

        elif property_name == "frontend":
            if self.fe_ho is not None:
                self.disconnect(
                    self.fe_ho,
                    qt_import.SIGNAL("stateChanged"),
                    self.frontend_state_changed,
                )

            self.fe_ho = self.get_hardware_object(new_value)

            if self.fe_ho is not None:
                self.connect(
                    self.fe_ho,
                    qt_import.SIGNAL("stateChanged"),
                    self.frontend_state_changed,
                )

        elif property_name == "led_size":
            if new_value != "":
                self.set_led_size(int(new_value))
        else:
            BaseWidget.property_changed(self, property_name, old_value,
                                        new_value)