コード例 #1
0
    def __init__(self, hardware, parameters, parent = None):
        QtGui.QDialog.__init__(self, parent)
        halModule.HalModule.__init__(self)

        self.channels = []
        self.hardware_modules = {}
        self.fp = False
        self.parameters = parameters
        self.running_shutters = False
        self.spacing = 3

        if parent:
            self.have_parent = True
        else:
            self.have_parent = False

        # UI setup.
        self.ui = illuminationUi.Ui_Dialog()
        self.ui.setupUi(self)
        self.setWindowTitle(parameters.get("setup_name") + " Illumination Control")
        self.setWindowIcon(qtAppIcon.QAppIcon())

        # Parse XML that describes the hardware.
        hardware = xmlParser.parseHardwareXML("illumination/" + hardware.settings_xml)

        # Hardware modules setup.
        for module in hardware.modules:
            m_name = module.module_name
            a_module = __import__(m_name, globals(), locals(), [m_name], -1)
            a_class = getattr(a_module, module.class_name)
            a_instance = a_class(module.parameters, self)
            if a_instance.isBuffered():
                a_instance.start(QtCore.QThread.NormalPriority)
            self.hardware_modules[module.name] = a_instance            

        # Illumination channels setup.
        x = 7
        for i, channel in enumerate(hardware.channels):
            a_instance = illuminationChannel.Channel(i,
                                                     channel,
                                                     parameters,
                                                     self.hardware_modules,
                                                     self.ui.powerControlBox)
            x += a_instance.setPosition(x, 14) + self.spacing
            self.channels.append(a_instance)

        # Connect signals.
        if self.have_parent:
            self.ui.okButton.setText("Close")
            self.ui.okButton.clicked.connect(self.handleOk)
        else:
            self.ui.okButton.setText("Quit")
            self.ui.okButton.clicked.connect(self.handleQuit)
コード例 #2
0
    def __init__(self, hardware, parameters, parent=None):
        QtGui.QDialog.__init__(self, parent)
        halModule.HalModule.__init__(self)

        self.channels = []
        self.hardware_modules = {}
        self.fp = False
        self.parameters = parameters
        self.running_shutters = False
        self.spacing = 3

        if parent:
            self.have_parent = True
        else:
            self.have_parent = False

        # UI setup.
        self.ui = illuminationUi.Ui_Dialog()
        self.ui.setupUi(self)
        self.setWindowTitle(
            parameters.get("setup_name") + " Illumination Control")
        self.setWindowIcon(qtAppIcon.QAppIcon())

        # Parse XML that describes the hardware.
        hardware = xmlParser.parseHardwareXML("illumination/" +
                                              hardware.settings_xml)

        # Hardware modules setup.
        for module in hardware.modules:
            m_name = module.module_name
            a_module = __import__(m_name, globals(), locals(), [m_name], -1)
            a_class = getattr(a_module, module.class_name)
            a_instance = a_class(module.parameters, self)
            if a_instance.isBuffered():
                a_instance.start(QtCore.QThread.NormalPriority)
            self.hardware_modules[module.name] = a_instance

        # Illumination channels setup.
        x = 7
        for i, channel in enumerate(hardware.channels):
            a_instance = illuminationChannel.Channel(i, channel, parameters,
                                                     self.hardware_modules,
                                                     self.ui.powerControlBox)
            x += a_instance.setPosition(x, 14) + self.spacing
            self.channels.append(a_instance)

        # Connect signals.
        if self.have_parent:
            self.ui.okButton.setText("Close")
            self.ui.okButton.clicked.connect(self.handleOk)
        else:
            self.ui.okButton.setText("Quit")
            self.ui.okButton.clicked.connect(self.handleQuit)
コード例 #3
0
    def __init__(self, hardware, parameters, parent=None):
        QtGui.QDialog.__init__(self, parent)
        halModule.HalModule.__init__(self)

        self.channels = []
        self.hardware_modules = {}
        self.fp = False
        self.parameters = parameters
        self.running_shutters = False
        self.spacing = 3

        if parent:
            self.have_parent = True
        else:
            self.have_parent = False

        # UI setup.
        self.ui = illuminationUi.Ui_Dialog()
        self.ui.setupUi(self)
        self.setWindowTitle(
            parameters.get("setup_name") + " Illumination Control")
        self.setWindowIcon(qtAppIcon.QAppIcon())

        # Parse XML that describes the hardware.
        hardware = xmlParser.parseHardwareXML("illumination/" +
                                              hardware.get("settings_xml"))

        # Add illumination specific settings.
        #
        # FIXME: These used to be customizable.
        #
        default_power = []
        on_off_state = []
        for i in range(len(hardware.channels)):
            default_power.append(1.0)
            on_off_state.append(False)
        self.parameters.set("illumination.default_power", default_power)
        self.parameters.set("illumination.on_off_state", on_off_state)

        # Check for button settings, use defaults if they do not exist.
        #
        buttons = []
        for i in range(len(hardware.channels)):
            buttons.append([["Max", 1.0], ["Low", 0.1]])
        power_buttons = params.ParameterCustom("Illumination power buttons",
                                               "power_buttons",
                                               buttons,
                                               1,
                                               is_mutable=True,
                                               is_saved=True)
        power_buttons.editor = buttonEditor.ParametersTablePowerButtonEditor
        self.parameters.add("illumination.power_buttons", power_buttons)

        # This parameter is used to be able to tell when the shutters file
        # has been changed for a given set of parameters.
        self.parameters.add(
            "illumination.last_shutters",
            params.ParameterString("Last shutters file name",
                                   "last_shutters",
                                   "",
                                   is_mutable=False,
                                   is_saved=False))

        # Default camera parameters.
        self.parameters.add(
            "illumination.shutters",
            params.ParameterStringFilename("Shutters file name", "shutters",
                                           "shutters_default.xml", False))

        # Hardware modules setup.
        for module in hardware.modules:
            m_name = module.module_name
            a_module = __import__(m_name, globals(), locals(), [m_name], -1)
            a_class = getattr(a_module, module.class_name)
            a_instance = a_class(module.parameters, self)
            if a_instance.isBuffered():
                a_instance.start(QtCore.QThread.NormalPriority)
            self.hardware_modules[module.name] = a_instance

        # Illumination channels setup.
        x = 7
        names = []
        for i, channel in enumerate(hardware.channels):
            a_instance = illuminationChannel.Channel(
                i, channel, parameters.get("illumination"),
                self.hardware_modules, self.ui.powerControlBox)
            x += a_instance.setPosition(x, 14) + self.spacing
            self.channels.append(a_instance)
            names.append(a_instance.getName())

        power_buttons.channel_names = names

        # Connect signals.
        if self.have_parent:
            self.ui.okButton.setText("Close")
            self.ui.okButton.clicked.connect(self.handleOk)
        else:
            self.ui.okButton.setText("Quit")
            self.ui.okButton.clicked.connect(self.handleQuit)
コード例 #4
0
    def __init__(self, hardware, parameters, parent = None):
        QtGui.QDialog.__init__(self, parent)
        halModule.HalModule.__init__(self)
        
        self.channels = []
        self.hardware_modules = {}
        self.fp = False
        self.parameters = parameters
        self.running_shutters = False
        self.spacing = 3

        if parent:
            self.have_parent = True
        else:
            self.have_parent = False

        # UI setup.
        self.ui = illuminationUi.Ui_Dialog()
        self.ui.setupUi(self)
        self.setWindowTitle(parameters.get("setup_name") + " Illumination Control")
        self.setWindowIcon(qtAppIcon.QAppIcon())

        # Parse XML that describes the hardware.
        hardware = xmlParser.parseHardwareXML("illumination/" + hardware.get("settings_xml"))

        # Add illumination specific settings.
        #
        # FIXME: These used to be customizable.
        #
        default_power = []
        on_off_state = []
        for i in range(len(hardware.channels)):
            default_power.append(1.0)
            on_off_state.append(False)
        self.parameters.set("illumination.default_power", default_power)
        self.parameters.set("illumination.on_off_state", on_off_state)

        # Check for button settings, use defaults if they do not exist.
        #
        buttons = []
        for i in range(len(hardware.channels)):
            buttons.append([["Max", 1.0], ["Low", 0.1]])
        power_buttons = params.ParameterCustom("Illumination power buttons",
                                               "power_buttons",
                                               buttons,
                                               1,
                                               is_mutable = True,
                                               is_saved = True)
        power_buttons.editor = buttonEditor.ParametersTablePowerButtonEditor
        self.parameters.add("illumination.power_buttons", power_buttons)

        # This parameter is used to be able to tell when the shutters file
        # has been changed for a given set of parameters.
        self.parameters.add("illumination.last_shutters", params.ParameterString("Last shutters file name",
                                                                                "last_shutters",
                                                                                "",
                                                                                is_mutable = False,
                                                                                is_saved = False))

        # Hardware modules setup.
        for module in hardware.modules:
            m_name = module.module_name
            a_module = __import__(m_name, globals(), locals(), [m_name], -1)
            a_class = getattr(a_module, module.class_name)
            a_instance = a_class(module.parameters, self)
            if a_instance.isBuffered():
                a_instance.start(QtCore.QThread.NormalPriority)
            self.hardware_modules[module.name] = a_instance            

        # Illumination channels setup.
        x = 7
        names = []
        for i, channel in enumerate(hardware.channels):
            a_instance = illuminationChannel.Channel(i,
                                                     channel,
                                                     parameters.get("illumination"),
                                                     self.hardware_modules,
                                                     self.ui.powerControlBox)
            x += a_instance.setPosition(x, 14) + self.spacing
            self.channels.append(a_instance)
            names.append(a_instance.getName())
            
        power_buttons.channel_names = names

        # Connect signals.
        if self.have_parent:
            self.ui.okButton.setText("Close")
            self.ui.okButton.clicked.connect(self.handleOk)
        else:
            self.ui.okButton.setText("Quit")
            self.ui.okButton.clicked.connect(self.handleQuit)