def __init__(self, parent=None, name=None, fl=0): qt_import.QDialog.__init__(self, parent, qt_import.Qt.WindowFlags(fl)) if name is not None: self.setObjectName(name) # Internal variables -------------------------------------------------- # AsyncResult to return values self._async_result = None # Layout qt_import.QVBoxLayout(self) main_layout = self.layout() main_layout.setSpacing(10) main_layout.setMargin(6) self.setSizePolicy(qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Expanding) self.setWindowTitle("GPhL Workflow parameters") # Info box self.info_gbox = qt_import.QGroupBox("Info", self) qt_import.QVBoxLayout(self.info_gbox) main_layout.addWidget(self.info_gbox) self.info_text = qt_import.QTextEdit(self.info_gbox) self.info_text.setFont(qt_import.QFont("Courier")) self.info_text.setReadOnly(True) self.info_gbox.layout().addWidget(self.info_text) # Special parameter box self.cplx_gbox = qt_import.QGroupBox("Indexing solution", self) qt_import.QVBoxLayout(self.cplx_gbox) main_layout.addWidget(self.cplx_gbox) self.cplx_gbox.setSizePolicy(qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Expanding) self.cplx_widget = None # Parameter box self.parameter_gbox = qt_import.QGroupBox("Parameters", self) main_layout.addWidget(self.parameter_gbox) self.parameter_gbox.setSizePolicy(qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Expanding) self.params_widget = None # Button bar button_layout = qt_import.QHBoxLayout(None) hspacer = qt_import.QSpacerItem(1, 20, qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Minimum) button_layout.addItem(hspacer) self.continue_button = qt_import.QPushButton("Continue", self) button_layout.addWidget(self.continue_button) self.cancel_button = qt_import.QPushButton("Abort", self) button_layout.addWidget(self.cancel_button) main_layout.addLayout(button_layout) self.continue_button.clicked.connect(self.continue_button_click) self.cancel_button.clicked.connect(self.cancel_button_click) self.resize( qt_import.QSize(1018, 472).expandedTo(self.minimumSizeHint()))
def sizeHint(self): return qt_import.QSize(40, 120)
def __init__(self, parent=None, name=None, fl=0): qt_import.QWidget.__init__(self, parent, qt_import.Qt.WindowFlags(fl)) if not name: self.setObjectName("VerticalCrystalDimensionWidgetLayout") return VerticalCrystalDimensionWidgetLayoutLayout = qt_import.QVBoxLayout( self, 0, 6, "VerticalCrystalDimensionWidgetLayoutLayout") self.gbox = qt_import.QGroupBox(self, "gbox") self.gbox.setSizePolicy(qt_import.QSizePolicy.MinimumExpanding, qt_import.QSizePolicy.MinimumExpanding) self.gbox.setChecked(0) self.gbox.setColumnLayout(0, qt_import.Qt.Vertical) self.gbox.layout().setSpacing(6) self.gbox.layout().setMargin(11) gboxLayout = qt_import.QHBoxLayout(self.gbox.layout()) gboxLayout.setAlignment(qt_import.Qt.AlignTop) main_layout = qt_import.QVBoxLayout(None, 0, 15, "main_layout") space_group_layout = qt_import.QHBoxLayout(None, 0, 6, "space_group_layout") space_group_ledit_layout = qt_import.QHBoxLayout( None, 0, 6, "space_group_ledit_layout") self.space_group_label = qt_import.QLabel(self.gbox, "space_group_label") space_group_ledit_layout.addWidget(self.space_group_label) self.space_group_ledit = qt_import.QComboBox(0, self.gbox, "space_group_ledit") self.space_group_ledit.setMinimumSize(qt_import.QSize(100, 0)) self.space_group_ledit.setMaximumSize(qt_import.QSize(100, 32767)) space_group_ledit_layout.addWidget(self.space_group_ledit) space_group_layout.addLayout(space_group_ledit_layout) space_group_hspacer = qt_import.QSpacerItem( 1, 20, qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Minimum) space_group_layout.addItem(space_group_hspacer) main_layout.addLayout(space_group_layout) vdim_layout = qt_import.QVBoxLayout(None, 0, 2, "vdim_layout") vdim_heading_layout = qt_import.QHBoxLayout(None, 0, 6, "vdim_heading_layout") self.dimension_label = qt_import.QLabel(self.gbox, "dimension_label") vdim_heading_layout.addWidget(self.dimension_label) vdim_heading_spacer = qt_import.QSpacerItem( 1, 20, qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Minimum) vdim_heading_layout.addItem(vdim_heading_spacer) vdim_layout.addLayout(vdim_heading_layout) vdim_control_layout = qt_import.QHBoxLayout(None, 0, 0, "vdim_control_layout") vdim_ledit_hlayout = qt_import.QHBoxLayout(None, 0, 20, "vdim_ledit_hlayout") col_one_vdim_ledit_hlayout = qt_import.QHBoxLayout( None, 0, 6, "col_one_vdim_ledit_hlayout") vlayout_min_vdim_label = qt_import.QVBoxLayout( None, 0, 6, "vlayout_min_vdim_label") self.min_vdim_label = qt_import.QLabel(self.gbox, "min_vdim_label") vlayout_min_vdim_label.addWidget(self.min_vdim_label) self.vdim_min_phi_label = qt_import.QLabel(self.gbox, "vdim_min_phi_label") vlayout_min_vdim_label.addWidget(self.vdim_min_phi_label) col_one_vdim_ledit_hlayout.addLayout(vlayout_min_vdim_label) vlayout_min_vdim_ledit = qt_import.QVBoxLayout( None, 0, 6, "vlayout_min_vdim_ledit") self.min_vdim_ledit = qt_import.QLineEdit(self.gbox, "min_vdim_ledit") self.min_vdim_ledit.setMinimumSize(qt_import.QSize(50, 0)) self.min_vdim_ledit.setMaximumSize(qt_import.QSize(50, 32767)) vlayout_min_vdim_ledit.addWidget(self.min_vdim_ledit) self.min_vphi_ledit = qt_import.QLineEdit(self.gbox, "min_vphi_ledit") self.min_vphi_ledit.setMinimumSize(qt_import.QSize(50, 0)) self.min_vphi_ledit.setMaximumSize(qt_import.QSize(50, 32767)) vlayout_min_vdim_ledit.addWidget(self.min_vphi_ledit) col_one_vdim_ledit_hlayout.addLayout(vlayout_min_vdim_ledit) vdim_ledit_hlayout.addLayout(col_one_vdim_ledit_hlayout) col_two_vdim_ledit_hlayout = qt_import.QHBoxLayout( None, 0, 6, "col_two_vdim_ledit_hlayout") vlayout_two_vdim_hlayout = qt_import.QVBoxLayout( None, 0, 6, "vlayout_two_vdim_hlayout") self.max_vdim_label = qt_import.QLabel(self.gbox, "max_vdim_label") vlayout_two_vdim_hlayout.addWidget(self.max_vdim_label) self.max_vphi_label = qt_import.QLabel(self.gbox, "max_vphi_label") vlayout_two_vdim_hlayout.addWidget(self.max_vphi_label) col_two_vdim_ledit_hlayout.addLayout(vlayout_two_vdim_hlayout) vlayout_max_vdim_ledit = qt_import.QVBoxLayout( None, 0, 6, "vlayout_max_vdim_ledit") self.max_vdim_ledit = qt_import.QLineEdit(self.gbox, "max_vdim_ledit") self.max_vdim_ledit.setMinimumSize(qt_import.QSize(50, 0)) self.max_vdim_ledit.setMaximumSize(qt_import.QSize(50, 32767)) vlayout_max_vdim_ledit.addWidget(self.max_vdim_ledit) self.max_vphi_ledit = qt_import.QLineEdit(self.gbox, "max_vphi_ledit") self.max_vphi_ledit.setMinimumSize(qt_import.QSize(50, 0)) self.max_vphi_ledit.setMaximumSize(qt_import.QSize(50, 32767)) vlayout_max_vdim_ledit.addWidget(self.max_vphi_ledit) col_two_vdim_ledit_hlayout.addLayout(vlayout_max_vdim_ledit) vdim_ledit_hlayout.addLayout(col_two_vdim_ledit_hlayout) vdim_control_layout.addLayout(vdim_ledit_hlayout) vspacer = qt_import.QSpacerItem(1, 20, qt_import.QSizePolicy.Expanding, qt_import.QSizePolicy.Minimum) vdim_control_layout.addItem(vspacer) vdim_layout.addLayout(vdim_control_layout) main_layout.addLayout(vdim_layout) gboxLayout.addLayout(main_layout) VerticalCrystalDimensionWidgetLayoutLayout.addWidget(self.gbox) self.languageChange() self.resize( qt_import.QSize(307, 163).expandedTo(self.minimumSizeHint()))
def execute(self, config): """Start in execution mode""" self.splash_screen.set_message("Executing configuration...") self.splash_screen.set_progress_value(90) self.display() main_window = None if len(self.windows) > 0: main_window = self.windows[0] main_window.configuration = config qt_import.QApplication.setActiveWindow(main_window) if self.no_border: main_window.move(0, 0) width = qt_import.QApplication.desktop().width() height = qt_import.QApplication.desktop().height() main_window.resize(qt_import.QSize(width, height)) # make connections widgets_dict = dict([( isinstance(w.objectName, collections.Callable) and str(w.objectName()) or None, w, ) for w in qt_import.QApplication.allWidgets()]) def make_connections(items_list): """Creates connections""" for item in items_list: try: sender = widgets_dict[item["name"]] except KeyError: logging.getLogger().error( "Could not find receiver widget %s" % item["name"]) else: for connection in item["connections"]: _receiver = (connection["receiver"] or connection["receiverWindow"]) try: receiver = widgets_dict[_receiver] except KeyError: logging.getLogger().error( "Could not find " + "receiver widget %s", _receiver) else: try: slot = getattr(receiver, connection["slot"]) # etattr(sender, connection["signal"]).connect(slot) except AttributeError: logging.getLogger().error( "No slot '%s' " % connection["slot"] + "in receiver %s" % _receiver) else: if not isinstance(sender, NullBrick): getattr( sender, connection["signal"]).connect(slot) # sender.connect(sender, # QtCore.SIGNAL(connection["signal"]), # slot) make_connections(item["children"]) self.splash_screen.set_progress_value(95) self.splash_screen.set_message("Connecting bricks...") make_connections(config.windows_list) # set run mode for every brick self.splash_screen.set_progress_value(100) self.splash_screen.set_message("Setting run mode...") BaseWidget.set_run_mode(True) if self.show_maximized: main_window.showMaximized() else: main_window.show() for window in self.windows: if window._show: window.show() if BaseWidget._menubar: BaseWidget._menubar.set_exp_mode(False) HWR.beamline.force_emit_signals() return main_window
def sizeHint(self): return qt_import.QSize(100, 100)