Advertisement
Guest User

Untitled

a guest
May 20th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.51 KB | None | 0 0
  1. import sys
  2. from PyQt4 import QtCore, QtGui
  3. from pymmoAdmin import Ui_MainWindow
  4. from commands import Admin_Com
  5.  
  6. class MainWindow(QtGui.QMainWindow):
  7.     def __init__(self, parent=None):
  8.         QtGui.QWidget.__init__(self, parent)
  9.         self.ui = Ui_MainWindow()
  10.         self.ui.setupUi(self)
  11.         self.admin = Admin_Com()
  12.        
  13.         #QtCore.QObject.connect(self.ui.lineEdit, QtCore.SIGNAL("returnPressed()"), self.userName)
  14.         #QtCore.QObject.connect(self.ui.password, QtCore.SIGNAL("returnPressed()"), self.passWord)
  15.        
  16.         QtCore.QObject.connect(self.ui.newUser, QtCore.SIGNAL("clicked()"), self.newUser)
  17.         QtCore.QObject.connect(self.ui.changePass, QtCore.SIGNAL("clicked()"), self.changePass)
  18.         QtCore.QObject.connect(self.ui.delUser, QtCore.SIGNAL("clicked()"), self.delUser)
  19.         QtCore.QObject.connect(self.ui.Quit, QtCore.SIGNAL("clicked()"), app.quit)
  20.  
  21.     def clearFields(self):
  22.         self.ui.lineEdit.clear()
  23.         self.ui.passWord.clear()
  24.        
  25.     def newUser(self):
  26.         passWord = unicode(self.ui.password.text())
  27.         userName = unicode(self.ui.lineEdit.text())
  28.         self.admin.newUser(userName, passWord)
  29.         clearFields()
  30.        
  31.     def changePass(self):
  32.         passWord = unicode(self.ui.password.text())
  33.         userName = unicode(self.ui.lineEdit.text())
  34.         self.admin.changePass(userName, passWord)
  35.         clearFields()
  36.            
  37.     def delUser(self):
  38.         userName = unicode(self.ui.lineEdit.text())
  39.         self.admin.delUser(userName)
  40.         clearFields()
  41.        
  42.  
  43. if __name__ == "__main__":
  44.     app = QtGui.QApplication(sys.argv)
  45.     myapp = MainWindow()
  46.     myapp.show()
  47.     sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement