def __init__(self, parent=None): super(RichTextColumnDelegate, self).__init__(parent) if self.label is None: self.label = QLabel() self.label.setIndent(5) self.label.setTextFormat(Qt.RichText) self.document = QTextDocument()
def __init__(self, phl_obj=None, simp_widg=None, parent=None, upper_label=None): super(ParamMainWidget, self).__init__() self.command_lst = [[None]] self.lst_pair = [] try: self.my_phl_obj = phl_obj self.simp_widg_in = simp_widg except BaseException as e: # We don't want to catch bare exceptions but don't know # what this was supposed to catch. Log it. logger.info("Caught unknown exception #1 type %s: %s", type(e).__name__, e) logger.info("\n\n\n something went wrong here wiht the phil object \n\n\n") self.build_param_widget() label_font = QFont() sys_font_point_size = label_font.pointSize() label_font.setPointSize(sys_font_point_size + 2) self.step_label = QLabel(str(upper_label)) self.step_label.setFont(label_font) self._vbox = QVBoxLayout() self._vbox.addWidget(self.step_label) self._vbox.addWidget(self.dual_level_tab) self.setLayout(self._vbox)
def __init__(self, *args): QLabel.__init__(self, *args) self.setFrameShape(QLabel.Panel) self.setSizePolicy(QSizePolicy(1, 0, self.sizePolicy().hasHeightForWidth())) self.setFont(QFont(guiConf.widgetfontfamily, guiConf.widgetfontsize))
class RunnerWidget(QWidget): def __init__(self, parent, umlmachines, name='RunnerWidget'): QWidget.__init__(self, parent, name) self.app = get_application_pointer() self.umlmachines = umlmachines self.proc = self.umlmachines.run_machine() self._mainbox = QVBoxLayout(self, 5, 7) # add label self.mainlabel = QLabel(self) self.mainlabel.setText('Running Umlmachine %s' % self.umlmachines.current) self._mainbox.addWidget(self.mainlabel) # add stdout viewer logfile = self.umlmachines.stdout_logfile.name self.logbrowser = LogBrowser(self, logfile) self._mainbox.addWidget(self.logbrowser) self.timer = QTimer(self) self.connect(self.timer, SIGNAL('timeout()'), self.update_progress) self.timer.startTimer(1000) def update_progress(self): #retval = self.proc.poll() #print retval retval = None if retval is not None: print retval self.close()
class BootStrapperWidget(QWidget): def __init__(self, parent, suite, name='RunnerWidget'): QWidget.__init__(self, parent, name) self.app = get_application_pointer() cfg = self.app.umlcfg basefile = make_base_filesystem(suite, '%s.base' % suite, cfg=cfg, size=300, mkfs='mke2fs') self.bootstrapper = UmlBootstrapper(suite, basefile, cfg=self.cfg) self._mainbox = QVBoxLayout(self, 5, 7) # add label self.mainlabel = QLabel(self) self.mainlabel.setText('Bootstrapping suite %s' % suite) self._mainbox.addWidget(self.mainlabel) # add stdout viewer logfile = self.umlmachines.stdout_logfile.name self.logbrowser = LogBrowser(self, logfile) self._mainbox.addWidget(self.logbrowser) self.timer = QTimer(self) self.connect(self.timer, SIGNAL('timeout()'), self.update_progress) self.timer.startTimer(1000) def update_progress(self): #retval = self.proc.poll() #print retval retval = None if retval is not None: print retval self.close()
def __init__(self, url, username, password): KDialog.__init__(self) decorateWindow(self, i18n('Create User Account')) self.setButtons(KDialog.ButtonCode(KDialog.Ok | KDialog.Cancel)) vbox = QVBoxLayout() grid = QFormLayout() self.lbServer = QLabel() self.lbServer.setText(url) grid.addRow(i18n('Game server:'), self.lbServer) self.lbUser = QLabel() grid.addRow(i18n('Username:'******'Password:'******'Repeat password:'), self.edPassword2) vbox.addLayout(grid) widget = QWidget(self) widget.setLayout(vbox) self.setMainWidget(widget) pol = QSizePolicy() pol.setHorizontalPolicy(QSizePolicy.Expanding) self.lbUser.setSizePolicy(pol) self.edPassword.textChanged.connect(self.passwordChanged) self.edPassword2.textChanged.connect(self.passwordChanged) StateSaver(self) self.username = username self.password = password self.passwordChanged() self.edPassword2.setFocus()
def __init__(self, parent, handler): BaseMachineDialog.__init__(self, parent, handler) self.parentLbl = QLabel(self.frame) self.parentLbl.setText("parent") self.parentEntry = KLineEdit(self.frame) self.vbox.addWidget(self.parentLbl) self.vbox.addWidget(self.parentEntry)
def __init__(self, parent=None): super(IntegrateSimplerParamTab, self).__init__() # self.param_widget_parent = parent.param_widget_parent localLayout = QVBoxLayout() PrFit_lay_out = QHBoxLayout() label_PrFit = QLabel("Use profile fitting") PrFit_lay_out.addWidget(label_PrFit) PrFit_comb_bx = DefaultComboBox("integration.profile.fitting", ["True", "False", "Auto"]) PrFit_comb_bx.currentIndexChanged.connect(self.combobox_changed) PrFit_lay_out.addWidget(PrFit_comb_bx) localLayout.addLayout(PrFit_lay_out) hbox_lay_algorithm_53 = QHBoxLayout() label_algorithm_53 = QLabel("Background algorithm") hbox_lay_algorithm_53.addWidget(label_algorithm_53) box_algorithm_53 = DefaultComboBox( "integration.background.algorithm", ["simple", "null", "median", "gmodel", "glm"], default_index=4) box_algorithm_53.currentIndexChanged.connect(self.combobox_changed) hbox_lay_algorithm_53.addWidget(box_algorithm_53) localLayout.addLayout(hbox_lay_algorithm_53) hbox_d_min = QHBoxLayout() label_d_min = QLabel("High resolution limit") hbox_d_min.addWidget(label_d_min) d_min_spn_bx = QDoubleSpinBox() d_min_spn_bx.local_path = "prediction.d_min" d_min_spn_bx.setSpecialValueText("None") d_min_spn_bx.setValue(0.0) hbox_d_min.addWidget(d_min_spn_bx) d_min_spn_bx.editingFinished.connect(self.spnbox_finished) localLayout.addLayout(hbox_d_min) hbox_lay_nproc = QHBoxLayout() label_nproc = QLabel("Number of jobs") # label_nproc.setFont( QFont("Monospace", 10)) hbox_lay_nproc.addWidget(label_nproc) self.box_nproc = QSpinBox() self.box_nproc.local_path = "integration.mp.nproc" self.box_nproc.editingFinished.connect(self.spnbox_finished) hbox_lay_nproc.addWidget(self.box_nproc) localLayout.addLayout(hbox_lay_nproc) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.box_nproc.tmp_lst = None self.lst_var_widg = _get_all_direct_layout_widget_children(localLayout)
def setupUILastTileMeld(self, pGrid): """setup UI elements for last tile and last meld""" self.lblLastTile = QLabel(i18n('&Last Tile:')) self.cbLastTile = QComboBox() self.cbLastTile.setMinimumContentsLength(1) vpol = QSizePolicy() vpol.setHorizontalPolicy(QSizePolicy.Fixed) self.cbLastTile.setSizePolicy(vpol) self.cbLastTile.setSizeAdjustPolicy( QComboBox.AdjustToMinimumContentsLengthWithIcon) self.lblLastTile.setBuddy(self.cbLastTile) self.lblLastMeld = QLabel(i18n('L&ast Meld:')) self.prevLastTile = None self.cbLastMeld = QComboBox() self.cbLastMeld.setMinimumContentsLength(1) self.cbLastMeld.setSizePolicy(vpol) self.cbLastMeld.setSizeAdjustPolicy( QComboBox.AdjustToMinimumContentsLengthWithIcon) self.lblLastMeld.setBuddy(self.cbLastMeld) self.comboTilePairs = set() pGrid.setRowStretch(6, 5) pGrid.addWidget(self.lblLastTile, 7, 0, 1, 2) pGrid.addWidget(self.cbLastTile, 7, 2, 1, 1) pGrid.addWidget(self.lblLastMeld, 8, 0, 1, 2) pGrid.addWidget(self.cbLastMeld, 8, 2, 1, 2)
def __init__(self, parent, umlmachines, name='InstallerWidget'): QWidget.__init__(self, parent, name) self.resize(600, 600) self.app = get_application_pointer() self.conn = self.app.conn self.umlmachines = umlmachines self.machine = self.umlmachines.current self.current_machine_process = 'start' self.current_profile = None self.current_trait = None self.traitlist = [] self.curenv = CurrentEnvironment(self.conn, self.machine) self.curenv['current_profile'] = 'None' self.curenv['current_trait'] = 'None' self.curenv['current_machine_process'] = self.current_machine_process self.timer = QTimer(self) self.connect(self.timer, SIGNAL('timeout()'), self.update_progress) self.timer.startTimer(1000) self.grid = QGridLayout(self, 4, 1, 5, 7) self.main_label = QLabel(self) self.main_label.setText(self._msg()) self.grid.addWidget(self.main_label, 0, 0) self.profile_progress_lbl = QLabel(self) self.grid.addWidget(self.profile_progress_lbl, 1, 0) self.profile_progress = KProgress(self) self.grid.addWidget(self.profile_progress, 2, 0) self.logview = LogBrowser(self, '/tmp/uml-installer.log') self.grid.addWidget(self.logview, 3, 0) #self.console_view = StdOutBrowser(self) #self.console_view = KTextBrowser(self) #self.grid.addWidget(self.console_view, 4, 0) self.console_text = ''
class BootStrapperWidget(QWidget): def __init__(self, parent, suite, name="RunnerWidget"): QWidget.__init__(self, parent, name) self.app = get_application_pointer() cfg = self.app.umlcfg basefile = make_base_filesystem(suite, "%s.base" % suite, cfg=cfg, size=300, mkfs="mke2fs") self.bootstrapper = UmlBootstrapper(suite, basefile, cfg=self.cfg) self._mainbox = QVBoxLayout(self, 5, 7) # add label self.mainlabel = QLabel(self) self.mainlabel.setText("Bootstrapping suite %s" % suite) self._mainbox.addWidget(self.mainlabel) # add stdout viewer logfile = self.umlmachines.stdout_logfile.name self.logbrowser = LogBrowser(self, logfile) self._mainbox.addWidget(self.logbrowser) self.timer = QTimer(self) self.connect(self.timer, SIGNAL("timeout()"), self.update_progress) self.timer.startTimer(1000) def update_progress(self): # retval = self.proc.poll() # print retval retval = None if retval is not None: print retval self.close()
def __init__(self, wind=None, roundsFinished=0, parent=None): QLabel.__init__(self, parent) self.__wind = None if wind is None: wind = East self.__roundsFinished = roundsFinished self.wind = wind
def __init__(self, parent, umlmachines, name="InstallerWidget"): QWidget.__init__(self, parent, name) self.resize(600, 600) self.app = get_application_pointer() self.conn = self.app.conn self.umlmachines = umlmachines self.machine = self.umlmachines.current self.current_machine_process = "start" self.current_profile = None self.current_trait = None self.traitlist = [] self.curenv = CurrentEnvironment(self.conn, self.machine) self.curenv["current_profile"] = "None" self.curenv["current_trait"] = "None" self.curenv["current_machine_process"] = self.current_machine_process self.timer = QTimer(self) self.connect(self.timer, SIGNAL("timeout()"), self.update_progress) self.timer.startTimer(1000) self.grid = QGridLayout(self, 4, 1, 5, 7) self.main_label = QLabel(self) self.main_label.setText(self._msg()) self.grid.addWidget(self.main_label, 0, 0) self.profile_progress_lbl = QLabel(self) self.grid.addWidget(self.profile_progress_lbl, 1, 0) self.profile_progress = KProgress(self) self.grid.addWidget(self.profile_progress, 2, 0) self.logview = LogBrowser(self, "/tmp/uml-installer.log") self.grid.addWidget(self.logview, 3, 0) # self.console_view = StdOutBrowser(self) # self.console_view = KTextBrowser(self) # self.grid.addWidget(self.console_view, 4, 0) self.console_text = ""
def __init__(self, parent=None): super(RefineSimplerParamTab, self).__init__() # self.param_widget_parent = parent.param_widget_parent localLayout = QVBoxLayout() hbox_lay_scan_varying = QHBoxLayout() label_scan_varying = QLabel("Scan varying refinement") hbox_lay_scan_varying.addWidget(label_scan_varying) box_scan_varying = DefaultComboBox( "refinement.parameterisation.scan_varying", ["True", "False", "Auto"], default_index=2) box_scan_varying.currentIndexChanged.connect(self.combobox_changed) hbox_lay_scan_varying.addWidget(box_scan_varying) localLayout.addLayout(hbox_lay_scan_varying) ########################################################################### hbox_lay_outlier_algorithm = QHBoxLayout() label_outlier_algorithm = QLabel("Outlier rejection algorithm") hbox_lay_outlier_algorithm.addWidget(label_outlier_algorithm) box_outlier_algorithm = DefaultComboBox( "refinement.reflections.outlier.algorithm", ["null", "Auto", "mcd", "tukey", "sauter_poon"], default_index=1) box_outlier_algorithm.currentIndexChanged.connect( self.combobox_changed) hbox_lay_outlier_algorithm.addWidget(box_outlier_algorithm) localLayout.addLayout(hbox_lay_outlier_algorithm) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = [] self.lst_var_widg.append(box_scan_varying) self.lst_var_widg.append(label_scan_varying) # self.lst_var_widg.append(box_beam_fix) # self.lst_var_widg.append(label_beam_fix) # self.lst_var_widg.append(box_crystal_fix) # self.lst_var_widg.append(label_crystal_fix) # self.lst_var_widg.append(box_detector_fix) # self.lst_var_widg.append(label_detector_fix) # self.lst_var_widg.append(box_goniometer_fix) # self.lst_var_widg.append(label_goniometer_fix) self.lst_var_widg.append(box_outlier_algorithm) self.lst_var_widg.append(label_outlier_algorithm)
def __init__(self, parent, name='NewAptKeyDialog'): VBoxDialog.__init__(self, parent, name=name) self.name_label = QLabel('name', self.vbox) self.name_entry = KLineEdit(self.vbox) self.data_lable = QLabel('data', self.vbox) self.data_entry = KTextEdit(self.vbox) self.resize(300, 500) self.setCaption('Enter new key')
def __init__(self, parent, handler): BaseMachineDialog.__init__(self, parent, handler) self.kernelLbl = QLabel(self.frame) self.kernelLbl.setText('Name of kernel package') self.kernelEntry = KLineEdit(self.frame) self.vbox.addWidget(self.kernelLbl) self.vbox.addWidget(self.kernelEntry) self.dbaction = 'insert'
def _make_box(self, text, choices): lbl = QLabel(self.frame) lbl.setText(text) box = KComboBox(self.frame) box.insertStrList(choices) self.vbox.addWidget(lbl) self.vbox.addWidget(box) return lbl, box
def __init__(self, parent, handler): BaseMachineDialog.__init__(self, parent, handler) self.machnameLbl = QLabel(self.frame) self.machnameLbl.setText('Machine Name') self.machnameEntry = KLineEdit(self.frame) self.vbox.addWidget(self.machnameLbl) self.vbox.addWidget(self.machnameEntry) self.dbaction = 'insert'
def __init__(self, parent, handler, attribute): BaseMachineDialog.__init__(self, parent, handler) self.attributeLbl = QLabel(self.frame) self.attributeLbl.setText(attribute) self.attributeEntry = KLineEdit(self.frame) self.vbox.addWidget(self.attributeLbl) self.vbox.addWidget(self.attributeEntry) self.attribute = attribute
def __init__(self, parent=None): super(ImportPage, self).__init__(parent=None) main_v_box = QVBoxLayout() label_font = QFont() sys_font_point_size = label_font.pointSize() label_font.setPointSize(sys_font_point_size + 2) step_label = QLabel(str("Import")) step_label.setFont(label_font) self.simple_lin = QLineEdit(self) self.simple_lin.textChanged.connect(self.update_command) self.x_spn_bx = QSpinBox() self.x_spn_bx.setMaximum(99999) self.x_spn_bx.setSpecialValueText(" ") self.y_spn_bx = QSpinBox() self.y_spn_bx.setMaximum(99999) self.y_spn_bx.setSpecialValueText(" ") self.x_spn_bx.valueChanged.connect(self.x_beam_changed) self.y_spn_bx.valueChanged.connect(self.y_beam_changed) self.chk_invert = QCheckBox("Invert rotation axis") self.chk_invert.stateChanged.connect(self.inv_rota_changed) self.opn_fil_btn = QPushButton(" \n Select file(s) \n ") main_path = get_main_path() self.opn_fil_btn.setIcon(QIcon(main_path + "/resources/import.png")) self.opn_fil_btn.setIconSize(QSize(80, 48)) main_v_box.addWidget(step_label) main_v_box.addWidget(self.opn_fil_btn) main_v_box.addWidget(self.simple_lin) self.b_cetre_label = QLabel("\n\n Beam centre") main_v_box.addWidget(self.b_cetre_label) cent_hbox = QHBoxLayout() self.x_label = QLabel(" X: ") cent_hbox.addWidget(self.x_label) cent_hbox.addWidget(self.x_spn_bx) self.y_label = QLabel(" Y: ") cent_hbox.addWidget(self.y_label) cent_hbox.addWidget(self.y_spn_bx) # cent_hbox.addWidget(QLabel(" \n ")) cent_hbox.addStretch() main_v_box.addLayout(cent_hbox) main_v_box.addWidget(self.chk_invert) main_v_box.addStretch() self.opn_fil_btn.clicked.connect(self.open_files) self.defa_dir = str(os.getcwd()) self.setLayout(main_v_box) # self.show() self.reset_par()
def __init__(self, parent, text='', name='LabeledProgress'): QWidget.__init__(self, parent, name) self.grid = QGridLayout(self, 2, 1, 5, 7) self.label = QLabel(self) if text: self.label.setText(text) self.progressbar = SimpleProgress(self) self.grid.addWidget(self.label, 0, 0) self.grid.addWidget(self.progressbar, 1, 0)
class WidgetSeleccionCaja(QVBox): """El elemento de seleccion más sencillo. Solo contiene una caja""" def __init__(self, nombre, parent = None): from Driza.iuqt3.widgetsqt import WidgetListaListBox QVBox.__init__(self, parent) self.label = QLabel(self) self.label.setText(nombre) self.caja = WidgetListaListBox(self)
def __init__(self, phl_obj=None, parent=None): super(IndexSimplerParamTab, self).__init__() # self.param_widget_parent = parent.param_widget_parent # indexing_method_check = QCheckBox("indexing.method") hbox_method = QHBoxLayout() label_method_62 = QLabel("Indexing method") hbox_method.addWidget(label_method_62) box_method_62 = DefaultComboBox( "indexing.method", ["fft3d", "fft1d", "real_space_grid_search", "low_res_spot_match"]) box_method_62.currentIndexChanged.connect(self.combobox_changed) hbox_method.addWidget(box_method_62) max_cell_label = QLabel("Max cell") max_cell_spn_bx = QDoubleSpinBox() max_cell_spn_bx.setSingleStep(5.0) max_cell_spn_bx.local_path = "indexing.max_cell" max_cell_spn_bx.setSpecialValueText("Auto") max_cell_spn_bx.editingFinished.connect(self.spnbox_finished) space_group_label = QLabel("Space group") space_group_line = QLineEdit() # Simple validator to allow only characters in H-M symbols regex = QRegExp("[ABCPIFR][0-9a-d\-/:nmHR]+") validatorHM = QRegExpValidator(regex) space_group_line.setValidator(validatorHM) space_group_line.local_path = "indexing.known_symmetry.space_group" space_group_line.editingFinished.connect(self.line_changed) unit_cell_label = QLabel("Unit cell") unit_cell_line = QLineEdit() regex = QRegExp("[0-9\., ]+") validatorUC = QRegExpValidator(regex) unit_cell_line.setValidator(validatorUC) unit_cell_line.local_path = "indexing.known_symmetry.unit_cell" unit_cell_line.editingFinished.connect(self.line_changed) localLayout = QVBoxLayout() localLayout.addLayout(hbox_method) qf = QFormLayout() qf.addRow(max_cell_label, max_cell_spn_bx) qf.addRow(space_group_label, space_group_line) qf.addRow(unit_cell_label, unit_cell_line) localLayout.addLayout(qf) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = _get_all_direct_layout_widget_children(localLayout)
def __init__(self, parent, handler, machine): BaseMachineDialog.__init__(self, parent, handler) self.machine = machine self.machLbl = QLabel(self.frame) self.machLbl.setText('Edit Machine %s' % machine) self.vbox.addWidget(self.machLbl) self._make_common_boxes() self._set_combo_boxes(self.handler.current) self.dbaction = 'update'
def __init_widgets_categorias(self): """Inicializa los widgets de cada categoria""" from sets import ImmutableSet for categoria in self.__gestorcategorias.listacategorias: tmpset = ImmutableSet(categoria.etiquetas) label = QLabel(None, "") label.setAlignment(QLabel.WordBreak) label.setText(categoria.descripcion) self.__diccionariowidgets["categorias"][tmpset] = label self.widgetStack1.addWidget(label)
class NewMachineDialog(BaseMachineDialog): def __init__(self, parent, handler): BaseMachineDialog.__init__(self, parent, handler) self.machnameLbl = QLabel(self.frame) self.machnameLbl.setText('Machine Name') self.machnameEntry = KLineEdit(self.frame) self.vbox.addWidget(self.machnameLbl) self.vbox.addWidget(self.machnameEntry) self._make_common_boxes() self.dbaction = 'insert'
def __init__(self, parent=None): super(ScaleSimplerParamTab, self).__init__() localLayout = QVBoxLayout() hbox_lay_mod = QHBoxLayout() label_mod = QLabel("Model") hbox_lay_mod.addWidget(label_mod) box_mod = DefaultComboBox("model", ["physical", "array", "KB"]) box_mod.currentIndexChanged.connect(self.combobox_changed) hbox_lay_mod.addWidget(box_mod) hbox_lay_wgh_opt_err = QHBoxLayout() label_wgh_opt_err = QLabel("Error optimisation model") hbox_lay_wgh_opt_err.addWidget(label_wgh_opt_err) box_wgh_opt_err = DefaultComboBox("weighting.error_model.error_model", ["basic", "None"]) box_wgh_opt_err.currentIndexChanged.connect(self.combobox_changed) hbox_lay_wgh_opt_err.addWidget(box_wgh_opt_err) """ weighting { error_model { error_model = *basic None """ hbox_d_min = QHBoxLayout() d_min_label = QLabel("High resolution limit") d_min_spn_bx = QDoubleSpinBox() d_min_spn_bx.local_path = "cut_data.d_min" d_min_spn_bx.setSpecialValueText("None") d_min_spn_bx.setValue(0.0) hbox_d_min.addWidget(d_min_label) hbox_d_min.addWidget(d_min_spn_bx) d_min_spn_bx.editingFinished.connect(self.spnbox_finished) localLayout.addLayout(hbox_lay_mod) localLayout.addLayout(hbox_lay_wgh_opt_err) localLayout.addLayout(hbox_d_min) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = [] self.lst_var_widg.append(box_mod) self.lst_var_widg.append(label_mod) self.lst_var_widg.append(box_wgh_opt_err) self.lst_var_widg.append(label_wgh_opt_err) self.lst_var_widg.append(d_min_spn_bx) self.lst_var_widg.append(d_min_label)
def addressidSelected(self, url): addressid = int(str(url).split('.')[2]) self.enableButtonOK(True) self.dialogs['address'].done(0) self.grid.selButton.close() n = self.grid.fields.index('addressid') + 1 text = AddressLink(self.db, addressid).toxml() lbl = QLabel(text, self.page) lbl.show() self.grid.addMultiCellWidget(lbl, n, n, 1, 1) self.addressid = addressid
class MachineParentDialog(BaseMachineDialog): def __init__(self, parent, handler): BaseMachineDialog.__init__(self, parent, handler) self.parentLbl = QLabel(self.frame) self.parentLbl.setText("parent") self.parentEntry = KLineEdit(self.frame) self.vbox.addWidget(self.parentLbl) self.vbox.addWidget(self.parentEntry) def slotOkClicked(self): pass
def set_ref(self, in_json_path, lin_num): my_box = QVBoxLayout() self.my_inner_table = ReindexTable(self) cwd_path = os.path.join(sys_arg.directory, "dui_files") full_json_path = os.path.join(cwd_path, in_json_path) self.my_inner_table.add_opts_lst(json_path=full_json_path) if self.my_inner_table.rec_col is not None: my_solu = self.my_inner_table.find_best_solu() self.my_inner_table.opt_clicked(my_solu, 0) recomd_str = "Select a bravais lattice to enforce: \n" try: recomd_str += "(best guess solution = row {})".format( self.my_inner_table.tmp_sel + 1) except BaseException as e: # Since we don't know exactly what this was supposed to be # - AttributeError? We don't know how to cleanly catch logger.error("Unknown exception catch caught. Was: %s", e) recomd_str += "(no best solution could be automatically determined)" bot_box = QHBoxLayout() bot_box.addWidget(QLabel(recomd_str)) bot_box.addStretch() ok_but = QPushButton(" OK ") ok_but.clicked.connect(self.my_inner_table.ok_clicked) bot_box.addWidget(ok_but) heather_text, v_heather_size = heather_text_from_lin( lin_num, full_json_path) my_box.addWidget(QLabel(heather_text)) my_box.addWidget(self.my_inner_table) my_box.addLayout(bot_box) self.setLayout(my_box) n_col = self.my_inner_table.columnCount() tot_width = 80 for col in range(n_col): loc_width = self.my_inner_table.columnWidth(col) tot_width += loc_width n_row = self.my_inner_table.rowCount() row_height = self.my_inner_table.rowHeight(1) tot_heght = int((float(n_row)) * float(row_height)) tot_heght += int( (float(v_heather_size + 2)) * float(row_height * 0.62)) self.resize(tot_width, tot_heght) # self.adjustSize() self.show()
class AuditGameDialog(BaseDialogWindow): def __init__(self, parent, name='AuditGameDialog'): BaseDialogWindow.__init__(self, parent, name=name) #self.grid = QGridLayout(self, 2, 1, 5, 7) self.frame = KTextBrowser(self) self.frame.setNotifyClick(True) self.frame.setSource = self.setSource self.doc = AuditGameDocument(self.app) #self.grid.addWidget(self.frame, 0, 0) self.progress_label = QLabel(self) self.progress = KProgress(self) #self.grid.addWidget(self.progress, 1, 0) self.setMainWidget(self.frame) layout = self.layout() # we use insertWidget instead of # addWidget here so the widgets # are above the dialog buttons # self frame should be at 0 index in the layout # we set the progress and label below this layout.insertWidget(1, self.progress) # inserting into index 1 here knocks self.progress down to 2 layout.insertWidget(1, self.progress_label) # disable and hide extra buttons self.enableButtonApply(False) self.showButtonApply(False) self.enableButtonCancel(False) self.showButtonCancel(False) # the dialog should be a little taller than what # it defaults to self.resize(0, 300) def report_md5check(self, filename, count): self.progress_label.setText('checking %s' % filename) self.progress.setProgress(count) self.app.processEvents() def audit_game(self, name, from_install=True, time='now'): filehandler = self.app.make_new_fileshandler() total = len(filehandler.datahandler.get_installed_files(name)) self.progress.setTotalSteps(total) filehandler.archivehelper.report_installed_file_handled = self.report_md5check unchanged, changed, extra = filehandler.audit_game_files(name, from_install=from_install, time=time) self.doc.set_info(unchanged, changed, extra) self.frame.setText(self.doc.output()) self.progress_label.setText('Audit Completed') def setSource(self, url): print url if url == 'show': self.doc.append_unchanged_files() self.frame.setText(self.doc.output())
class NewKernelDialog(BaseMachineDialog): def __init__(self, parent, handler): BaseMachineDialog.__init__(self, parent, handler) self.kernelLbl = QLabel(self.frame) self.kernelLbl.setText('Name of kernel package') self.kernelEntry = KLineEdit(self.frame) self.vbox.addWidget(self.kernelLbl) self.vbox.addWidget(self.kernelEntry) self.dbaction = 'insert' def slotOkClicked(self): kernel = str(self.kernelEntry.text()) self.handler.add_kernel(kernel)
def __init__(self, parent, handler): VboxDialog.__init__(self, parent) self.diskconfig = handler self.diskconfigLbl = QLabel(self.frame) self.diskconfigLbl.setText('DiskConfig Name') self.diskconfigEntry = KLineEdit(self.frame) self.contentLbl = QLabel(self.frame) self.contentLbl.setText('DiskConfig Content') self.contentEntry = KTextEdit(self.frame) self.vbox.addWidget(self.diskconfigLbl) self.vbox.addWidget(self.diskconfigEntry) self.vbox.addWidget(self.contentLbl) self.vbox.addWidget(self.contentEntry) self.connect(self, SIGNAL('okClicked()'), self.slotOkClicked)
class NewMachineDialog(BaseMachineDialog): def __init__(self, parent, handler): BaseMachineDialog.__init__(self, parent, handler) self.machnameLbl = QLabel(self.frame) self.machnameLbl.setText('Machine Name') self.machnameEntry = KLineEdit(self.frame) self.vbox.addWidget(self.machnameLbl) self.vbox.addWidget(self.machnameEntry) self.dbaction = 'insert' def slotOkClicked(self): machine = str(self.machnameEntry.text()) print "slotOkClicked", machine self.handler.make_a_machine(machine)
def __init__(self, parent, name='DosboxPathPage'): BaseConfigWidget.__init__(self, parent, name=name) numrows = 2 numcols = 1 margin = 5 space = 7 self.grid = QGridLayout(self, numrows, numcols, margin, space, 'DosboxPathPageLayout') lbl = QLabel(dosbox_path_lbl, self) lbl.setFrameStyle(lbl.Panel + lbl.Sunken) #lbl.setFrameStyle(lbl.Raised) self.grid.addWidget(lbl, 0, 0) self.dosbox_path_entry = ConfigKURLSelectWidget(self, 'Path to main dosbox area', filetype='dir') self.grid.addWidget(self.dosbox_path_entry, 1, 0)
def _setup_fields(self, text): if text is None: text = '<b>insert a simple record</b>' refdata = None # check if the record has refdata if self.record is not None and hasattr(self.record, '_refdata'): refdata = self.record._refdata for field_index in range(len(self.fields)): field = self.fields[field_index] # here we make either a label or button if refdata is not None and field in refdata.cols: button = KPushButton('select/create', self) self._refbuttons[field] = button # add button to grid (column 1) self.grid.addWidget(button, field_index + 1, 1) # make buddy the button buddy = button else: record_value = '' if self.record is not None: record_value = self.record[field] entry = KLineEdit(record_value, self) self.entries[field] = entry self.grid.addWidget(entry, field_index + 1, 1) # make buddy the entry buddy = entry # make the label lbl_text = '&%s' % field lbl_name = '%sLabel' % field # buddy may not be well defined, or appropriate here label = QLabel(buddy, lbl_text, self, lbl_name) self.grid.addWidget(label, field_index + 1, 0) self.text_label = QLabel(text, self) self.grid.addMultiCellWidget(self.text_label, 0, 0, 0, 1)
class EditMachineDIalog(BaseMachineDialog): def __init__(self, parent, handler, machine): BaseMachineDialog.__init__(self, parent, handler) self.machine = machine self.machLbl = QLabel(self.frame) self.machLbl.setText('Edit Machine %s' % machine) self.vbox.addWidget(self.machLbl) self._make_common_boxes() self._set_combo_boxes(self.handler.current) self.dbaction = 'update' def _set_combo_boxes(self, row): kernel = self._lists['kernels'].index(row.kernel) self.kernelBox.setCurrentItem(kernel) profile = self._lists['profiles'].index(row.profile) self.profileBox.setCurrentItem(profile)
class LabeledProgress(QWidget): def __init__(self, parent, text='', name='LabeledProgress'): QWidget.__init__(self, parent, name) self.grid = QGridLayout(self, 2, 1, 5, 7) self.label = QLabel(self) if text: self.label.setText(text) self.progressbar = SimpleProgress(self) self.grid.addWidget(self.label, 0, 0) self.grid.addWidget(self.progressbar, 1, 0) def setTotalSteps(self, total): self.progressbar.setTotalSteps(total) def step_progress(self, *args): self.progressbar.step_progress(*args)
def __init__(self, parent, name='AuditGameDialog'): BaseDialogWindow.__init__(self, parent, name=name) #self.grid = QGridLayout(self, 2, 1, 5, 7) self.frame = KTextBrowser(self) self.frame.setNotifyClick(True) self.frame.setSource = self.setSource self.doc = AuditGameDocument(self.app) #self.grid.addWidget(self.frame, 0, 0) self.progress_label = QLabel(self) self.progress = KProgress(self) #self.grid.addWidget(self.progress, 1, 0) self.setMainWidget(self.frame) layout = self.layout() # we use insertWidget instead of # addWidget here so the widgets # are above the dialog buttons # self frame should be at 0 index in the layout # we set the progress and label below this layout.insertWidget(1, self.progress) # inserting into index 1 here knocks self.progress down to 2 layout.insertWidget(1, self.progress_label) # disable and hide extra buttons self.enableButtonApply(False) self.showButtonApply(False) self.enableButtonCancel(False) self.showButtonCancel(False) # the dialog should be a little taller than what # it defaults to self.resize(0, 300)
def _setupfields(self, parent): for f in range(len(self.fields)): entry = KLineEdit('', parent) self.entries[self.fields[f]] = entry self.addWidget(entry, f + 1, 1) label = QLabel(entry, self.fields[f], parent, self.fields[f]) self.addWidget(label, f + 1, 0)
def __init__(self, phl_obj=None, parent=None): super(IndexSimplerParamTab, self).__init__() # self.param_widget_parent = parent.param_widget_parent # indexing_method_check = QCheckBox("indexing.method") hbox_method = QHBoxLayout() label_method_62 = QLabel("Indexing Method") hbox_method.addWidget(label_method_62) box_method_62 = QComboBox() box_method_62.tmp_lst = [] box_method_62.local_path = "indexing.method" box_method_62.tmp_lst.append("fft3d") box_method_62.tmp_lst.append("fft1d") box_method_62.tmp_lst.append("real_space_grid_search") box_method_62.tmp_lst.append("low_res_spot_match") for lst_itm in box_method_62.tmp_lst: box_method_62.addItem(lst_itm) box_method_62.currentIndexChanged.connect(self.combobox_changed) hbox_method.addWidget(box_method_62) localLayout = QVBoxLayout() localLayout.addLayout(hbox_method) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = _get_all_direct_layout_widget_children(localLayout)
def __init__(self, parent=None): super(SymmetrySimplerParamTab, self).__init__() hbox_d_min = QHBoxLayout() localLayout = QVBoxLayout() label_d_min = QLabel("d_min") hbox_d_min.addWidget(label_d_min) d_min_spn_bx = QDoubleSpinBox() d_min_spn_bx.local_path = "d_min" d_min_spn_bx.setSpecialValueText("Auto") d_min_spn_bx.setValue(0.0) hbox_d_min.addWidget(d_min_spn_bx) d_min_spn_bx.valueChanged.connect(self.spnbox_changed) localLayout.addLayout(hbox_d_min) self.inner_reset_btn = ResetButton() localLayout.addWidget(self.inner_reset_btn) localLayout.addStretch() self.setLayout(localLayout) self.lst_var_widg = [] self.lst_var_widg.append(d_min_spn_bx) self.lst_var_widg.append(label_d_min)
def __init__(self, interfazdato, cajadisponible): """Caja disponible son los elementos que aparecen a la izquierda en el selector""" #VARIABLES PUBLICAS QWidget.__init__(self, None, "selector", 0) image1 = QPixmap(IMAGE1DATA) image2 = QPixmap(IMAGE2DATA) selectorsimplelayout = QHBoxLayout(self, 11, 6, "WSelectorSimpleLayout") layout2 = QVBoxLayout(None, 0, 6, "layout2") widgetstack1 = QWidgetStack(self, "staaack") widgetstack1.addWidget(cajadisponible) widgetstack1.raiseWidget(cajadisponible) widgetstack1.setSizePolicy(QSizePolicy(\ QSizePolicy.Expanding, QSizePolicy.Expanding, \ 0, 0, widgetstack1.sizePolicy().hasHeightForWidth())) self._cajadisponible = cajadisponible layout2.addWidget(widgetstack1) selectorsimplelayout.addLayout(layout2) layout1 = QVBoxLayout(None, 0, 6, "layout1") self.__pushbutton1 = QPushButton(self, "pushButton1") self.__pushbutton1.setMaximumSize(QSize(30, 30)) self.__pushbutton1.setPixmap(image1) layout1.addWidget(self.__pushbutton1) spacer1 = QSpacerItem(30, 122, QSizePolicy.Minimum, QSizePolicy.Expanding) layout1.addItem(spacer1) self.__pushbutton2 = QPushButton(self,"pushButton2") self.__pushbutton2.setMaximumSize(QSize(30, 30)) self.__pushbutton2.setPixmap(image2) self.__pushbutton2.setAccel("Del") layout1.addWidget(self.__pushbutton2) selectorsimplelayout.addLayout(layout1) layout3 = QVBoxLayout(None, 0, 6, "layout3") self._textlabel2 = QLabel(self, "textLabel2") layout3.addWidget(self._textlabel2) self._cajaseleccion = QListBox(self,"cajaseleccion") self._cajaseleccion.setMinimumSize(QSize(0, 60)) layout3.addWidget(self._cajaseleccion) selectorsimplelayout.addLayout(layout3) self._cajaseleccion.setSizePolicy(QSizePolicy(\ QSizePolicy.Expanding,QSizePolicy.Expanding, 0, 0, \ self._cajaseleccion.sizePolicy().hasHeightForWidth())) self.setCaption("Form1") self._textlabel2.setText(u"Selección") self.resize(QSize(294, 240).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) self.__conexiones() #Miembros !qt self.seleccion = [] self._dato = interfazdato
def _setup_grid(self): self._clear_grid() numfields = len(self.fields) for fnum in range(numfields): fname = self.fields[fnum] data = '' if self._data.has_key(fname): data = self._data[fname] #entry = KLineEdit(data, self) entry = TraitVariableLineEdit(data, self) entry.show() self.entries[fname] = entry label = QLabel(entry, fname, self, fname) label.show() self._labels[fname] = label self.grid.addWidget(label, fnum, 0) self.grid.addWidget(entry, fnum, 1)
def setupUi(self): """layout the window""" self.setContentsMargins(0, 0, 0, 0) vlayout = QVBoxLayout(self) vlayout.setContentsMargins(0, 0, 0, 0) sliderLayout = QHBoxLayout() self.kcfg_showShadows = QCheckBox(m18n('Show tile shadows'), self) self.kcfg_showShadows.setObjectName('kcfg_showShadows') self.kcfg_rearrangeMelds = QCheckBox( m18n('Rearrange undisclosed tiles to melds'), self) self.kcfg_rearrangeMelds.setObjectName('kcfg_rearrangeMelds') self.kcfg_showOnlyPossibleActions = QCheckBox(m18n( 'Show only possible actions')) self.kcfg_showOnlyPossibleActions.setObjectName( 'kcfg_showOnlyPossibleActions') self.kcfg_propose = QCheckBox(m18n('Propose what to do')) self.kcfg_propose.setObjectName('kcfg_propose') self.kcfg_animationSpeed = QSlider(self) self.kcfg_animationSpeed.setObjectName('kcfg_animationSpeed') self.kcfg_animationSpeed.setOrientation(Qt.Horizontal) self.kcfg_animationSpeed.setSingleStep(1) lblSpeed = QLabel(m18n('Animation speed:')) lblSpeed.setBuddy(self.kcfg_animationSpeed) sliderLayout.addWidget(lblSpeed) sliderLayout.addWidget(self.kcfg_animationSpeed) self.kcfg_useSounds = QCheckBox(m18n('Use sounds if available'), self) self.kcfg_useSounds.setObjectName('kcfg_useSounds') self.kcfg_uploadVoice = QCheckBox(m18n( 'Let others hear my voice'), self) self.kcfg_uploadVoice.setObjectName('kcfg_uploadVoice') pol = QSizePolicy() pol.setHorizontalPolicy(QSizePolicy.Expanding) pol.setVerticalPolicy(QSizePolicy.Expanding) spacerItem = QSpacerItem( 20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding) vlayout.addWidget(self.kcfg_showShadows) vlayout.addWidget(self.kcfg_rearrangeMelds) vlayout.addWidget(self.kcfg_showOnlyPossibleActions) vlayout.addWidget(self.kcfg_propose) vlayout.addWidget(self.kcfg_useSounds) vlayout.addWidget(self.kcfg_uploadVoice) vlayout.addLayout(sliderLayout) vlayout.addItem(spacerItem) self.setSizePolicy(pol) self.retranslateUi()
def __init__(self, parent, action, name='MultiGameProgress'): QWidget.__init__(self, parent, name) self.app = get_application_pointer() self.fhandler = self.app.make_new_fileshandler() self.action = action self.game_progressBar = KProgress(self) self.file_progressBar = KProgress(self) self.file_progressBarLbl = QLabel(self) self.game_progressBarLbl = QLabel(self) self.grid = QGridLayout(self, 4, 1, 5, 7) self.grid.addWidget(self.file_progressBarLbl, 0, 0) self.grid.addWidget(self.file_progressBar, 1, 0) self.grid.addWidget(self.game_progressBarLbl, 2, 0) self.grid.addWidget(self.game_progressBar, 3, 0) if action == 'prepare_game': self.game_action = 'Prepare' self.fhandler._report_extract_from_installed_archive = self.report_file_extracted else: self.game_action = 'Clean up' self.fhandler.archivehelper.report_installed_file_handled = self.report_file_handled
class NewDiskConfigDialog(VboxDialog): def __init__(self, parent, handler): VboxDialog.__init__(self, parent) self.diskconfig = handler self.diskconfigLbl = QLabel(self.frame) self.diskconfigLbl.setText('DiskConfig Name') self.diskconfigEntry = KLineEdit(self.frame) self.contentLbl = QLabel(self.frame) self.contentLbl.setText('DiskConfig Content') self.contentEntry = KTextEdit(self.frame) self.vbox.addWidget(self.diskconfigLbl) self.vbox.addWidget(self.diskconfigEntry) self.vbox.addWidget(self.contentLbl) self.vbox.addWidget(self.contentEntry) self.connect(self, SIGNAL('okClicked()'), self.slotOkClicked) def slotOkClicked(self): name = str(self.diskconfigEntry.text()) content = str(self.contentEntry.text()) self.diskconfig.set(name, dict(content=content))