Beispiel #1
0
    def __init__(self, hardware, parameters, parent=None):
        singleCamera.SingleCamera.__init__(self, hardware, parameters, parent)

        self.ui = cameraDetachedUi.Ui_Dialog()
        self.ui.setupUi(self)
        self.setWindowTitle(parameters.get("setup_name") + " Camera")

        # Set up camera display.
        camera_display_ui = cameraDisplayUi.Ui_Frame()
        self.camera_display = cameraDisplay.CameraDisplay(
            hardware.display,
            parameters,
            camera_display_ui,
            "camera1",
            show_record_button=False,
            show_shutter_button=True,
            parent=self.ui.cameraFrame)
        layout = QtGui.QGridLayout(self.ui.cameraFrame)
        layout.setMargin(0)
        layout.addWidget(self.camera_display)

        # Set up camera parameters display.
        camera_params_ui = cameraParamsUi.Ui_GroupBox()
        self.camera_params = cameraParams.CameraParams(
            camera_params_ui, parent=self.ui.cameraParamsFrame)

        layout = QtGui.QGridLayout(self.ui.cameraParamsFrame)
        layout.setMargin(0)
        layout.addWidget(self.camera_params)

        self.camera_params.showEMCCD(self.camera_control.haveEMCCD())
        self.camera_params.showPreamp(self.camera_control.havePreamp())
        self.camera_params.showTemperature(
            self.camera_control.haveTemperature())

        # Connect ui elements.
        self.ui.okButton.setText("Close")
        self.ui.okButton.clicked.connect(self.handleOk)

        self.camera_display.ui.cameraShutterButton.clicked.connect(
            self.toggleShutter)
        self.camera_params.gainChange.connect(self.handleGainChange)
Beispiel #2
0
    def __init__(self,
                 hardware,
                 parameters,
                 camera_frame,
                 camera_params_frame,
                 parent=None):
        singleCamera.SingleCamera.__init__(self, hardware, parameters, parent)

        # Set up camera display.
        camera_display_ui = cameraDisplayUi.Ui_Frame()
        self.camera_display = cameraDisplay.CameraDisplay(
            hardware.display,
            parameters,
            camera_display_ui,
            "camera1",
            show_record_button=True,
            show_shutter_button=self.camera_control.haveShutter(),
            parent=camera_frame)

        layout = QtGui.QGridLayout(camera_frame)
        layout.setMargin(0)
        layout.addWidget(self.camera_display)

        # Set up camera parameters display.
        camera_params_ui = cameraParamsUi.Ui_GroupBox()
        self.camera_params = cameraParams.CameraParams(
            camera_params_ui, parent=camera_params_frame)

        layout = QtGui.QGridLayout(camera_params_frame)
        layout.setMargin(0)
        layout.addWidget(self.camera_params)

        self.camera_params.showEMCCD(self.camera_control.haveEMCCD())
        self.camera_params.showPreamp(self.camera_control.havePreamp())
        self.camera_params.showTemperature(
            self.camera_control.haveTemperature())

        # Connect ui elements.
        self.camera_display.ui.cameraShutterButton.clicked.connect(
            self.toggleShutter)
        self.camera_params.gainChange.connect(self.handleGainChange)
Beispiel #3
0
    def __init__(self,
                 display_module,
                 parameters,
                 name,
                 which_camera,
                 parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.ui = cameraDetachedUi.Ui_Dialog()
        self.ui.setupUi(self)
        self.setWindowTitle(name)

        # Set up camera display.
        camera_display_ui = cameraDisplayUi.Ui_Frame()
        self.camera_display = cameraDisplay.CameraDisplay(
            display_module,
            parameters,
            camera_display_ui,
            which_camera,
            show_record_button=False,
            show_shutter_button=True,
            parent=self.ui.cameraFrame)

        layout = QtGui.QGridLayout(self.ui.cameraFrame)
        layout.setMargin(0)
        layout.addWidget(self.camera_display)

        # Set up camera parameters display.
        camera_params_ui = cameraParamsUi.Ui_GroupBox()
        self.camera_params = cameraParams.CameraParams(
            camera_params_ui, parent=self.ui.cameraParamsFrame)

        layout = QtGui.QGridLayout(self.ui.cameraParamsFrame)
        layout.setMargin(0)
        layout.addWidget(self.camera_params)

        # Connect ui elements.
        self.ui.okButton.setText("Close")
        self.ui.okButton.clicked.connect(self.handleOk)
Beispiel #4
0
    def __init__(self, hardware, parameters, feed_name, parent=None):
        QtGui.QFrame.__init__(self, parent)

        # General (alphabetically ordered).
        self.color_gradient = 0
        self.color_table = 0
        self.color_tables = colorTables.ColorTables(
            "./colorTables/all_tables/")
        self.cycle_length = 0
        self.display_timer = QtCore.QTimer(self)
        self.feed_controller = False
        self.feed_name = feed_name
        self.filming = False
        self.frame = False
        self.max_intensity = parameters.get("max_intensity")
        self.parameters = parameters
        self.show_grid = 0
        self.show_info = 1
        self.show_target = 0
        self.sync_value = 0
        self.sync_values_by_feedname = None
        self.sync_values_by_params = {}

        # UI setup.
        self.ui = cameraDisplayUi.Ui_Frame()
        self.ui.setupUi(self)

        self.ui.cameraScrollArea.setStyleSheet(
            "QScrollArea { background-color: black } ")
        self.ui.rangeSlider = qtRangeSlider.QVRangeSlider(
            parent=self.ui.rangeSliderWidget)
        layout = QtGui.QGridLayout(self.ui.rangeSliderWidget)
        layout.addWidget(self.ui.rangeSlider)
        self.ui.rangeSlider.setGeometry(0, 0,
                                        self.ui.rangeSliderWidget.width(),
                                        self.ui.rangeSliderWidget.height())
        self.ui.rangeSlider.setRange([0.0, self.max_intensity, 1.0])
        self.ui.rangeSlider.setEmitWhileMoving(True)

        for color_name in self.color_tables.getColorTableNames():
            self.ui.colorComboBox.addItem(color_name[:-5])

        self.ui.gridAct = QtGui.QAction(self.tr("Show Grid"), self)
        self.ui.infoAct = QtGui.QAction(self.tr("Hide Info"), self)
        self.ui.targetAct = QtGui.QAction(self.tr("Show Target"), self)

        self.ui.cameraShutterButton.hide()
        self.ui.recordButton.hide()
        self.ui.syncLabel.hide()
        self.ui.syncSpinBox.hide()

        # Camera display widget.
        #
        # This is probably not the best way to do this, but the goal is to have the feed viewers
        # use the same display widget as the camera viewers. Knowing that the camera viewers
        # will get initialized first we save what widget they used as a global variable in this
        # module. Then when we go to create a feed viewers (where hardware will be None), we
        # get the widget from this global variable.
        #
        if hardware is not None:
            display_module = hardware.get("module_name")
            a_module = __import__('display.' + display_module, globals(),
                                  locals(), [display_module], -1)
            a_class = getattr(a_module, hardware.get("class_name"))
            global default_widget
            default_widget = a_class
        else:
            a_class = default_widget
        self.camera_widget = a_class(parameters, self.ui.cameraScrollArea)
        self.ui.cameraScrollArea.setWidget(self.camera_widget)

        self.camera_widget.intensityInfo.connect(self.handleIntensityInfo)

        self.ui.autoScaleButton.clicked.connect(self.handleAutoScale)
        self.ui.colorComboBox.currentIndexChanged[str].connect(
            self.handleColorTableChange)
        self.ui.feedComboBox.currentIndexChanged[str].connect(
            self.handleFeedChange)
        self.ui.gridAct.triggered.connect(self.handleGrid)
        self.ui.infoAct.triggered.connect(self.handleInfo)
        self.ui.rangeSlider.doubleClick.connect(self.handleAutoScale)
        self.ui.rangeSlider.rangeChanged.connect(self.handleRangeChange)
        self.ui.syncSpinBox.valueChanged.connect(self.handleSync)
        self.ui.targetAct.triggered.connect(self.handleTarget)

        # Display timer
        self.display_timer.setInterval(100)
        self.display_timer.timeout.connect(self.displayFrame)
        self.display_timer.start()