当前位置: 首页>>代码示例>>Python>>正文


Python QInputDialog.getText方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QInputDialog.getText方法的典型用法代码示例。如果您正苦于以下问题:Python QInputDialog.getText方法的具体用法?Python QInputDialog.getText怎么用?Python QInputDialog.getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QInputDialog的用法示例。


在下文中一共展示了QInputDialog.getText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ask_for_password

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def ask_for_password(username, host, message=None):
        if not SshPassCache.parent_window:
            raise Exception('SshPassCache not initialized')

        def query_psw(msg):
            password, ok = QInputDialog.getText(SshPassCache.parent_window, 'Password Dialog',
                                                msg, echo=QLineEdit.Password)
            return password, ok

        if not message:
            message = 'Enter password for ' + username + '@' + host + ':'

        if threading.current_thread() != threading.main_thread():
            password, ok = WndUtils.call_in_main_thread(query_psw, message)
        else:
            password, ok = query_psw(message)

        if not ok:
            raise CancelException
        return password 
开发者ID:Bertrand256,项目名称:dash-masternode-tool,代码行数:22,代码来源:psw_cache.py

示例2: make_further_instructions

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def make_further_instructions(self, pr):
        def further_instructions():
            response = QMessageBox.information(self, "Next Step", "To continue, send the necessary amounts of Bitcoin to the addresses specified in the 'Outputs' field above. Once broadcast, press Yes to Continue or Cancel to quit.", QMessageBox.Cancel | QMessageBox.Yes, QMessageBox.Cancel)
            if response == QMessageBox.Cancel:
                sys.exit()
            elif response == QMessageBox.Yes:
                if pr.details.payment_url:
                    raw_tx, okPressed1 = QInputDialog.getText(self, "Enter Raw Transaction","Enter the hex of the transaction that was just made:", QLineEdit.Normal, "")
                    if okPressed1 and raw_tx != '':
                        ref_addr, okPressed2 = QInputDialog.getText(self, "Enter Refund Address","Enter a refund address:", QLineEdit.Normal, "")
                        if okPressed2 and ref_addr != '':
                            try:
                                result = pr.send_ack(raw_tx.strip(), ref_addr.strip())
                                if result[0]:
                                    QMessageBox.information(self, "Complete!", "Payment request successful: " + result[1] + "\n\nClick Ok to exit", QMessageBox.Ok, QMessageBox.Ok)
                                    sys.exit()
                                else:
                                    QMessageBox.error(self, "Error!", "Payment request was not successful: " + result[1] + "\n\nClick Ok to exit", QMessageBox.Ok, QMessageBox.Ok)
                                    sys.exit()
                            except:
                                QMessageBox.error(self, "Error!", "There was an error parsing the raw transaction or address. Please restart and try again.\n\nClick Ok to exit", QMessageBox.Ok, QMessageBox.Ok)
                                sys.exit()
                                
        return further_instructions 
开发者ID:achow101,项目名称:payment-proto-interface,代码行数:26,代码来源:gui.py

示例3: prompt_extractor

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def prompt_extractor(self, item):
        extractor = extractors[item.data(Qt.UserRole)]
        inputs = []
        if not assert_installed(self.view, **extractor.get('depends', {})):
            return
        
        if not extractor.get('pick_url', False):
            files, mime = QFileDialog.getOpenFileNames()
            for path in files:
                inputs.append((path, Path(path).stem))
        else:
            text, good = QInputDialog.getText(self.view, ' ', 'Input an URL:')
            if text:
                url = urlparse(text)
                inputs.append((url.geturl(), url.netloc))
        
        if inputs:
            wait = QProgressDialog('Extracting .proto structures...', None, 0, 0)
            wait.setWindowTitle(' ')
            self.set_view(wait)
            
            self.worker = Worker(inputs, extractor)
            self.worker.progress.connect(self.extraction_progress)
            self.worker.finished.connect(self.extraction_done)
            self.worker.start() 
开发者ID:marin-m,项目名称:pbtk,代码行数:27,代码来源:gui.py

示例4: getDevice

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def getDevice(self):
        text,ok=(lambda adbList:QInputDialog.getItem(self,'更改安卓设备','在下拉列表中选择一个设备',adbList,adbList.index(self.serial)if self.serial and self.serial in adbList else 0))([i for i,j in ADB().devices()if j=='device'])
        #text,ok=QInputDialog.getText(self,'更改安卓设备','填写',text='emulator-5554')
        if ok and text:self.serial=text 
开发者ID:hgjazhgj,项目名称:FGO-py,代码行数:6,代码来源:fgoGui.py

示例5: adbConnect

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def adbConnect(self):
        text,ok=QInputDialog.getText(self,'连接远程设备','设备地址',text='localhost:5555')
        if ok and text:ADB(text)#os.system(f'adb connect {text}') 
开发者ID:hgjazhgj,项目名称:FGO-py,代码行数:5,代码来源:fgoGui.py

示例6: _add_provider

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def _add_provider(self):
        """Adds an empty provider box to be filled out by the user."""

        self._collapse_boxes()
        # Show quick user input dialog
        provider_name, ok = QInputDialog.getText(self, "New ORS provider", "Enter a name for the provider")
        if ok:
            self._add_box(provider_name, 'https://', '', new=True) 
开发者ID:GIScience,项目名称:orstools-qgis-plugin,代码行数:10,代码来源:ORStoolsDialogConfig.py

示例7: prompt_rename

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def prompt_rename(self):
        text, good = QInputDialog.getText(self.app.view, ' ', 'Rename this field:', text=self.text(0).strip('+ '))
        if text:
            if not match('^[a-zA-Z0-9_]+$', text):
                QMessageBox.warning(self.app.view, ' ', 'This is not a valid alphanumeric name.')
                self.prompt_rename()
            else:
                try:
                    if self.do_rename(text):
                        return
                except Exception:
                    pass
                QMessageBox.warning(self.app.view, ' ', 'Field was not found in .proto, did you edit it elsewhere?') 
开发者ID:marin-m,项目名称:pbtk,代码行数:15,代码来源:fuzzer.py

示例8: add_tab_data

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def add_tab_data(self):
        text, good = QInputDialog.getText(self.view, ' ', 'Field name:')
        if text:
            ProtocolDataItem(self.fuzzer.getTree, text, '', self).edit() 
开发者ID:marin-m,项目名称:pbtk,代码行数:6,代码来源:gui.py

示例9: loguj

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def loguj(self):
        login, ok = QInputDialog.getText(self, 'Logowanie', 'Podaj login:')
        if ok:
            haslo, ok = QInputDialog.getText(self, 'Logowanie', 'Podaj haslo:')
            if ok:
                if not login or not haslo:
                    QMessageBox.warning(
                        self, 'Błąd', 'Pusty login lub hasło!', QMessageBox.Ok)
                    return
                QMessageBox.information(
                    self, 'Dane logowania',
                    'Podano: ' + login + ' ' + haslo, QMessageBox.Ok) 
开发者ID:koduj-z-klasa,项目名称:python101,代码行数:14,代码来源:todopw_z0.py

示例10: on_btn_add_separator_clicked

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def on_btn_add_separator_clicked(self):
        sep, ok = QInputDialog.getText(self, "Enter Separator", "Separator:", text=",")
        if ok and sep not in (self.ui.comboBoxCSVSeparator.itemText(i) for i in
                              range(self.ui.comboBoxCSVSeparator.count())):
            if len(sep) == 1:
                self.ui.comboBoxCSVSeparator.addItem(sep)
            else:
                Errors.generic_error("Invalid Separator", "Separator must be exactly one character.") 
开发者ID:jopohl,项目名称:urh,代码行数:10,代码来源:CSVImportDialog.py

示例11: create_directory

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def create_directory(self):
        index = self.model().mapToSource(self.rootIndex())  # type: QModelIndex

        if not index.isValid():
            return

        model = self.model().sourceModel()
        dir_name, ok = QInputDialog.getText(self, self.tr("Create Directory"), self.tr("Directory name"))

        if ok and len(dir_name) > 0:
            if not model.mkdir(index, dir_name).isValid():
                QMessageBox.information(self, self.tr("Create Directory"), self.tr("Failed to create the directory")) 
开发者ID:jopohl,项目名称:urh,代码行数:14,代码来源:DirectoryTreeView.py

示例12: prompt_for_grid_name

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def prompt_for_grid_name(grid_name, parent=None):
    title = "{} - Choose a name".format(APP_NAME)
    label = "Please choose a name for this connection:"
    if grid_name:
        label = (
            '{} is already connected to "{}".\n\n'
            "Please choose a different name for this connection".format(
                APP_NAME, grid_name
            )
        )
    return QInputDialog.getText(parent, title, label, 0, grid_name) 
开发者ID:gridsync,项目名称:gridsync,代码行数:13,代码来源:setup.py

示例13: prompt_for_folder_name

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def prompt_for_folder_name(folder_name, grid_name, parent=None):
    return QInputDialog.getText(
        parent,
        "Folder already exists",
        'You already belong to a folder named "{}" on\n'
        "{}; Please choose a different name.".format(folder_name, grid_name),
        0,
        folder_name,
    ) 
开发者ID:gridsync,项目名称:gridsync,代码行数:11,代码来源:setup.py

示例14: add

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def add(self):
        # 工具栏功能
        if not self.state:
            self.get_file()
            if self.fname:
                self.name, ok = QInputDialog.getText(self, '文件', '应用名称')
                if ok and self.name:
                    self.state = True
                    self.setText(self.name)
                else:
                    self.fname = None 
开发者ID:xflywind,项目名称:Python-Application,代码行数:13,代码来源:mybutton.py

示例15: keyPressEvent

# 需要导入模块: from PyQt5.QtWidgets import QInputDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QInputDialog import getText [as 别名]
def keyPressEvent(self, e):
        if e.modifiers() == Qt.ControlModifier and e.key() == Qt.Key_F:
            text, okPressed = QInputDialog.getText(self, "Find", "Find what: ")

            self.setSelectionBackgroundColor(QColor("#6be585"))

            if okPressed:
                if text == "":
                    text = " "
                    self.dialog.noMatch(text)

                self.searchtext = text

                """
                This is the way to implement a search function using QScintilla 
                http://pyqt.sourceforge.net/Docs/QScintilla2/classQsciScintilla.html#a37ac2bea94eafcfa639173557a821200
                """

                if self.findFirst(
                    self.searchtext, False, True, False, True, True, -1, -1, True, False
                ):
                    pass
                else:
                    self.dialog.noMatch(self.searchtext)

        if e.key() == Qt.Key_F3:
            self.findNext()
            self.setSelectionBackgroundColor(QColor("#6be585"))

        if e.modifiers() == Qt.ControlModifier and e.key() == Qt.Key_L:
            self.setCursorPosition(self.line, self.column + 1)
            return
        if e.modifiers() == Qt.ControlModifier and e.key() == 77:

            self.setCursorPosition(self.line + 1, self.column)
            return
        if e.modifiers() == Qt.ControlModifier and e.key() == Qt.Key_J:
            self.setCursorPosition(self.line, self.column - 1)

        if e.modifiers() == Qt.ControlModifier and e.key() == Qt.Key_I:
            self.setCursorPosition(self.line - 1, self.column)

        if e.modifiers() == Qt.ControlModifier and e.key() == Qt.Key_T:
            self.parent.parent.realterminal()
            return

        super().keyPressEvent(e) 
开发者ID:CountryTk,项目名称:Hydra,代码行数:49,代码来源:TextEditor.py


注:本文中的PyQt5.QtWidgets.QInputDialog.getText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。