Exemplo n.º 1
0
    def __init__(self, module_name = None, module_params = None, qt_settings = None, **kwds):
        super().__init__(**kwds)
                
        self.close_now = False
        self.close_timer = QtCore.QTimer(self)
        self.film_directory = module_params.get("directory")
        self.menu_items_to_add = []
        self.module_name = module_name
        self.widgets_to_add = []

        # Configure UI.
        if self.classic_view:
            import storm_control.hal4000.qtdesigner.hal4000_ui as hal4000Ui            
        else:
            import storm_control.hal4000.qtdesigner.hal4000_detached_ui as hal4000Ui
            
        self.ui = hal4000Ui.Ui_MainWindow()
        self.ui.setupUi(self)

        # Create layout for the cameraFrame.
        if self.classic_view:
            vbox_layout = QtWidgets.QVBoxLayout(self.ui.cameraFrame)
            vbox_layout.setContentsMargins(0,0,0,0)
            vbox_layout.setSpacing(0)
            self.ui.cameraFrame.setLayout(vbox_layout)

        # Create layout for settings, film, etc..
        vbox_layout = QtWidgets.QVBoxLayout(self.ui.containerWidget)
        vbox_layout.setContentsMargins(0,0,0,0)
        vbox_layout.setSpacing(0)
        self.ui.containerWidget.setLayout(vbox_layout)
                
        # Set icon.
        self.setWindowIcon(qtAppIcon.QAppIcon())

        # Set title
        title = module_params.get("setup_name")
        if (hgit.getBranch().lower() != "master"):
            title += " (" + hgit.getBranch() + ")"
        self.setWindowTitle(title)

        # Configure based on saved settings.
        self.move(qt_settings.value(self.module_name + ".pos", self.pos()))
        self.resize(qt_settings.value(self.module_name + ".size", self.size()))
        self.xml_directory = str(qt_settings.value(self.module_name + ".xml_directory",
                                                   self.film_directory))
        
        # ui signals
        self.ui.actionDirectory.triggered.connect(self.handleDirectory)
        self.ui.actionSettings.triggered.connect(self.handleSettings)
        self.ui.actionShutter.triggered.connect(self.handleShutters)
        self.ui.actionQuit.triggered.connect(self.handleQuit)

        # Configure close timer.
        self.close_timer.setInterval(5)
        self.close_timer.timeout.connect(self.handleCloseTimer)
        self.close_timer.setSingleShot(True)
Exemplo n.º 2
0
    def halDialogInit(self, qt_settings, window_title):
        """
        This is called after sub class specific initialization
        to finish configuring the GUI.
        """
        self.setWindowIcon(qtAppIcon.QAppIcon())
        self.setWindowTitle(window_title)

        self.am_visible = (qt_settings.value(self.module_name + ".visible",
                                             "false") == "true")
        self.move(qt_settings.value(self.module_name + ".pos", self.pos()))
        self.resize(qt_settings.value(self.module_name + ".size", self.size()))

        # Connect signals.
        self.ui.okButton.clicked.connect(self.handleOk)
    def __init__(self,
                 window_title=None,
                 qt_settings=None,
                 parameters=None,
                 **kwds):
        """
        """
        super().__init__(**kwds)
        self.changed_items = {}
        self.module_name = "parameters_editor"
        self.parameters = parameters.copy()
        self.qt_settings = qt_settings

        # Load Ui.
        self.ui = paramsEditorUi.Ui_Dialog()
        self.ui.setupUi(self)

        # Create model & add to the tree view.
        self.editor_model = EditorModel()
        populateModel(self.editor_model, self.parameters)
        self.ui.editorTreeView.setModel(self.editor_model)
        self.ui.editorTreeView.setHeaderHidden(True)
        self.ui.editorTreeView.setItemDelegate(EditorTreeViewDelegate())

        # Configure Ui.
        self.setWindowIcon(qtAppIcon.QAppIcon())
        self.setWindowTitle(window_title)

        self.move(self.qt_settings.value(self.module_name + ".pos",
                                         self.pos()))
        self.resize(
            self.qt_settings.value(self.module_name + ".size", self.size()))

        self.ui.parametersNameLabel.setText(
            getFileName(parameters.get("parameters_file")))
        self.ui.updateButton.setEnabled(False)

        self.editor_model.itemChanged.connect(self.handleItemChanged)
        self.ui.editorTreeView.collapsed.connect(self.handleCollapsed)
        self.ui.editorTreeView.expanded.connect(self.handleExpanded)
        self.ui.okButton.clicked.connect(self.handleOk)
        self.ui.updateButton.clicked.connect(self.handleUpdate)

        # Restore previous tree state, if any.
        self.reExpand()