當前位置: 首頁>>代碼示例>>Python>>正文


Python QLineEdit.setEchoMode方法代碼示例

本文整理匯總了Python中PyQt5.QtWidgets.QLineEdit.setEchoMode方法的典型用法代碼示例。如果您正苦於以下問題:Python QLineEdit.setEchoMode方法的具體用法?Python QLineEdit.setEchoMode怎麽用?Python QLineEdit.setEchoMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtWidgets.QLineEdit的用法示例。


在下文中一共展示了QLineEdit.setEchoMode方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: createBottomRightGroupBox

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
    def createBottomRightGroupBox(self):
        self.bottomRightGroupBox = QGroupBox("Group 3")
        self.bottomRightGroupBox.setCheckable(True)
        self.bottomRightGroupBox.setChecked(True)

        lineEdit = QLineEdit('s3cRe7')
        lineEdit.setEchoMode(QLineEdit.Password)

        spinBox = QSpinBox(self.bottomRightGroupBox)
        spinBox.setValue(50)

        dateTimeEdit = QDateTimeEdit(self.bottomRightGroupBox)
        dateTimeEdit.setDateTime(QDateTime.currentDateTime())

        slider = QSlider(Qt.Horizontal, self.bottomRightGroupBox)
        slider.setValue(40)

        scrollBar = QScrollBar(Qt.Horizontal, self.bottomRightGroupBox)
        scrollBar.setValue(60)

        dial = QDial(self.bottomRightGroupBox)
        dial.setValue(30)
        dial.setNotchesVisible(True)

        layout = QGridLayout()
        layout.addWidget(lineEdit, 0, 0, 1, 2)
        layout.addWidget(spinBox, 1, 0, 1, 2)
        layout.addWidget(dateTimeEdit, 2, 0, 1, 2)
        layout.addWidget(slider, 3, 0)
        layout.addWidget(scrollBar, 4, 0)
        layout.addWidget(dial, 3, 1, 2, 1)
        layout.setRowStretch(5, 1)
        self.bottomRightGroupBox.setLayout(layout)
開發者ID:death-finger,項目名稱:Scripts,代碼行數:35,代碼來源:styles.py

示例2: __init__

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
	def __init__(self, parent=None):
		super(lineEditDemo, self).__init__(parent)
		e1 = QLineEdit()
		e1.setValidator( QIntValidator() )
		e1.setMaxLength(4)
		e1.setAlignment( Qt.AlignRight )
		e1.setFont( QFont("Arial",20))
		e2 = QLineEdit()
		e2.setValidator( QDoubleValidator(0.99,99.99,2))
		flo = QFormLayout()
		flo.addRow("integer validator", e1)
		flo.addRow("Double validator",e2)
		e3 = QLineEdit()
		e3.setInputMask('+99_9999_999999')
		flo.addRow("Input Mask",e3)
		e4 = QLineEdit()
		e4.textChanged.connect( self.textchanged )
		flo.addRow("Text changed",e4)
		e5 = QLineEdit()
		e5.setEchoMode( QLineEdit.Password )
		flo.addRow("Password",e5)
		e6 = QLineEdit("Hello PyQt5")
		e6.setReadOnly(True)
		flo.addRow("Read Only",e6 )
		e5.editingFinished.connect( self.enterPress )
		self.setLayout(flo)
		self.setWindowTitle("QLineEdit例子")
開發者ID:kiorry,項目名稱:PYQT,代碼行數:29,代碼來源:qt04_lineEdit04.py

示例3: LoginDialog

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
class LoginDialog(QDialog):
    """蝦米音樂登錄對話框"""

    login_success = pyqtSignal([object])

    def __init__(self, parent=None):
        super().__init__(parent)

        self._label = QLabel(self)
        self.username_input = QLineEdit(self)
        self.pw_input = QLineEdit(self)
        self.pw_input.setEchoMode(QLineEdit.Password)
        self._btn_box = QDialogButtonBox(self)
        self._ok_btn = QDialogButtonBox.Ok
        self._setup_ui()

        self.setWindowTitle('蝦米賬號密碼登錄')

        self._btn_box.clicked.connect(self.do_verify)

    def _setup_ui(self):
        self._btn_box.addButton(self._ok_btn)
        self._label.hide()

        self._layout = QFormLayout(self)
        self._layout.addRow('郵箱/手機號:', self.username_input)
        self._layout.addRow('密碼:', self.pw_input)
        self._layout.addRow(self._label)
        self._layout.addRow(self._btn_box)

    def show_msg(self, msg, error=False):
        """顯示提示信息"""
        self._label.show()
        self._label.setTextFormat(Qt.RichText)
        if error:
            color = 'red'
        else:
            color = 'green'
        self._label.setText('<span style="color: {};">{}</span>'
                            .format(color, msg))

    def do_verify(self):
        """校驗用戶名和密碼,成功則發送信號"""
        username = self.username_input.text()
        password = self.pw_input.text()
        pw_md5digest = hashlib.md5(password.encode('utf-8')).hexdigest()
        rv = api.login(username, pw_md5digest)
        code, msg = rv['ret'][0].split('::')
        is_success = code == 'SUCCESS'
        self.show_msg(msg, error=(not is_success))
        if is_success:
            data = rv['data']['data']
            schema = UserSchema(strict=True)
            user, _ = schema.load(data)
            self.login_success.emit(user)
            self.close()
開發者ID:BruceZhang1993,項目名稱:FeelUOwn,代碼行數:58,代碼來源:ui.py

示例4: Login

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
class Login(QWidget):
    login = ''
    passwd = ''
    grid = QGridLayout()
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        self.setWindowTitle('RandomVK')
        self.setWindowIcon(QIcon('web.png'))
        self.Login_Label = QLabel("Login:")
        self.Login_Input = QLineEdit('')
        self.Passwd_Label = QLabel("Passwd:")
        self.Passwd_Input = QLineEdit('')
        self.Passwd_Input.setEchoMode(QLineEdit.Password)
        self.Login_Button = QPushButton('Login')
        self.Login_Button.clicked.connect(self.onClick_login)
        self.grid.setSpacing(9)
        self.grid.addWidget(self.Login_Label, 0, 0)
        self.grid.addWidget(self.Login_Input, 0, 1)
        self.grid.addWidget(self.Passwd_Label, 1, 0)
        self.grid.addWidget(self.Passwd_Input, 1, 1)
        self.grid.addWidget(self.Login_Button, 1, 2)
        self.setLayout(self.grid)
        self.show()
    def onClick_login(self):
        try:
            login = self.Login_Input.text()
            passwd = self.Passwd_Input.text()
            global vk
            vk = backend.vk_audio(login=login, passwd=passwd)
            #raise backend.vk.exceptions.VkAuthError
            pass
        except backend.vk.exceptions.VkAuthError as VkAuthError:
            text = VkAuthError.args[0]
            err = QMessageBox()
            err.setText(text)
            err.setDefaultButton(QMessageBox.Ok)
            err.setText(text)
            err.buttonClicked.connect(self.msgbtn)
            retval = err.exec_()
        else:
            if os.name == "nt":
                Setting_File = open(os.getcwd() + '\\setting.json', 'w')
            else:
                Setting_File = open(os.getcwd() + '/setting.json', 'w')
            acc = {'access_token': vk.get_access_token()}
            Setting_Text = json.dumps(acc)
            print(Setting_Text, file=Setting_File, end='')
            Setting_File.close()
            self.hide()
            Player_UI.show()
            Player_UI.Next_Button.click()
            self.close()
開發者ID:Verdgil,項目名稱:RandomVK,代碼行數:57,代碼來源:GUI.py

示例5: CredentialsWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
class CredentialsWindow(QWidget):  

    def __init__(self, controller):
        super().__init__()
        self.controller = controller
        self.setWindowTitle('Default credentials')
        
        layout = QGridLayout()
        
        username = QLabel('Default username')
        self.username = QLineEdit('cisco')
        
        password = QLabel('Default password')
        self.password = QLineEdit('cisco')
        self.password.setEchoMode(QLineEdit.Password)
        
        enable_password = QLabel('Default "Enable" password')
        self.enable_password = QLineEdit('cisco')
        self.enable_password.setEchoMode(QLineEdit.Password)
        
        path_to_putty = QPushButton()
        path_to_putty.setText('Path to PuTTY')
        path_to_putty.clicked.connect(self.choose_path)
        
        self.path_edit = QLineEdit()
        self.path = join(controller.path_apps, 'putty.exe')
        self.path_edit.setText(self.path)
        
        layout = QGridLayout()
        layout.addWidget(username, 0, 0)
        layout.addWidget(self.username, 0, 1)
        layout.addWidget(password, 1, 0)
        layout.addWidget(self.password, 1, 1)
        layout.addWidget(enable_password, 2, 0)
        layout.addWidget(self.enable_password, 2, 1)
        layout.addWidget(path_to_putty, 3, 0)
        layout.addWidget(self.path_edit, 3, 1)
        self.setLayout(layout)
        
    def choose_path(self):
        path = 'Path to PuTTY'
        filepath = ''.join(QFileDialog.getOpenFileName(self, path, path))
        self.path_edit.setText(filepath)
        self.path = filepath
        
    def get_credentials(self):
        return {
                'username': self.username.text(),
                'password': self.password.text(),
                'enable_password': self.enable_password.text(),
                'path': self.path
                }
    
        
開發者ID:mintoo,項目名稱:NetDim,代碼行數:54,代碼來源:credentials_window.py

示例6: __init__

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
    def __init__(self, parent, bank_name, required_input):
        DialogContainer.__init__(self, parent)

        self.required_input = required_input

        uic.loadUi(get_ui_file_path('iom_input_dialog.ui'), self.dialog_widget)

        self.dialog_widget.cancel_button.clicked.connect(lambda: self.button_clicked.emit(0))
        self.dialog_widget.confirm_button.clicked.connect(lambda: self.button_clicked.emit(1))

        if 'error_text' in required_input:
            self.dialog_widget.error_text_label.setText(required_input['error_text'])
        else:
            self.dialog_widget.error_text_label.hide()

        if 'image' in required_input['additional_data']:
            qimg = QImage()
            qimg.loadFromData(b64decode(required_input['additional_data']['image']))
            image = QPixmap.fromImage(qimg)
            scene = QGraphicsScene(self.dialog_widget.img_graphics_view)
            scene.addPixmap(image)
            self.dialog_widget.img_graphics_view.setScene(scene)
        else:
            self.dialog_widget.img_graphics_view.hide()

        self.dialog_widget.iom_input_title_label.setText(bank_name)

        vlayout = QVBoxLayout()
        self.dialog_widget.user_input_container.setLayout(vlayout)

        self.input_widgets = {}

        for specific_input in self.required_input['required_fields']:
            label_widget = QLabel(self.dialog_widget.user_input_container)
            label_widget.setText(specific_input['text'] + ":")
            label_widget.show()
            vlayout.addWidget(label_widget)

            input_widget = QLineEdit(self.dialog_widget.user_input_container)
            input_widget.setPlaceholderText(specific_input['placeholder'])
            if specific_input['type'] == 'password':
                input_widget.setEchoMode(QLineEdit.Password)

            input_widget.show()
            vlayout.addWidget(input_widget)
            self.input_widgets[specific_input['name']] = input_widget

        self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
        self.dialog_widget.adjustSize()

        self.on_main_window_resize()
開發者ID:Tribler,項目名稱:tribler,代碼行數:53,代碼來源:iom_input_dialog.py

示例7: __init__

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
	def __init__(self, parent=None):
		super(lineEditDemo, self).__init__(parent)
		self.setWindowTitle("QLineEdit例子")

		flo = QFormLayout()
		pNormalLineEdit = QLineEdit( )
		pNoEchoLineEdit = QLineEdit()
		pPasswordLineEdit = QLineEdit( )
		pPasswordEchoOnEditLineEdit = QLineEdit( )

		flo.addRow("Normal", pNormalLineEdit)
		flo.addRow("NoEcho", pNoEchoLineEdit)
		flo.addRow("Password", pPasswordLineEdit)
		flo.addRow("PasswordEchoOnEdit", pPasswordEchoOnEditLineEdit)
        
		pNormalLineEdit.setPlaceholderText("Normal")
		pNoEchoLineEdit.setPlaceholderText("NoEcho")
		pPasswordLineEdit.setPlaceholderText("Password")
		pPasswordEchoOnEditLineEdit.setPlaceholderText("PasswordEchoOnEdit")

		# 設置顯示效果
		pNormalLineEdit.setEchoMode(QLineEdit.Normal)
		pNoEchoLineEdit.setEchoMode(QLineEdit.NoEcho)
		pPasswordLineEdit.setEchoMode(QLineEdit.Password)
		pPasswordEchoOnEditLineEdit.setEchoMode(QLineEdit.PasswordEchoOnEdit)
		                    
		self.setLayout(flo)
開發者ID:kiorry,項目名稱:PYQT,代碼行數:29,代碼來源:qt04_lineEdit01.py

示例8: initUI

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
    def initUI(self):

        api_label = QLabel("Yahoo! アプリケーションID")
        api_lineedit = QLineEdit()
        api_lineedit.setEchoMode(QLineEdit.Password)
        self.api_lineedit = api_lineedit

        text_label = QLabel("解析したい日本語")
        text_textedit = QPlainTextEdit()
        text_textedit.setTabChangesFocus(True)
        self.text_textedit = text_textedit

        grid = QGridLayout()
        grid.addWidget(api_label, 0, 0)
        grid.addWidget(api_lineedit, 0, 1)
        grid.addWidget(text_label, 1, 0)
        grid.addWidget(text_textedit, 1, 1)

        go_button = QPushButton("Go")
        go_button.setAutoDefault(True) # 
        go_button.clicked.connect(self.buttonClicked)
        hbox1 = QHBoxLayout()
        hbox1.addStretch(1)
        hbox1.addWidget(go_button)
        hbox1.addStretch(1)

        result_label = QLabel("解析結果")
        result_table = QTableWidget()
        result_table.setColumnCount(4)
        result_table.setRowCount(1)
        result_table.setItem(0, 0, QTableWidgetItem("表記"))
        result_table.setItem(0, 1, QTableWidgetItem("読みがな"))
        result_table.setItem(0, 2, QTableWidgetItem("基本形表記"))
        result_table.setItem(0, 3, QTableWidgetItem("品詞"))
        self.result_table = result_table
        hbox2 = QHBoxLayout()
        hbox2.addWidget(result_label)
        hbox2.addWidget(result_table)

        vbox = QVBoxLayout()
        vbox.addLayout(grid)
        vbox.addLayout(hbox1)
        vbox.addLayout(hbox2)

        self.setLayout(vbox)

        self.setGeometry(100, 100, 700, 550)
        self.setWindowTitle('Yahoo! 形態素解析のデモ')
        self.show()
開發者ID:minus9d,項目名稱:python_exercise,代碼行數:51,代碼來源:yahoo_morphological_analysis.py

示例9: LoginDialog

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
class LoginDialog(QDialog):
    def __init__(self, playerCore):
        super().__init__()
        self.player = playerCore
        self.ui()

    def ui(self):
        self.formGridLayout = QGridLayout()
        self.usernameEdit = QLineEdit()
        self.passwordEdit = QLineEdit()
        self.passwordEdit.setEchoMode(QLineEdit.Password)

        self.labelUsername = QLabel("Username")
        self.labelPassword = QLabel("Password")
        self.labelUsername.setBuddy(self.usernameEdit)
        self.labelPassword.setBuddy(self.passwordEdit)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)
        self.buttons.addButton(QDialogButtonBox.Cancel)
        self.buttons.button(QDialogButtonBox.Ok).setText("Login")
        self.buttons.button(QDialogButtonBox.Cancel).setText("Abort")

        self.buttons.button(
            QDialogButtonBox.Cancel).clicked.connect(self.close)
        self.buttons.button(
            QDialogButtonBox.Ok).clicked.connect(self.slotAcceptLogin)

        self.formGridLayout.addWidget(self.labelUsername, 0, 0)
        self.formGridLayout.addWidget(self.usernameEdit, 0, 1)
        self.formGridLayout.addWidget(self.labelPassword, 1, 0)
        self.formGridLayout.addWidget(self.passwordEdit, 1, 1)
        self.formGridLayout.addWidget(self.buttons, 2, 0, 1, 2)

        self.setLayout(self.formGridLayout)
        self.setWindowTitle('Login')
        self.show()

    def slotAcceptLogin(self):
        username = self.usernameEdit.text()
        password = self.passwordEdit.text()
        self.close()
        logged = self.player.login(username, password)
        if not logged:
            self.errorWindow = Window(
                'Error', 'Login failed! Try again later.')
        else:
            self.successful = Window(
                'Success', 'Welcome, {}!'.format(username))
開發者ID:DanislavKirov,項目名稱:DPlayer,代碼行數:51,代碼來源:ui.py

示例10: method

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
 def method(self):
     l1 = QLabel('<font color = green>Успешно</font>', self)
     lab = QLineEdit('', self)
     lab.setEchoMode(2)
     btn =  QPushButton('Cope', self)
     btn.setIcon(QIcon('цуи.png'))
     btn.clicked.connect(self.showDialog)
     sld = QSlider(Qt.Horizontal, self)
     sld.valueChanged[int].connect(self.showDialog)
     lab.move(100, 100)
     btn.move(300, 300)
     l1.move(300, 100)
     self.setFixedSize(720, 480)
     self.setWindowTitle('name')
     self.setToolTip('Главное окошко')
開發者ID:tester-debil123,項目名稱:dsg,代碼行數:17,代碼來源:pa.py

示例11: SignInDialog

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
class SignInDialog(QDialog):
    username = None
    password = None
    session = None
    downloader = None
    checkbox = None

    def __init__(self, downloader):
        super().__init__()
        self.init_ui()
        self.session = downloader.session
        self.downloader = downloader

    def init_ui(self):
        grid = QGridLayout()
        self.setLayout(grid)
        self.setWindowTitle("Login to Monstercat Connect")

        self.username = QLineEdit()
        self.password = QLineEdit()
        self.password.setEchoMode(QLineEdit.Password)
        login_button = QPushButton("Login")
        login_button.pressed.connect(self.login)

        self.checkbox = QCheckBox("Stay signed in?")

        grid.addWidget(QLabel("E-Mail: "), *(1, 1))
        grid.addWidget(self.username, *(1, 2))
        grid.addWidget(QLabel("Password: "), *(2, 1))
        grid.addWidget(self.password, *(2, 2))
        grid.addWidget(self.checkbox, *(3, 1))
        grid.addWidget(login_button, *(4, 2))

    def login(self):
        print("Signing in...")
        payload = {"email": self.username.text(), "password": self.password.text()}
        response_raw = self.session.post(SIGNIN_URL, data=payload)
        response = json.loads(response_raw.text)
        if len(response) > 0:
            show_popup("Sign-In failed!", "Sign-In Error: " + response.get("message", "Unknown error"))
            return False
        if self.checkbox.isChecked():
            save_cookies(self.session.cookies, COOKIE_FILE)
        self.close()
        show_popup("Sign-In successful!", "You are successfully logged in!")
        self.downloader.loggedIn = True
        return True
開發者ID:z3ntu,項目名稱:MonstercatConnectDownloader,代碼行數:49,代碼來源:downloader.py

示例12: Login

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
class Login(QDialog):
    def __init__(self, parent=None):
        super(Login, self).__init__(parent)
        usr = QLabel(u"用戶:")
        pwd = QLabel(u"密碼:")
        self.usrLineEdit = QLineEdit()
        self.pwdLineEdit = QLineEdit()
        self.pwdLineEdit.setEchoMode(QLineEdit.Password)

        gridLayout = QGridLayout()
        gridLayout.addWidget(usr, 0, 0, 1, 1)
        gridLayout.addWidget(pwd, 1, 0, 1, 1)
        gridLayout.addWidget(self.usrLineEdit, 0, 1, 1, 3);
        gridLayout.addWidget(self.pwdLineEdit, 1, 1, 1, 3);

        okBtn = QPushButton(u"確定")
        cancelBtn = QPushButton(u"取消")
        btnLayout = QHBoxLayout()

        btnLayout.setSpacing(60)
        btnLayout.addWidget(okBtn)
        btnLayout.addWidget(cancelBtn)

        dlgLayout = QVBoxLayout()
        dlgLayout.setContentsMargins(40, 40, 40, 40)
        dlgLayout.addLayout(gridLayout)
        dlgLayout.addStretch(40)
        dlgLayout.addLayout(btnLayout)

        self.setLayout(dlgLayout)
        okBtn.clicked.connect(self.accept)
        cancelBtn.clicked.connect(self.reject)
        self.setWindowTitle(u"登錄")
        self.resize(300, 200)

    def accept(self):
        #year = strftime("%Y",localtime())
        dt = datetime.now()
        if self.usrLineEdit.text().strip() == "kerun" and self.pwdLineEdit.text() == "188102377":
            super(Login, self).accept()
        else:
            QMessageBox.warning(self,
                    u"警告",
                    u"用戶名或密碼錯誤!",
                    QMessageBox.Yes)
            self.usrLineEdit.setFocus()
開發者ID:argen77,項目名稱:vague,代碼行數:48,代碼來源:MainWindow.py

示例13: LoginWidget

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
class LoginWidget(QWidget):

    def __init__(self):
        super().__init__()

        lay = QHBoxLayout(self)  # сразу подключаем лэйаут к виджету w

        self.loginEdit = QLineEdit(self)
        self.loginEdit.setPlaceholderText('Имя')
        self.loginEdit.installEventFilter(self) # делаем текущий виджет наблюдателем событий виджета loginWidget

        self.passwordEdit = QLineEdit(self)
        self.passwordEdit.setPlaceholderText('Пароль')
        self.passwordEdit.setEchoMode(QLineEdit.Password)
        self.passwordEdit.installEventFilter(self) # делаем текущий виджет наблюдателем событий виджета passwordEdit

        self.loginButton = QPushButton(self)
        self.loginButton.setText('Войти')
        self.loginButton.clicked.connect(self.login)  # подсоединяем 'слот' к 'сигналу'

        lay.addWidget(self.loginEdit)
        lay.addWidget(self.passwordEdit)
        lay.addWidget(self.loginButton)

    def login(self, *args):
        global w
        name = w.loginEdit.text()
        password = w.passwordEdit.text()

        if User.login(name, password):
            w = Table()
            w.show()

    def eventFilter(self, watched, event):
        #print('eventFilter: {} - {}'.format(watched, event))
        return super().eventFilter(watched, event)

    def keyPressEvent(self, event):
        if event.key() in (
                PyQt5.QtCore.Qt.Key_Enter,
                PyQt5.QtCore.Qt.Key_Return): # FIXME найти тип
            print('-- ENTER --')
            self.login()
開發者ID:aaveter,項目名稱:curs_2016_b,代碼行數:45,代碼來源:buh3.py

示例14: LoginDialog

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
class LoginDialog(QDialog):
    def __init__(self):
        super().__init__()
        self.initDialog()

    def initDialog(self):
        vbox = QVBoxLayout()
        self.resize(300, 100)
        self.setWindowTitle('Login')
        self.loginBtn = QPushButton('Login', self)
        self.loginBtn.clicked.connect(self.loginClicked)

        self.loginEdit = QLineEdit(self)
        self.loginLabel = QLabel('Login')
        self.passwordEdit = QLineEdit(self)
        self.passwordLabel = QLabel('Password')
        self.passwordEdit.setEchoMode(QLineEdit.Password)

        hboxLogin = QHBoxLayout()
        hboxLogin.addWidget(self.loginLabel)
        hboxLogin.addWidget(self.loginEdit)

        hboxPassword = QHBoxLayout()
        hboxPassword.addWidget(self.passwordLabel)
        hboxPassword.addWidget(self.passwordEdit)
        vbox.addLayout(hboxLogin)
        vbox.addLayout(hboxPassword)
        vbox.addWidget(self.loginBtn)
        self.setLayout(vbox)
        self.show()

    def loginClicked(self):
        try:
            lgn = str(self.loginEdit.text())
            pswd = str(self.passwordEdit.text())
            self.vkapi = vk_api.VkApi(login=lgn, password=pswd, api_version='4876954')
            self.vkapi.authorization()
            self.accept()
        except Exception as ex:
            QMessageBox.information(self, 'Fail', 'Can not to connect.\nPlease try again')

    def getAPI(self):
        return self.vkapi
開發者ID:Gampr,項目名稱:vkmusic,代碼行數:45,代碼來源:main.py

示例15: passphrase_dialog

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setEchoMode [as 別名]
 def passphrase_dialog(self, msg, confirm):
     # If confirm is true, require the user to enter the passphrase twice
     parent = self.top_level_window()
     d = WindowModalDialog(parent, _("Enter Passphrase"))
     if confirm:
         OK_button = OkButton(d)
         playout = PasswordLayout(msg=msg, kind=PW_PASSPHRASE, OK_button=OK_button)
         vbox = QVBoxLayout()
         vbox.addLayout(playout.layout())
         vbox.addLayout(Buttons(CancelButton(d), OK_button))
         d.setLayout(vbox)
         passphrase = playout.new_password() if d.exec_() else None
     else:
         pw = QLineEdit()
         pw.setEchoMode(2)
         pw.setMinimumWidth(200)
         vbox = QVBoxLayout()
         vbox.addWidget(WWLabel(msg))
         vbox.addWidget(pw)
         vbox.addLayout(Buttons(CancelButton(d), OkButton(d)))
         d.setLayout(vbox)
         passphrase = pw.text() if d.exec_() else None
     self.passphrase = passphrase
     self.done.set()
開發者ID:vialectrum,項目名稱:vialectrum,代碼行數:26,代碼來源:qt.py


注:本文中的PyQt5.QtWidgets.QLineEdit.setEchoMode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。