connectionName = 'example'
class SelectProgramForm
(QtGui.
QDialog): def __init__(self, connName, connPrivilege):
self.fooA = connName
self.fooB = connPrivilege
self.widgetWidth = 100
self.formWidth = self.widgetWidth + 40
def setupUi(self, programSelectForm):
programSelectForm.setObjectName("programSelectForm")
programSelectForm.resize(400, self.formWidth)
self.
widget = QtGui.
QWidget(programSelectForm
) self.
widget.
setGeometry(QtCore.
QRect(20,
20,
360, self.
widgetWidth)) self.widget.setObjectName("widget")
self.verticalLayout.setObjectName("verticalLayout")
self.
instructionLabel = QtGui.
QLabel(self.
widget) self.instructionLabel.setObjectName("instructionLabel")
self.verticalLayout.addWidget(self.instructionLabel)
self.verticalLayout.addItem(spacerItem)
self.optionsGridLayout.setObjectName("optionsGridLayout")
self.verticalLayout.addLayout(self.optionsGridLayout)
self.verticalLayout.addItem(spacerItemUpper)
self.horizontalLayout.setObjectName("horizontalLayout")
self.horizontalLayout.addItem(spacerItemLower)
self.pushButtonLogout.setObjectName("pushButtonLogout")
self.horizontalLayout.addWidget(self.pushButtonLogout)
self.verticalLayout.addLayout(self.horizontalLayout)
self.connect(self.pushButtonLogout, QtCore.SIGNAL("clicked()"), self.reject)
self.retranslateUi(programSelectForm)
QtCore.
QMetaObject.
connectSlotsByName(programSelectForm
)
def retranslateUi(self, programSelectForm):
programSelectForm.
setWindowTitle(QtGui.
QApplication.
translate("programSelectForm",
"Program Select", None, QtGui.
QApplication.
UnicodeUTF8)) self.
instructionLabel.
setText(QtGui.
QApplication.
translate("programSelectForm",
"Select the program that you wish to access:", None, QtGui.
QApplication.
UnicodeUTF8)) self.
pushButtonLogout.
setText(QtGui.
QApplication.
translate("programSelectForm",
"Logout", None, QtGui.
QApplication.
UnicodeUTF8))
def __init__(self, connName):
self.fooA = connName
def setupUi(self, LoginForm):
LoginForm.setObjectName("LoginForm")
LoginForm.resize(275, 175)
self.
widget = QtGui.
QWidget(LoginForm
) self.
widget.
setGeometry(QtCore.
QRect(10,
10,
251,
147)) self.widget.setObjectName("widget")
self.verticalLayout.setObjectName("verticalLayout")
self.dataInputLayout.setObjectName("dataInputLayout")
self.labelVerticalLayout.setObjectName("labelVerticalLayout")
self.
userIDLabel = QtGui.
QLabel(self.
widget) self.userIDLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.userIDLabel.setObjectName("userIDLabel")
self.labelVerticalLayout.addWidget(self.userIDLabel)
self.
passwordLabel = QtGui.
QLabel(self.
widget) self.passwordLabel.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.passwordLabel.setObjectName("passwordLabel")
self.labelVerticalLayout.addWidget(self.passwordLabel)
self.dataInputLayout.addLayout(self.labelVerticalLayout)
self.labelButtonVerticalLayout.setObjectName("labelButtonVerticalLayout")
self.
userIDLineEdit = QtGui.
QLineEdit(self.
widget) self.userIDLineEdit.setObjectName("userIDLineEdit")
self.labelButtonVerticalLayout.addWidget(self.userIDLineEdit)
self.
passwordLineEdit = QtGui.
QLineEdit(self.
widget) self.passwordLineEdit.setObjectName("passwordLineEdit")
self.labelButtonVerticalLayout.addWidget(self.passwordLineEdit)
self.dataInputLayout.addLayout(self.labelButtonVerticalLayout)
self.verticalLayout.addLayout(self.dataInputLayout)
self.verticalLayout.addItem(spacerItem)
self.buttonLayout.setObjectName("buttonLayout")
self.
newUserPushButton = QtGui.
QPushButton(self.
widget) self.newUserPushButton.setObjectName("newUserPushButton")
self.buttonLayout.addWidget(self.newUserPushButton)
self.loginPushButton.setObjectName("loginPushButton")
self.buttonLayout.addWidget(self.loginPushButton)
self.verticalLayout.addLayout(self.buttonLayout)
self.retranslateUi(LoginForm)
QtCore.
QObject.
connect(self.
loginPushButton, QtCore.
SIGNAL("clicked()"), self.
confirmUser)
def confirmUser(self):
self.fooA = 'fooA' # these are needed in real program
self.fooB = 'fooB' # these are needed in real program
programDialog = SelectProgramForm(self.fooA, self.fooB)
programDialog.setupUi(programWindow)
programWindow.exec_()
def retranslateUi(self, LoginForm):
self.
passwordLabel.
setText(QtGui.
QApplication.
translate("LoginForm",
"Password:", None, QtGui.
QApplication.
UnicodeUTF8)) self.
newUserPushButton.
setText(QtGui.
QApplication.
translate("LoginForm",
"New User?", None, QtGui.
QApplication.
UnicodeUTF8))
if __name__ == '__main__':
newUser = LoginForm(connectionName)
newUser.setupUi(window)
window.show()
sys.exit(app.exec_())