def __init__(self, parent=None): super(LoginForm, self).__init__(parent) self.setWindowTitle("Login") self.status_icon = QIcon.fromTheme("user-offline") self.setWindowIcon(self.status_icon) self.server_status = QLabel() self.server_status.setAlignment(Qt.AlignCenter) self.server_status.setPixmap(self.status_icon.pixmap(64)) self.username = QLineEdit("Username") self.password = QLineEdit("Password") self.password.setEchoMode(QLineEdit.Password) self.login_button = QPushButton("Getting server status...") self.login_button.setEnabled(False) self.login_button.clicked.connect(self.login) self.login_button.setIcon(self.status_icon) self.ping_timer = QTimer(self) self.connect(self.ping_timer, SIGNAL("timeout()"), self.is_server_up) self.ping_timer.start(1000) layout = QVBoxLayout() for w in (self.server_status, self.username, self.password, self.login_button): layout.addWidget(w) self.setLayout(layout) self.logged_in.connect(qtclient.login)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(583, 96) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QGridLayout() self.gridLayout.setObjectName("gridLayout") self.UI_label = QLabel(self.centralwidget) self.UI_label.setObjectName("UI_label") self.gridLayout.addWidget(self.UI_label, 0, 0, 1, 1) self.seleccionarUI_pushButton = QPushButton(self.centralwidget) self.seleccionarUI_pushButton.setObjectName("seleccionarUI_pushButton") self.gridLayout.addWidget(self.seleccionarUI_pushButton, 0, 2, 1, 1) self.Py_label = QLabel(self.centralwidget) self.Py_label.setObjectName("Py_label") self.gridLayout.addWidget(self.Py_label, 1, 0, 1, 1) self.rutaSalida_pushButton = QPushButton(self.centralwidget) self.rutaSalida_pushButton.setObjectName("rutaSalida_pushButton") self.gridLayout.addWidget(self.rutaSalida_pushButton, 1, 2, 1, 1) self.rutaEntrada_lineEdit = QLineEdit(self.centralwidget) self.rutaEntrada_lineEdit.setEnabled(False) self.rutaEntrada_lineEdit.setObjectName("rutaEntrada_lineEdit") self.gridLayout.addWidget(self.rutaEntrada_lineEdit, 0, 1, 1, 1) self.rutaSalida_lineEdit = QLineEdit(self.centralwidget) self.rutaSalida_lineEdit.setObjectName("rutaSalida_lineEdit") self.gridLayout.addWidget(self.rutaSalida_lineEdit, 1, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.horizontalWidget = QWidget(self.centralwidget) self.horizontalWidget.setObjectName("horizontalWidget") self.horizontalLayout = QHBoxLayout(self.horizontalWidget) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.convertir_pushButton = QPushButton(self.horizontalWidget) self.convertir_pushButton.setObjectName("convertir_pushButton") self.horizontalLayout.addWidget(self.convertir_pushButton) self.verticalLayout.addWidget(self.horizontalWidget) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, text, validator, minValue, maxValue): QWidget.__init__(self) layout = QHBoxLayout(self) checkBox = QCheckBox() checkBox.setFixedWidth(115) checkBox.setText(text) layout.addWidget(checkBox) hLayoutX = QHBoxLayout() lineEditXMin = QLineEdit() lineEditXMax = QLineEdit() hLayoutX.addWidget(lineEditXMin) hLayoutX.addWidget(lineEditXMax) lineEditXMin.setValidator(validator) lineEditXMax.setValidator(validator) lineEditXMin.setText(str(minValue)) lineEditXMax.setText(str(maxValue)) layout.addLayout(hLayoutX) self.checkBox = checkBox self.lineEditX_min = lineEditXMin self.lineEditX_max = lineEditXMax self.lineEdits = [lineEditXMin, lineEditXMax] QtCore.QObject.connect(checkBox, QtCore.SIGNAL("clicked()"), self.updateEnabled) self.updateEnabled()
def update_t(self, a): if self.mySQL.do: da_3 = QDialog(self.app) d_list = [] if self.table_Name != None: da_3.setWindowTitle("Update Table %s.%s" % (self.Data_Name, self.table_Name)) da_3.resize(600, 100) tab = WTL.Table() line_1 = QLineEdit() line_2 = QLineEdit() but = QPushButton("Update") tab.setRowCount(1) cols = self.mySQL.getColumns(self.Data_Name, self.table_Name) tab.setColumnCount(len(cols)) for ind in range(len(cols)): item = QTableWidgetItem tab.setHorizontalHeaderItem(ind, item(cols[ind])) vbox = QVBoxLayout(da_3) hbox = QHBoxLayout() vbox.addWidget(tab) for i in (QLabel("Where: "), line_1, QLabel("="), line_2): hbox.addWidget(i) vbox.addLayout(hbox) vbox.addWidget(but) but.clicked.connect(lambda: self.mySQL.update_DT( self.Data_Name, self.table_Name, str(line_1.text() + "='%s'" % line_2.text()), tab)) self.app.ref = True da_3.exec_() else: MsgBox_2().showMsg("Plz Select Table From %s" % self.Data_Name) else: MsgBox_2().showMsg("Error: Can't Connect to MySQL Server ")
def __init__(self, parent=None): QWidget.__init__(self, parent) self.__parent = parent self.setWindowTitle("Add Employee") self.id = QLineEdit(self) self.id.setValidator(QRegExpValidator(QRegExp("[a-zA-Z0-9-_]+"))) self.name = QLineEdit(self) self.name.setValidator(QRegExpValidator(QRegExp("[a-zA-Z\s]+"))) self.designation = QComboBox(self) # self.designation.addItems(DatabaseManager.db.getDesignations()) self.originalPay = QLineEdit(self) self.originalPay.setValidator(QDoubleValidator()) self.originalPayGrade = QLineEdit(self) self.originalPayGrade.setValidator(QDoubleValidator()) self.DOJ = DatePicker(self) self.pan = QLineEdit(self) self.pan.setValidator(QRegExpValidator(QRegExp("[A-Z]{5}\d{4}[A-Z]"))) self.bttnAddEmployee = QPushButton("Add Employee") self.bttnCancel = QPushButton("Cancel") self.bttnAddEmployee.setObjectName("OkButton") self.bttnCancel.setObjectName("CancelButton") self.bttnCancel.clicked.connect(self.goBack) self.bttnAddEmployee.clicked.connect(self.add) self.designation.addItems(DatabaseManager.db.getDesignations()) self.setupUI()
def create_main_area(self, layout): # Master password master_password_label = QLabel("&Master-Passwort:") self.master_password_edit = QLineEdit() self.master_password_edit.setEchoMode(QLineEdit.EchoMode.Password) self.master_password_edit.textChanged.connect(self.masterpassword_changed) self.master_password_edit.returnPressed.connect(self.move_focus) self.master_password_edit.editingFinished.connect(self.masterpassword_entered) self.master_password_edit.setMaximumHeight(28) master_password_label.setBuddy(self.master_password_edit) layout.addWidget(master_password_label) layout.addWidget(self.master_password_edit) # Domain domain_label = QLabel("&Domain:") self.domain_edit = QComboBox() self.domain_edit.setEditable(True) self.domain_edit.textChanged.connect(self.domain_changed) self.domain_edit.currentIndexChanged.connect(self.domain_changed) self.domain_edit.lineEdit().editingFinished.connect(self.domain_entered) self.domain_edit.lineEdit().returnPressed.connect(self.move_focus) self.domain_edit.setMaximumHeight(28) domain_label.setBuddy(self.domain_edit) layout.addWidget(domain_label) layout.addWidget(self.domain_edit) # Username self.username_label = QLabel("&Username:"******"&Passwortstärke:") self.strength_label.setVisible(False) self.strength_selector = PasswordStrengthSelector() self.strength_selector.set_min_length(4) self.strength_selector.set_max_length(36) self.strength_selector.setMinimumHeight(60) self.strength_selector.set_length(12) self.strength_selector.set_complexity(6) self.strength_selector.strength_changed.connect(self.strength_changed) self.strength_selector.setVisible(False) self.strength_label.setBuddy(self.strength_selector) layout.addWidget(self.strength_label) layout.addWidget(self.strength_selector) # Password self.password_label = QLabel("&Passwort:") self.password_label.setVisible(False) self.password = QLabel() self.password.setTextFormat(Qt.PlainText) self.password.setAlignment(Qt.AlignCenter) self.password.setFont(QFont("Helvetica", 18, QFont.Bold)) self.password.setVisible(False) self.password_label.setBuddy(self.password) layout.addWidget(self.password_label) layout.addWidget(self.password)
def __init__(self, *args, **kwargs ): QWidget.__init__( self, *args, **kwargs ) mainLayout = QHBoxLayout( self ) mainLayout.setContentsMargins(0,0,0,0) label = QLabel( "Aim Direction : " ) lineEdit1 = QLineEdit() lineEdit2 = QLineEdit() lineEdit3 = QLineEdit() verticalSeparator = Widget_verticalSeparator() checkBox = QCheckBox( "Set Auto" ) mainLayout.addWidget( label ) mainLayout.addWidget( lineEdit1 ) mainLayout.addWidget( lineEdit2 ) mainLayout.addWidget( lineEdit3 ) mainLayout.addWidget( verticalSeparator ) mainLayout.addWidget( checkBox ) validator = QDoubleValidator( -10000.0, 10000.0, 2 ) lineEdit1.setValidator( validator ) lineEdit2.setValidator( validator ) lineEdit3.setValidator( validator ) lineEdit1.setText( "0.0" ) lineEdit2.setText( "1.0" ) lineEdit3.setText( "0.0" ) checkBox.setChecked( True ) self.label = label; self.lineEdit1 = lineEdit1; self.lineEdit2 = lineEdit2; self.lineEdit3 = lineEdit3; self.checkBox = checkBox self.setVectorEnabled() QtCore.QObject.connect( checkBox, QtCore.SIGNAL( 'clicked()' ), self.setVectorEnabled )
def __init__(self, parent): super(AddPeriodDialog, self).__init__(parent) t = _("Add a period for an operation definition") self.setWindowTitle(t) self.title_widget = TitleWidget(t, self) top_layout = QVBoxLayout() top_layout.addWidget(self.title_widget) hlayout = QHBoxLayout() hlayout.addWidget(QLabel(_("Start time"), self)) self.date_edit = QLineEdit(self) hlayout.addWidget(self.date_edit) top_layout.addLayout(hlayout) hlayout = QHBoxLayout() hlayout.addWidget(QLabel(_("Hourly cost"), self)) self.hourly_cost = QLineEdit(self) hlayout.addWidget(self.hourly_cost) top_layout.addLayout(hlayout) self.buttons = QDialogButtonBox() self.buttons.addButton(QDialogButtonBox.Ok) top_layout.addWidget(self.buttons) self.setLayout(top_layout) # QWidget takes ownership of the layout self.buttons.accepted.connect(self.accepted)
def bake(self): self.bakeWidget = QDialog( self ) def doCommand(): ctlsGroup = [] for widget in self.mainWindow.w_ctlListGroup.getChildrenWidgets(): ctls = widget.items allExists=True for ctl in ctls: if not pymel.core.objExists( ctl ): allExists=False break if not allExists: continue ctlsGroup.append( ctls ) mainCtl = self.mainWindow.w_mainCtl.lineEdit.text() minFrame = int( self.bakeWidget.le_minFrame.text() ) maxFrame = int( self.bakeWidget.le_maxFrame.text() ) BaseCommands.bake( mainCtl, ctlsGroup, minFrame, maxFrame ) def closeCommand(): self.bakeWidget.close() validator = QIntValidator( self ) minFrame = pymel.core.playbackOptions( q=1, min=0 ) maxFrame = pymel.core.playbackOptions( q=1, max=1 ) mainLayout = QVBoxLayout( self.bakeWidget ) timeRangeLayout = QHBoxLayout() l_minFrame = QLabel( "Min Frame : " ) le_minFrame = QLineEdit(); le_minFrame.setValidator( validator ) l_maxFrame = QLabel( "Max Frame : " ) le_maxFrame = QLineEdit(); le_maxFrame.setValidator( validator ) timeRangeLayout.addWidget( l_minFrame ) timeRangeLayout.addWidget( le_minFrame ) timeRangeLayout.addWidget( l_maxFrame ) timeRangeLayout.addWidget( le_maxFrame ) le_minFrame.setText( str( int(minFrame) ) ) le_maxFrame.setText( str( int(maxFrame) ) ) buttonsLayout = QHBoxLayout() b_bake = QPushButton( "Bake" ) b_close = QPushButton( "Close" ) buttonsLayout.addWidget( b_bake ) buttonsLayout.addWidget( b_close ) mainLayout.addLayout( timeRangeLayout ) mainLayout.addLayout( buttonsLayout ) QtCore.QObject.connect( b_bake, QtCore.SIGNAL( "clicked()" ), doCommand ) QtCore.QObject.connect( b_close, QtCore.SIGNAL( "clicked()" ), closeCommand ) self.bakeWidget.show() self.bakeWidget.le_minFrame = le_minFrame self.bakeWidget.le_maxFrame = le_maxFrame
def __init__(self): super(PhoneFrame, self).__init__() self.setWindowTitle('Phone Book.') self.name = QLineEdit() self.number = QLineEdit() entry = QFormLayout() entry.addRow(QLabel('Name'), self.name) entry.addRow(QLabel('Number'), self.number) buttons = QHBoxLayout() button = QPushButton('&Add') button.clicked.connect(self._addEntry) buttons.addWidget(button) button = QPushButton('&Update') button.clicked.connect(self._updateEntry) buttons.addWidget(button) button = QPushButton('&Delete') button.clicked.connect(self._deleteEntry) buttons.addWidget(button) dataDisplay = QTableView() dataDisplay.setModel(PhoneDataModel()) layout = QVBoxLayout() layout.addLayout(entry) layout.addLayout(buttons) layout.addWidget(dataDisplay) self.setLayout(layout) self.show()
def getParameterWidget(self): matrixLayout = QGridLayout() matrixLayout.setAlignment(Qt.AlignTop) matrixLayout.setContentsMargins(0, 0, 0, 0) matrixLayout.setSpacing(5) matrixLayout.addWidget(QLabel("Transformation matrix:"), 0, 0, 1, 4) self.m1Edits = [QLineEdit() for _ in range(4)] self.m2Edits = [QLineEdit() for _ in range(4)] self.m3Edits = [QLineEdit() for _ in range(4)] self.m4Edits = [QLineEdit() for _ in range(4)] self.initLineEdits(self.m1Edits, matrixLayout, 1, 0) self.initLineEdits(self.m2Edits, matrixLayout, 2, 0) self.initLineEdits(self.m3Edits, matrixLayout, 3, 0) self.initLineEdits(self.m4Edits, matrixLayout, 4, 0) expandingWidget = QWidget() expandingWidget.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) matrixLayout.addWidget(expandingWidget, 5, 0, 1, 4) matrixWidget = QWidget() matrixWidget.setLayout(matrixLayout) self.transformUpdated( self.renderWidget.transformations.completeTransform()) return matrixWidget
def initUi(self): self.grid = QGridLayout() self.grid.addWidget(QLabel("Connection name"), 0, 0) self.grid.addWidget(QLabel("Username"), 2, 0) self.grid.addWidget(QLabel("Password"), 4, 0) self.grid.addWidget(QLabel("Hostname"), 6, 0) self.grid.addWidget(QLabel("Port"), 8, 0) self.connectionNameInput = QLineEdit(self) self.grid.addWidget(self.connectionNameInput, 1, 0) self.userNameInput = QLineEdit(self) self.grid.addWidget(self.userNameInput, 3, 0) self.passwordInput = QLineEdit(self) self.grid.addWidget(self.passwordInput, 5, 0) self.hostnameInput = QLineEdit(self) self.grid.addWidget(self.hostnameInput, 7, 0) self.portSpinBox = QSpinBox(self) self.portSpinBox.setMinimum(1) self.portSpinBox.setMaximum(65535) self.portSpinBox.setValue(22) self.grid.addWidget(self.portSpinBox, 9, 0) self.addButton = QPushButton("Accept") self.grid.addWidget(self.addButton, 10, 0) self.setLayout(self.grid) self.addButton.clicked.connect(self.clickedAddButton) self.show()
def __init__(self, *args, **kwargs): super(Widget_numController, self).__init__() self.installEventFilter(self) mainLayout = QHBoxLayout(self) mainLayout.setContentsMargins(5, 0, 5, 0) validator = QIntValidator() label = QLabel("Num Controller") lineEdit_width = QLineEdit() lineEdit_width.setValidator(validator) lineEdit_height = QLineEdit() lineEdit_height.setValidator(validator) lineEdit_width.setText('5') lineEdit_height.setText('5') mainLayout.addWidget(label) mainLayout.addWidget(lineEdit_width) mainLayout.addWidget(lineEdit_height) self.lineEdit_width = lineEdit_width self.lineEdit_height = lineEdit_height self.load_lineEdit_text([self.lineEdit_width, self.lineEdit_height], Widget_numController.path_uiInfo) QtCore.QObject.connect(self.lineEdit_width, QtCore.SIGNAL("returnPressed()"), self.save_info) QtCore.QObject.connect(self.lineEdit_height, QtCore.SIGNAL("returnPressed()"), self.save_info)
def SetFLayout(self): formLayout = QFormLayout(self) labelUsername = QLabel("Username") txtUsername = QLineEdit() labelPassword = QLabel("Password") txtPassword = QLineEdit() formLayout.addRow(labelUsername, txtUsername) formLayout.addRow(labelPassword, txtPassword) self.setLayout(formLayout)
def createWidgets(self): self.fontLabel = QLabel("Fon&t:") self.fontComboBox = QFontComboBox() self.tooltips.append((self.fontComboBox, """\ <p><b>Font</b></p> <p>The font for displaying the characters.</p>""")) self.fontLabel.setBuddy(self.fontComboBox) self.sizeLabel = QLabel("&Size:") self.sizeComboBox = QComboBox() self.tooltips.append((self.sizeComboBox, """\ <p><b>Size</b></p> <p>The size of font for displaying the characters.</p>""")) self.sizeLabel.setBuddy(self.sizeComboBox) self.scrollArea = QScrollArea() self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.panel = Panel() self.scrollArea.setWidget(self.panel) self.copyTextLabel = QLabel("Copy T&ext") self.copyTextLineEdit = QLineEdit() self.tooltips.append((self.copyTextLineEdit, """\ <p><b>Copy Text editor</b></p> <p>The text for copying to the clipboard when <b>Copy</b> is pressed.</p>""")) self.copyTextLabel.setBuddy(self.copyTextLineEdit) self.findTextLabel = QLabel("&Find Text") self.findTextLineEdit = QLineEdit() self.tooltips.append((self.findTextLineEdit, """\ <p><b>Find Text editor</b></p> <p>The name or partial name of Unicode characters to be found, e.g., “star” will match many characters, including U+22C6 “Star operator”.</p>""")) self.findTextLabel.setBuddy(self.findTextLineEdit) self.buttonBox = QDialogButtonBox() self.addSelectedButton = QPushButton(QIcon(":/add.svg"), "&Add Selected") self.tooltips.append((self.addSelectedButton, """\ <p><b>Add Selected</b></p> <p>Append the selected character to the <b>Copy Text</b> editor.</p>""")) self.buttonBox.addButton(self.addSelectedButton, QDialogButtonBox.ActionRole) self.findNextButton = QPushButton(QIcon(":/edit-find.svg"), "Find &Next") self.tooltips.append((self.findNextButton, """\ <p><b>Find Next</b></p> <p>Find the next character whose Unicode name contains or equals the <b>Find Text</b>.</p>""")) self.buttonBox.addButton(self.findNextButton, QDialogButtonBox.ActionRole) self.helpButton = QPushButton(QIcon(":/help.svg"), "Help") self.tooltips.append( (self.helpButton, "Help on the Copy Character dialog")) self.buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole) self.closeButton = QPushButton(QIcon(":/dialog-close.svg"), "&Close") self.tooltips.append((self.closeButton, """<p><b>Cancel</b></p> <p>Close the dialog.</p>""")) self.buttonBox.addButton(self.closeButton, QDialogButtonBox.RejectRole)
def __init__(self, parent=None): super(SettingsDialog, self).__init__(parent) self.setWindowTitle("Settings") main_layout = QVBoxLayout() buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) settings = QSettings() db_group = QGroupBox("Database") grid_layout = QGridLayout() grid_layout.addWidget(QLabel("File"), 0, 0) text = settings.value('DB/File') self.file = QLineEdit(text) self.file.setText(text) grid_layout.addWidget(self.file, 0, 1) browse = QPushButton("Browse") browse.clicked.connect(self.browse) grid_layout.addWidget(browse, 0, 2) db_group.setLayout(grid_layout) main_layout.addWidget(db_group) ip_width = QFontMetrics(QFont(self.font())).width("000.000.000.000 ") smtp_group = QGroupBox("SMTP") grid_layout = QGridLayout() grid_layout.addWidget(QLabel("Server"), 0, 0) text = settings.value('SMTP/Server') self.smtp_server = QLineEdit(text) self.smtp_server.setText(text) grid_layout.addWidget(self.smtp_server, 0, 1) smtp_group.setLayout(grid_layout) main_layout.addWidget(smtp_group) self.http_proxy = QGroupBox("HTTP Proxy") self.http_proxy.setCheckable(True) self.http_proxy.setChecked(bool(settings.value('HTTP Proxy/Enabled'))) grid_layout = QGridLayout() grid_layout.addWidget(QLabel("Server"), 0, 0) self.http_proxy_ip = QLineEdit() self.http_proxy_ip.setText(settings.value('HTTP Proxy/IP')) self.http_proxy_ip.setMinimumWidth(ip_width) grid_layout.addWidget(self.http_proxy_ip, 0, 1) grid_layout.setColumnStretch(0, 1) self.http_proxy.setLayout(grid_layout) main_layout.addWidget(self.http_proxy) main_layout.addWidget(buttonBox) self.setLayout(main_layout) buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def setLayoutForm(self): """Présentation du QFormLayout""" self.setWindowTitle("Form Layout") formLayout = QFormLayout(self) labelUser = QLabel("Username") txtUser = QLineEdit() labelPass = QLabel("Password") txtPass = QLineEdit() formLayout.addRow(labelUser, txtUser) formLayout.addRow(labelPass, txtPass) self.setLayout(formLayout)
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.installEventFilter(self) self.layout = QHBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) self.lineEdit_key = QLineEdit() self.lineEdit_value = QLineEdit() self.layout.addWidget(self.lineEdit_key) self.layout.addWidget(self.lineEdit_value)
def createWidgets(self): """Create children widgets needed by this view""" fieldsWidth = 200 labelsFont = View.labelsFont() editsFont = View.editsFont() self.setLogo() self.hostLabel = QLabel(self) self.hostEdit = QLineEdit(self) self.sslLabel = QLabel(self) self.sslCheck = QCheckBox(self) self.hostLabel.setText('FTP Location') self.hostLabel.setFont(labelsFont) self.hostEdit.setFixedWidth(fieldsWidth) self.hostEdit.setFont(editsFont) self.sslLabel.setText('SSL') self.sslLabel.setFont(labelsFont) self.usernameLabel = QLabel(self) self.usernameEdit = QLineEdit(self) self.usernameLabel.setText('Username') self.usernameLabel.setFont(labelsFont) self.usernameEdit.setFixedWidth(fieldsWidth) self.usernameEdit.setFont(editsFont) self.passwdLabel = QLabel(self) self.passwdEdit = QLineEdit(self) self.passwdLabel.setText('Password') self.passwdLabel.setFont(labelsFont) self.passwdEdit.setFixedWidth(fieldsWidth) self.passwdEdit.setEchoMode(QLineEdit.Password) self.passwdEdit.setFont(editsFont) self.passwdEdit.returnPressed.connect(self.onLoginClicked) self.loginButton = QPushButton(self) self.loginButton.setText('Login') self.loginButton.setFont(labelsFont) self.loginButton.setFixedWidth(fieldsWidth / 2) self.loginButton.clicked.connect(self.onLoginClicked) # Sets previously stored values into the fields, if any settings = get_settings() self.hostEdit.setText(settings.value(SettingsKeys['host'], '')) self.usernameEdit.setText(settings.value(SettingsKeys['username'], '')) self.passwdEdit.setText( crypt.decrypt(settings.value(SettingsKeys['passwd'], ''))) # Unicode to boolean conversion ssl = settings.value(SettingsKeys['ssl'], u'true') ssl = True if ssl == u'true' else False self.sslCheck.setChecked(ssl)
def __init__(self, *args, **kwargs): QWidget.__init__( self, *args, **kwargs ) self.installEventFilter( self ) self.layout = QHBoxLayout( self ) self.layout.setContentsMargins( 0,0,0,0 ) self.lineEdit_srcAttr = QLineEdit() self.lineEdit_dstAttr = QLineEdit() self.layout.addWidget( self.lineEdit_srcAttr ) self.layout.addWidget( self.lineEdit_dstAttr )
def __init__(self): ''' Constructor ''' super(LoginDialog, self).__init__() formLayout = QFormLayout() self.input1 = QLineEdit() self.input2 = QLineEdit() self.input2.setEchoMode(QLineEdit.EchoMode.Password) self.input3 = QLineEdit() self.input3.setEchoMode(QLineEdit.EchoMode.Password) self.cb = QComboBox() self.cb.addItems(["Sef stanice", "Radnik u centrali", "Radnik na naplatnom mestu", "Admin"]) palete = QPalette() palete.setColor(self.backgroundRole(), Qt.black) self.setPalette(palete) self.setWindowTitle("Login") self.resize(370, 100) label2 = QLabel("<font color='White'>Username</font>") label3 = QLabel("<font color='White'>Password</font>") label4 = QLabel("<font color='White'>Registration key</font>") label5 = QLabel("<font color='White'>Role</font>") formLayout.addRow(label2, self.input1) formLayout.addRow(label3, self.input2) btnOK = QPushButton("Login") btnOK.clicked.connect(self.loginAction) btnCancel = QPushButton("Cancel") btnCancel.clicked.connect(self.reject) btnRegister = QPushButton("Register") btnRegister.clicked.connect(self.registerAction) group = QDialogButtonBox() group.addButton(btnOK, QDialogButtonBox.AcceptRole) group.addButton(btnCancel, QDialogButtonBox.RejectRole) formLayout.addRow(group) formLayout.addRow(label4, self.input3) formLayout.addRow(label5, self.cb) formLayout.addWidget(btnRegister) self.result = None self.setLayout(formLayout)
def __init__(self, robocare_serial): self.__robocare_serial = robocare_serial QWidget.__init__(self) layout = QGridLayout() self.setLayout(layout) self.__line1 = QLineEdit() self.__line1.setPlaceholderText("06 F6 F6 F1 0E") self.__line1.setFont(QFont(u"나눔고딕", 15, weight=QFont.Bold)) layout.addWidget(self.__line1, 0, 0, 1, 3) button = QPushButton(u'보내기', self) button.setFont(QFont(u"나눔고딕", 15, weight=QFont.Bold)) button.clicked.connect(self.clicked_custom_once) layout.addWidget(button, 1, 0, 1, 1) self.__line2 = QLineEdit() self.__line2.setPlaceholderText("06 F6 F6 F1 0E") self.__line2.setFont(QFont(u"나눔고딕", 15, weight=QFont.Bold)) layout.addWidget(self.__line2, 2, 0, 1, 3) button = QPushButton(u'버전 체크', self) button.setFont(QFont(u"나눔고딕", 15, weight=QFont.Bold)) button.clicked.connect(self.clicked_version) layout.addWidget(button, 3, 0, 1, 1) button = QPushButton(u'터치 읽기', self) button.setFont(QFont(u"나눔고딕", 15, weight=QFont.Bold)) button.clicked.connect(self.clicked_read) layout.addWidget(button, 3, 1, 1, 1) button = QPushButton(u'100번 읽기', self) button.setFont(QFont(u"나눔고딕", 15, weight=QFont.Bold)) button.clicked.connect(self.clicked_read_100) layout.addWidget(button, 3, 2, 1, 1) button = QPushButton(u'빨강', self) button.setFont(QFont(u"나눔고딕", 15, weight=QFont.Bold)) button.clicked.connect(self.clicked_red) layout.addWidget(button, 4, 0, 1, 1) button = QPushButton(u'녹색', self) button.setFont(QFont(u"나눔고딕", 15, weight=QFont.Bold)) button.clicked.connect(self.clicked_green) layout.addWidget(button, 4, 1, 1, 1) button = QPushButton(u'파랑', self) button.setFont(QFont(u"나눔고딕", 15, weight=QFont.Bold)) button.clicked.connect(self.clicked_blue) layout.addWidget(button, 4, 2, 1, 1)
def add_row_to_table(self, *args): """ complex stuff of auto complete to be added to each combo box :return: """ table = self.waste_table if args: if args[0] != 'new': table.clearContents() table.setRowCount(0) table.setRowCount(len(args)) for i, j in enumerate(args): code = QTableWidgetItem(j['code']) table.setItem(i, 0, code) item = QTableWidgetItem(j['item']) table.setItem(i, 1, item) category = QTableWidgetItem(j['category']) table.setItem(i, 2, category) quantity = QTableWidgetItem(str(j['quantity'])) table.setItem(i, 3, quantity) reason = QTableWidgetItem(j['reason_for_discard']) table.setItem(i, 4, reason) if args[0] == 'new': row = table.rowCount() + 1 table.setRowCount(row) codeline = QLineEdit() codeline.editingFinished.connect( lambda: self.get_details_of_code(row)) table.setCellWidget(row - 1, 0, codeline) itemcombo = QComboBox() self.fill_item_list(itemcombo) itemcombo.currentIndexChanged.connect( lambda: self.get_details_of_item(row)) table.setCellWidget(row - 1, 1, itemcombo) category = QTableWidgetItem() table.setItem(row - 1, 2, category) quantity = QLineEdit() table.setCellWidget(row - 1, 3, quantity) combo = QComboBox() combo.addItem("Cancelled") combo.addItem("Mishandling") combo.addItem("Excess") table.setCellWidget(row - 1, 4, combo) table.setColumnWidth(0, (table.width() / 5)) table.setColumnWidth(1, (table.width() / 5)) table.setColumnWidth(2, (table.width() / 5)) table.setColumnWidth(3, (table.width() / 5)) table.horizontalHeader().setStretchLastSection( True ) # important to resize last section else blank space after last column
def _setupUi(self): self.iField = QLineEdit() self.iField.setFixedHeight(40) self.oField = QLineEdit() self.oField.setReadOnly(True) self.oField.setFixedHeight(40) mainLayout = QVBoxLayout() mainLayout.addWidget(QLabel('請在上面這欄輸入地址')) mainLayout.addWidget(self.iField) mainLayout.addStretch(1) mainLayout.addWidget(QLabel('郵遞區號會出現在這邊')) mainLayout.addWidget(self.oField) self.setLayout(mainLayout) self.setStyleSheet(MainWidget.stylesheet)
def _init_widgets(self): layout = QVBoxLayout() # address lbl_addr = QLabel() lbl_addr.setText("Address") txt_addr = QLineEdit() txt_addr.returnPressed.connect(self._on_address_entered) self._txt_addr = txt_addr top_layout = QHBoxLayout() top_layout.addWidget(lbl_addr) top_layout.addWidget(txt_addr) self._view = QMemoryView(self.workspace) area = QScrollArea() self._scrollarea = area area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) area.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) area.setWidgetResizable(True) area.setWidget(self._view) layout.addLayout(top_layout) layout.addWidget(area) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout)
def setupUi(self): self.mainlayout = QVBoxLayout(self) self.title = QLabel("CardBord Operator", self) self.mainlayout.addWidget(self.title) self.user_txtarea = QTextEdit(self) self.ai_txtarea = QTextEdit(self) self.users_edit_title = QLabel("質問に答えてください") self.users_edit = QLineEdit("", self) self.txtarea_layout = QHBoxLayout() self.txtarea_layout.addWidget(self.user_txtarea) self.txtarea_layout.addWidget(self.ai_txtarea) self.mainlayout.addLayout(self.txtarea_layout) self.mainlayout.addWidget(self.users_edit_title) self.mainlayout.addWidget(self.users_edit) self.send_btn = QPushButton("send", self) self.send_btn.setObjectName("send_btn") self.mainlayout.addWidget(self.send_btn) QMetaObject.connectSlotsByName(self)
def _setupUi(self): self.setMinimumWidth(800) self.setMinimumHeight(600) layout = QVBoxLayout() self.setLayout(layout) self.editPmCmd = QLineEdit() layout.addWidget(self.editPmCmd) self.modesWidget = QWidget() self.modesLayout = QHBoxLayout() self.modesWidget.setLayout(self.modesLayout) layout.addWidget(self.modesWidget) self.checkBoxes = [] for mode in 'create query edit'.split(): chkBox = QCheckBox(mode) chkBox.setProperty('mode', mode) self.checkBoxes.append(chkBox) for checkBox in self.checkBoxes: self.modesLayout.addWidget(checkBox) checkBox.setChecked(True) if self.command: self.updateDocs() else: layout.addStretch()
def initUI(self): self.layoutFile = FileBrowseWidget( "Layout settings file .yaml (*.yaml)") self.layoutFile.setText(DEFAULT_LAYOUT_FILE) self.rfSettingsFile = FileBrowseWidget( "Device settings file .yaml (*.yaml)") self.rfSettingsFile.setText(DEFAULT_RF_FILE) layout = QFormLayout() layout.addRow(QLabel("Layout settings file (.yaml):"), self.layoutFile) layout.addRow(QLabel("RF settings file (.yaml):"), self.rfSettingsFile) self.idLine = QLineEdit() self.idLine.setText(str(DEFAULT_DEVICE_ID)) self.idLine.setMaximumWidth(50) self.idLine.setValidator(QIntValidator(0, 63)) layout.addRow(QLabel("Device id (0-63):"), self.idLine) self.generateButton = QPushButton("Generate new RF settings") self.generateButton.setMaximumWidth(230) self.generateButton.clicked.connect(self.generateRFSettings) layout.addRow(None, self.generateButton) label = QLabel( "<b>Note:</b> These settings only need to be loaded on each " "device once and are persistent when you update the layout. " "To ensure proper operation and security, each device must " "have a unique device ID for a given RF settings file. " "Since RF settings file contains your encryption key, make " "sure to keep it secret.") label.setTextInteractionFlags(Qt.TextSelectableByMouse) label.setWordWrap(True) layout.addRow(label) self.setLayout(layout)
def __init__(self, folderBrowser): super(MovieList, self).__init__() mainLayout = QVBoxLayout() mainLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(mainLayout) filterLayout = QHBoxLayout() mainLayout.addLayout(filterLayout) self.setWatchedButton = customWidgets.IconButton( "icon_watchList.png", "Set as watched") filterLayout.addWidget(self.setWatchedButton) self.setHideWatchedButton = customWidgets.IconButton( "filter_icon.png", "Set as watched") filterLayout.addWidget(self.setHideWatchedButton) self.filterField = QLineEdit() self.filterField.setObjectName("filterField") filterLayout.addWidget(self.filterField) self.movieList = MovieBrowser(folderBrowser) mainLayout.addWidget(self.movieList) self.progressBar = customWidgets.MyProgress() mainLayout.addWidget(self.progressBar) self.progressBar.setVisible(True) self.setWatchedButton.clicked.connect(self.movieList.setWatched) self.setHideWatchedButton.clicked.connect(self.movieList.hideWatched)
def __init__(self, parent=None): super(AddDialogWidget, self).__init__(parent) nameLabel = QLabel("Name") addressLabel = QLabel("Address") buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.nameText = QLineEdit() self.addressText = QTextEdit() grid = QGridLayout() grid.setColumnStretch(1, 2) grid.addWidget(nameLabel, 0, 0) grid.addWidget(self.nameText, 0, 1) grid.addWidget(addressLabel, 1, 0, Qt.AlignLeft | Qt.AlignTop) grid.addWidget(self.addressText, 1, 1, Qt.AlignLeft) layout = QVBoxLayout() layout.addLayout(grid) layout.addWidget(buttonBox) self.setLayout(layout) self.setWindowTitle("Add a Contact") buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)