SHARE
TWEET

Untitled

a guest Jun 15th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sys
  2.   from time import *
  3.   from PyQt4 import QtGui,QtCore
  4.   from loginD import *
  5.   from mainwindow import Ui_MainWindow
  6.  
  7.  class Login(QtGui.QDialog):
  8.  #A dialog with username and password lineedit
  9.   def __init__(self,parent=None):
  10.     QtGui.QDialog.__init__(self,parent)
  11.     self.ui=Ui_LoginD()
  12.     self.ui.setupUi(self)
  13.     self.ui.PasswordLE.setEchoMode(QtGui.QLineEdit.Password)
  14.     QtCore.QObject.connect(self.ui.LoginPB,QtCore.SIGNAL('clicked()'),
  15.                            self.HandleLogin)
  16. def HandleLogin(self):
  17.     if  self.ui.PasswordLE.text()=="pass":
  18.         self.accept()
  19.  
  20.     else:
  21.         QtGui.QMessageBox.warning(
  22.             self,'Error;','bad')
  23.  
  24. class Main_Window(QtGui.QMainWindow,):
  25. #main window ui
  26.  def __init__(self,parent=None):
  27.     QtGui.QWidget.__init__(self,parent)
  28.     self.ui=Ui_MainWindow()
  29.     self.ui.setupUi(self)
  30.  
  31.  
  32.  
  33. if __name__=='__main__':
  34.  app=QtGui.QApplication(sys.argv)
  35.  #splash_pix=QtGui.QPixmap('logo and typeface blue.jpg')
  36.  #splash=QtGui.QSplashScreen(splash_pix,QtCore.Qt.WindowStaysOnTopHint)
  37.  #splash.show()
  38.  # app.processEvents()
  39. #time.sleep(2)
  40. if Login().exec_()==QtGui.QDialog.Accepted:
  41.     window=Main_Window()
  42.     window.show()
  43.     sys.exit(app.exec_())
  44.      
  45. if __name__ == '__main__':
  46.  
  47.     app = QtGui.QApplication(sys.argv)
  48.  
  49.     splash_pix = QtGui.QPixmap('logo and typeface blue.jpg')
  50.     splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
  51.     splash.show()
  52.  
  53.     def login():
  54.         splash.close()
  55.         if Login().exec_() == QtGui.QDialog.Accepted:
  56.             global window
  57.             window = Main_Window()
  58.             window.show()
  59.         else:
  60.             app.quit()
  61.  
  62.     QtCore.QTimer.singleShot(2000, login)
  63.  
  64.     sys.exit(app.exec_())
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top