def __init__(self, parent=None, name=None, fl=0): QtImport.QDialog.__init__(self, parent, QtImport.Qt.WindowFlags(fl)) if name is not None: self.setObjectName(name) # Internal variables -------------------------------------------------- # AsyncResult to return values self._async_result = None # Layout QtImport.QVBoxLayout(self) main_layout = self.layout() main_layout.setSpacing(10) main_layout.setMargin(6) self.setSizePolicy(QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Expanding) self.setWindowTitle("GPhL Workflow parameters") # Info box self.info_gbox = QtImport.QGroupBox("Info", self) QtImport.QVBoxLayout(self.info_gbox) main_layout.addWidget(self.info_gbox) self.info_text = QtImport.QTextEdit(self.info_gbox) self.info_text.setFont(QtImport.QFont("Courier")) self.info_text.setReadOnly(True) self.info_gbox.layout().addWidget(self.info_text) # Special parameter box self.cplx_gbox = QtImport.QGroupBox("Indexing solution", self) QtImport.QVBoxLayout(self.cplx_gbox) main_layout.addWidget(self.cplx_gbox) self.cplx_gbox.setSizePolicy(QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Expanding) self.cplx_widget = None # Parameter box self.parameter_gbox = QtImport.QGroupBox("Parameters", self) main_layout.addWidget(self.parameter_gbox) self.parameter_gbox.setSizePolicy(QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Expanding) self.params_widget = None # Button bar button_layout = QtImport.QHBoxLayout(None) hspacer = QtImport.QSpacerItem(1, 20, QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Minimum) button_layout.addItem(hspacer) self.continue_button = QtImport.QPushButton("Continue", self) button_layout.addWidget(self.continue_button) self.cancel_button = QtImport.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( QtImport.QSize(1018, 472).expandedTo(self.minimumSizeHint()))
def __init__(self, parent=None, name=None, fl=0): QtImport.QWidget.__init__(self, parent, QtImport.Qt.WindowFlags(fl)) if not name: self.setObjectName("VerticalCrystalDimensionWidgetLayout") return VerticalCrystalDimensionWidgetLayoutLayout = QtImport.QVBoxLayout( self, 0, 6, "VerticalCrystalDimensionWidgetLayoutLayout") self.gbox = QtImport.QGroupBox(self, "gbox") self.gbox.setSizePolicy(QtImport.QSizePolicy.MinimumExpanding, QtImport.QSizePolicy.MinimumExpanding) self.gbox.setChecked(0) self.gbox.setColumnLayout(0, QtImport.Qt.Vertical) self.gbox.layout().setSpacing(6) self.gbox.layout().setMargin(11) gboxLayout = QtImport.QHBoxLayout(self.gbox.layout()) gboxLayout.setAlignment(QtImport.Qt.AlignTop) main_layout = QtImport.QVBoxLayout(None, 0, 15, "main_layout") space_group_layout = QtImport.QHBoxLayout(None, 0, 6, "space_group_layout") space_group_ledit_layout = QtImport.QHBoxLayout( None, 0, 6, "space_group_ledit_layout") self.space_group_label = QtImport.QLabel(self.gbox, "space_group_label") space_group_ledit_layout.addWidget(self.space_group_label) self.space_group_ledit = QtImport.QComboBox(0, self.gbox, "space_group_ledit") self.space_group_ledit.setMinimumSize(QtImport.QSize(100, 0)) self.space_group_ledit.setMaximumSize(QtImport.QSize(100, 32767)) space_group_ledit_layout.addWidget(self.space_group_ledit) space_group_layout.addLayout(space_group_ledit_layout) space_group_hspacer = QtImport.QSpacerItem( 1, 20, QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Minimum) space_group_layout.addItem(space_group_hspacer) main_layout.addLayout(space_group_layout) vdim_layout = QtImport.QVBoxLayout(None, 0, 2, "vdim_layout") vdim_heading_layout = QtImport.QHBoxLayout(None, 0, 6, "vdim_heading_layout") self.dimension_label = QtImport.QLabel(self.gbox, "dimension_label") vdim_heading_layout.addWidget(self.dimension_label) vdim_heading_spacer = QtImport.QSpacerItem( 1, 20, QtImport.QSizePolicy.Expanding, QtImport.QSizePolicy.Minimum) vdim_heading_layout.addItem(vdim_heading_spacer) vdim_layout.addLayout(vdim_heading_layout) vdim_control_layout = QtImport.QHBoxLayout(None, 0, 0, "vdim_control_layout") vdim_ledit_hlayout = QtImport.QHBoxLayout(None, 0, 20, "vdim_ledit_hlayout") col_one_vdim_ledit_hlayout = QtImport.QHBoxLayout( None, 0, 6, "col_one_vdim_ledit_hlayout") vlayout_min_vdim_label = QtImport.QVBoxLayout( None, 0, 6, "vlayout_min_vdim_label") self.min_vdim_label = QtImport.QLabel(self.gbox, "min_vdim_label") vlayout_min_vdim_label.addWidget(self.min_vdim_label) self.vdim_min_phi_label = QtImport.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 = QtImport.QVBoxLayout( None, 0, 6, "vlayout_min_vdim_ledit") self.min_vdim_ledit = QtImport.QLineEdit(self.gbox, "min_vdim_ledit") self.min_vdim_ledit.setMinimumSize(QtImport.QSize(50, 0)) self.min_vdim_ledit.setMaximumSize(QtImport.QSize(50, 32767)) vlayout_min_vdim_ledit.addWidget(self.min_vdim_ledit) self.min_vphi_ledit = QtImport.QLineEdit(self.gbox, "min_vphi_ledit") self.min_vphi_ledit.setMinimumSize(QtImport.QSize(50, 0)) self.min_vphi_ledit.setMaximumSize(QtImport.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 = QtImport.QHBoxLayout( None, 0, 6, "col_two_vdim_ledit_hlayout") vlayout_two_vdim_hlayout = QtImport.QVBoxLayout( None, 0, 6, "vlayout_two_vdim_hlayout") self.max_vdim_label = QtImport.QLabel(self.gbox, "max_vdim_label") vlayout_two_vdim_hlayout.addWidget(self.max_vdim_label) self.max_vphi_label = QtImport.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 = QtImport.QVBoxLayout( None, 0, 6, "vlayout_max_vdim_ledit") self.max_vdim_ledit = QtImport.QLineEdit(self.gbox, "max_vdim_ledit") self.max_vdim_ledit.setMinimumSize(QtImport.QSize(50, 0)) self.max_vdim_ledit.setMaximumSize(QtImport.QSize(50, 32767)) vlayout_max_vdim_ledit.addWidget(self.max_vdim_ledit) self.max_vphi_ledit = QtImport.QLineEdit(self.gbox, "max_vphi_ledit") self.max_vphi_ledit.setMinimumSize(QtImport.QSize(50, 0)) self.max_vphi_ledit.setMaximumSize(QtImport.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 = QtImport.QSpacerItem(1, 20, QtImport.QSizePolicy.Expanding, QtImport.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( QtImport.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 QtImport.QApplication.setActiveWindow(main_window) if self.no_border: main_window.move(0, 0) width = QtImport.QApplication.desktop().width() height = QtImport.QApplication.desktop().height() main_window.resize(QtImport.QSize(width, height)) # make connections widgets_dict = dict([( isinstance(w.objectName, collections.Callable) and str(w.objectName()) or None, w, ) for w in QtImport.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: 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) return main_window
def sizeHint(self): return QtImport.QSize(100, 100)
def sizeHint(self): return QtImport.QSize(40, 120)