def _requestPW(self, user, host): ''' Open the dialog to input the user name and password to open an SSH connection. ''' from python_qt_binding import QtCore from python_qt_binding import loadUi from python_qt_binding import QtGui import os result = False pw = None pwInput = QtGui.QDialog() ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'PasswordInput.ui') loadUi(ui_file, pwInput) pwInput.setWindowTitle(''.join(['Enter the password for user ', user, ' on ', host])) pwInput.userLine.setText(str(user)) pwInput.pwLine.setText("") pwInput.pwLine.setFocus(QtCore.Qt.OtherFocusReason) if pwInput.exec_(): result = True user = pwInput.userLine.text() pw = pwInput.pwLine.text() return result, user, pw
self.label.setObjectName(_fromUtf8("label")) self.horizontalLayout.addWidget(self.label) self.cb_guitype = QtGui.QComboBox(Dialog) self.cb_guitype.setObjectName(_fromUtf8("cb_guitype")) self.horizontalLayout.addWidget(self.cb_guitype) self.verticalLayout.addLayout(self.horizontalLayout) self.treeView = QtGui.QTreeView(Dialog) self.treeView.setObjectName(_fromUtf8("treeView")) self.verticalLayout.addWidget(self.treeView) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog) def retranslateUi(self, Dialog): Dialog.setWindowTitle( QtGui.QApplication.translate("Dialog", "Editor", None, QtGui.QApplication.UnicodeUTF8)) self.label.setText( QtGui.QApplication.translate("Dialog", "Type:", None, QtGui.QApplication.UnicodeUTF8)) if __name__ == "__main__": import sys app = QtGui.QApplication(sys.argv) Dialog = QtGui.QDialog() ui = Ui_Dialog() ui.setupUi(Dialog) Dialog.show() sys.exit(app.exec_())