Advertisement
LACabeza

Main_Login

Mar 15th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. # -*- coding: UTF-8 -*-
  2. import sys
  3. from PyQt4 import QtCore, QtGui
  4. from uiMain import Ui_MainWindow
  5. from uiAuth import Ui_Login
  6.  
  7. class Login(QtGui.QDialog):
  8.     def __init__(self, parent=None):
  9.         QtGui.QWidget.__init__(self, parent)        
  10.         self.parent = parent
  11.         self.setModal(True)
  12.  
  13.         self.User = None
  14.         self.Pass = None
  15.  
  16.         self.ui = Ui_Login()
  17.         self.ui.setupUi(self)
  18.         QtCore.QObject.connect(self, QtCore.SIGNAL("accepted()"), self.onAccept )
  19.         QtCore.QObject.connect(self, QtCore.SIGNAL("rejected()"), self.onReject )
  20.  
  21.     def onAccept(self):
  22.         self.User = self.ui.edUser.text()
  23.         self.Pass = self.ui.edPass.text()
  24.  
  25.     def onReject(self):
  26.         #print "nem deu =/"
  27.         pass
  28.  
  29. class Main(QtGui.QMainWindow):
  30.     def __init__(self, parent=None):
  31.         QtGui.QWidget.__init__(self, parent)        
  32.         self.parent = parent
  33.         self.ui = None
  34.         self.ui = Ui_MainWindow()
  35.         self.ui.setupUi(self)
  36.         QtCore.QObject.connect(self.ui.actionLogin, QtCore.SIGNAL("triggered()"), self.doLogin )
  37.  
  38.     def doLogin(self):
  39.         self.auth = Login(self)
  40.         self.auth.show()
  41.         print self.auth.User
  42.  
  43. if __name__ == "__main__":
  44.     app = QtGui.QApplication(sys.argv)
  45.     myapp = Main()
  46.     myapp.show()
  47.     sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement