Exemplo n.º 1
0
class LoginWindow (QWidget):
    def __init__(self,director):
        QWidget.__init__(self)
        self.director = director
        self.ui = Ui_LoginWindow()
        self.ui.setupUi(self)
        self.connect(self.ui.loginButton,SIGNAL('clicked()'),self.onLoginButtonClickedEvent)

    def onLoginButtonClickedEvent(self):
        if self.director.clientThread == None:
            self.director.clientThread = ClientThread(self.director)
            client = Client(8,str(self.ui.ServerIPText.text()),self.ui.PortNumberText.text().toInt()[0],0.1,self.director.clientThread)
            self.director.clientThread.begin(client)
            self.director.connectSlotAndSignalWithServices()
        else:
            self.director.clientThread.client.close()
            self.director.clientThread.client.isAlive = False
            self.director.clientThread = ClientThread(self.director)
            client = Client(8,str(self.ui.ServerIPText.text()),self.ui.PortNumberText.text().toInt()[0],0.1,self.director.clientThread)
            self.director.clientThread.begin(client)
            print "get another client"
            self.director.connectSlotAndSignalWithServices()
        data = {}

        data['nickname'] = unicode(self.ui.NicknameText.text())
        data['password'] = unicode(self.ui.PasswordText.text())
        self.director.clientThread.client.sendToServer(1001,1001,data)
        self.director.playerNickname = data['nickname']

    def connectWithService(self):
        self.disconnect(self.director.clientThread.client.dispatcher.services[1001],\
                     SIGNAL('goToHallFromLoginWindow(bool,int,int)'),self.goToHallFromLoginWindow)
        self.disconnect(self.director.clientThread.client.dispatcher.services[1001],\
                     SIGNAL('loginFailed(QString)'),self.loginFailed)
        self.connect(self.director.clientThread.client.dispatcher.services[1001],\
                     SIGNAL('goToHallFromLoginWindow(bool,int,int)'),self.goToHallFromLoginWindow)
        self.connect(self.director.clientThread.client.dispatcher.services[1001],\
                     SIGNAL('loginFailed(QString)'),self.loginFailed)

    def goToHallFromLoginWindow(self,isFirstLogin,tableColNum,tableRowNum):
        print "Go To Hall From Login Window"
        if isFirstLogin:
            QMessageBox.about(None,u"欢迎光临",u"欢迎第一次登陆")
        else:
            QMessageBox.about(None,u'欢迎光临',u"欢迎再次登陆")
        self.close()
        print "Type self director:",self.director
        self.hall = Hall(tableRowNum,tableColNum,self.director )
        self.hall.show()

    def loginFailed(self,errorString):
        QMessageBox.about(None,u"登陆失败!",errorString)
Exemplo n.º 2
0
 def __init__(self,director):
     QWidget.__init__(self)
     self.director = director
     self.ui = Ui_LoginWindow()
     self.ui.setupUi(self)
     self.connect(self.ui.loginButton,SIGNAL('clicked()'),self.onLoginButtonClickedEvent)
Exemplo n.º 3
0
    KAC Predictor (Key-Agricultural Commodities Daily Market Price Prediction using Deep Neural Networks)
    Copyright (C) 2018  Tejas Verghese

    This file is part of KAC Predictor.

    KAC Predictor is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    KAC Predictor is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with KAC Predictor.  If not, see <http://www.gnu.org/licenses/>.

@author: Tejas Verghese
"""
from PyQt5 import QtWidgets
from login_window import Ui_LoginWindow

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    LoginWindow = QtWidgets.QMainWindow()
    ui = Ui_LoginWindow()
    ui.setupUi(LoginWindow)
    LoginWindow.show()
    sys.exit(app.exec_())