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, 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): super(BackgroundSelector, self).__init__(parent) loadUi(self) self.kcfg_backgroundName = QLineEdit(self) self.kcfg_backgroundName.setVisible(False) self.kcfg_backgroundName.setObjectName('kcfg_backgroundName') self.setUp()
def __init__(self, scene=None, table=None): super(ChatWindow, self).__init__(None) self.scene = scene self.table = table or scene.game.client.table self.table.chatWindow = self self.setObjectName('chatWindow') title = i18n('Chat on table %1 at %2', self.table.tableid, self.table.client.connection.url) decorateWindow(self, title) self.messageView = ChatView() self.messageView.setModel(ChatModel()) self.messageView.setFocusPolicy(Qt.NoFocus) self.messageView.setShowGrid(False) self.messageView.setWordWrap(False) self.messageView.setSelectionMode(QAbstractItemView.NoSelection) if Debug.modelTest: self.debugModelTest = ModelTest(self.messageView.model(), self.messageView) self.edit = QLineEdit() layout = QVBoxLayout() layout.addWidget(self.messageView) layout.addWidget(self.edit) self.setLayout(layout) self.edit.returnPressed.connect(self.sendLine) self.edit.setFocus() self.show() StateSaver(self)
def setupUi(self): """create all Ui elements but do not fill them""" self.buttonBox = KDialogButtonBox(self) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) # Ubuntu 11.10 unity is a bit strange - without this, it sets focus on # the cancel button (which it shows on the left). I found no obvious # way to use setDefault and setAutoDefault for fixing this. self.buttonBox.button(QDialogButtonBox.Ok).setFocus(True) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) vbox = QVBoxLayout(self) self.grid = QFormLayout() self.cbServer = QComboBox() self.cbServer.setEditable(True) self.grid.addRow(i18n('Game server:'), self.cbServer) self.cbUser = QComboBox() self.cbUser.setEditable(True) self.grid.addRow(i18n('Username:'******'Password:'******'kajongg', 'Ruleset:'), self.cbRuleset) vbox.addLayout(self.grid) vbox.addWidget(self.buttonBox) pol = QSizePolicy() pol.setHorizontalPolicy(QSizePolicy.Expanding) self.cbUser.setSizePolicy(pol) self.__port = None
def __init__(self, parent=None): super(ExportPage, 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("Export")) step_label.setFont(label_font) out_file_label = QLabel(str("mtz output name:")) self.simple_lin = QLineEdit(self) self.simple_lin.textChanged.connect(self.update_command) self.check_scale = QCheckBox("Output Scaled Intensities") self.check_scale.setChecked(False) self.check_scale.stateChanged.connect(self.update_command) self.warning_label = QLabel(str(" ")) self.warning_label.setWordWrap(True) main_v_box.addWidget(step_label) main_v_box.addWidget(out_file_label) main_v_box.addWidget(self.simple_lin) main_v_box.addWidget(self.check_scale) main_v_box.addStretch() main_v_box.addWidget(self.warning_label) main_v_box.addStretch() self.setLayout(main_v_box) self.fist_time = False # self.show() self.simple_lin.setText("integrated.mtz")
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): QDialog.__init__(self) self.l = QVBoxLayout(self) self.passwd = QLineEdit(self, "password") self.passwd.setEchoMode(QLineEdit.Password) self.l.addWidget(self.passwd) self.connect(self.passwd, SIGNAL("returnPressed()"), self.slotSetPass)
def __init__(self, phl_obj=None, parent=None): super(ParamAdvancedWidget, self).__init__() self.scrollable_widget = PhilWidget(phl_obj, parent=self) scrollArea = QScrollArea() scrollArea.setWidget(self.scrollable_widget) vbox = QVBoxLayout() search_label = QLabel("search:") search_edit = QLineEdit("type search here") search_edit.textChanged.connect(self.scrollable_widget.user_searching) hbox = QHBoxLayout() hbox.addWidget(search_label) hbox.addWidget(search_edit) vbox.addLayout(hbox) vbox.addWidget(scrollArea) self.setLayout(vbox)
def __init__(self, parent): super(TilesetSelector, self).__init__(parent) loadUi(self) self.kcfg_tilesetName = QLineEdit(self) self.kcfg_tilesetName.setVisible(False) self.kcfg_tilesetName.setObjectName('kcfg_tilesetName') self.tileScene = SceneWithFocusRect() self.tileView = FittingView() self.tileView.setScene(self.tileScene) self.tileset = Tileset(Internal.Preferences.tilesetName) self.uiTiles = [UITile('w' + s.char.lower()) for s in Wind.all4] self.board = Board(2, 2, self.tileset) self.board.showShadows = True self.tileScene.addItem(self.board) self.tileView.setParent(self.tilesetPreview) layout = QHBoxLayout(self.tilesetPreview) layout.addWidget(self.tileView) for idx, offsets in enumerate([(0, 0), (0, 1), (1, 0), (1, 1)]): self.uiTiles[idx].setBoard(self.board, *offsets) self.uiTiles[idx].focusable = False self.setUp()
def __init__(self, phl_obj=None, parent=None): super(ParamAdvancedWidget, self).__init__() self.scrollable_widget = PhilWidget(phl_obj, parent=self) scrollArea = QScrollArea() scrollArea.setWidget(self.scrollable_widget) vbox = QVBoxLayout() search_label = QLabel("Search:") search_edit = QLineEdit() search_edit.setPlaceholderText("Type search here") search_edit.textChanged.connect(self.scrollable_widget.user_searching) self.search_next_button = QPushButton("Find next") self.search_next_button.setEnabled(False) hbox = QHBoxLayout() hbox.addWidget(search_label) hbox.addWidget(search_edit) hbox.addWidget(self.search_next_button) self.search_next_button.clicked.connect(self.scrollable_widget.find_next) vbox.addLayout(hbox) vbox.addWidget(scrollArea) self.setLayout(vbox)
def phil_list2gui(self, lst_phil_obj): sys_font = QFont() sys_font_point_size = sys_font.pointSize() inde_step = 4 self.lst_label_widg = [] self.lst_var_widg = [] non_added_lst = [] for nm, obj in enumerate(lst_phil_obj): if isinstance(obj, ScopeData): tmp_str = " " * int(obj.indent * inde_step) + str(obj.name) # print tmp_str tmp_widg = QLabel(tmp_str) tmp_widg.setAutoFillBackground(True) # tmp_widg.setPalette(self.plt_scp) tmp_widg.setFont( QFont("Monospace", sys_font_point_size, QFont.Bold)) tmp_widg.style_orign = "color: rgba(85, 85, 85, 255)" tmp_widg.setStyleSheet(tmp_widg.style_orign) tooltip = self._tooltip_from_phil_object(obj) if tooltip: tmp_widg.setToolTip(tooltip) self.bg_box.addWidget(tmp_widg) tmp_widg.test_flag = "Yes" self.lst_label_widg.append(tmp_widg) else: tmp_h_box = QHBoxLayout() indent = str(obj.full_path()).count(".") tmp_str = " " * indent * inde_step + str(obj.name) tmp_label = QLabel(tmp_str) tmp_label.setAutoFillBackground(True) # tmp_label.setPalette(self.plt_obj) tmp_label.style_orign = "color: rgba(0, 0, 0, 255)" tmp_label.setStyleSheet(tmp_label.style_orign) tmp_label.setFont(QFont("Monospace", sys_font_point_size)) tmp_h_box.addWidget(tmp_label) self.lst_label_widg.append(tmp_label) if obj.type.phil_type == "bool": tmp_widg = MyQComboBox() tmp_widg.tmp_lst = [] tmp_widg.tmp_lst.append("True") tmp_widg.tmp_lst.append("False") tmp_widg.tmp_lst.append("Auto") # tmp_widg.setFocusPolicy(Qt.StrongFocus) for lst_itm in tmp_widg.tmp_lst: tmp_widg.addItem(lst_itm) if str(obj.extract()) == "True": tmp_widg.setCurrentIndex(0) tmp_str += " True" elif str(obj.extract()) == "False": tmp_widg.setCurrentIndex(1) tmp_str += " False" elif str(obj.extract()) == "Auto": tmp_widg.setCurrentIndex(2) tmp_str += " Auto" else: tmp_str = None # logger.info("tmp_widg.tmp_lst =", tmp_widg.tmp_lst) # logger.info("tmp_str =", tmp_str) tmp_widg.currentIndexChanged.connect(self.combobox_changed) elif obj.type.phil_type == "choice": # remember to ask david about the issue here # tmp_widg = QComboBox() # tmp_widg.tmp_lst=[] # pos = 0 # found_choise = False # for num, opt in enumerate(obj.words): # opt = str(opt) # if(opt[0] == "*"): # found_choise = True # opt = opt[1:] # pos = num # tmp_str += " " + opt # tmp_widg.tmp_lst.append(opt) # for lst_itm in tmp_widg.tmp_lst: # tmp_widg.addItem(lst_itm) # tmp_widg.setCurrentIndex(pos) # tmp_widg.currentIndexChanged.connect(self.combobox_changed) # if(found_choise == False): # tmp_str = None # non_added_lst.append(str(obj.full_path())) # begins pathed version tmp_widg = MyQComboBox() tmp_widg.tmp_lst = [] pos = 0 found_choise = False for num, opt in enumerate(obj.words): opt = str(opt) if opt[0] == "*": found_choise = True opt = opt[1:] pos = num tmp_str += " " + opt tmp_widg.tmp_lst.append(opt) if not found_choise: tmp_str += " " + str( obj.extract()) for lst_itm in tmp_widg.tmp_lst: tmp_widg.addItem(lst_itm) tmp_widg.setCurrentIndex(pos) tmp_widg.currentIndexChanged.connect(self.combobox_changed) # ends pathed version else: tmp_widg = QLineEdit() tmp_widg.setText("") tmp_widg.str_defl = None tmp_widg.textChanged.connect(self.spnbox_changed) # tmp_widg.tmp_lst = None tmp_str += " " + str( obj.extract()) if tmp_str is not None: tmp_widg.local_path = str(obj.full_path()) # tmp_h_box.addStretch() tooltip = self._tooltip_from_phil_object(obj) if tooltip: tmp_widg.setToolTip(tooltip) tmp_h_box.addWidget(tmp_widg) self.lst_var_widg.append(tmp_widg) self.bg_box.addLayout(tmp_h_box) # debugging = ''' logger.debug("Non added parameters:") for lin_to_print in non_added_lst: logger.debug(lin_to_print)