Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import app
- import net
- import ui
- import snd
- import wndMgr
- import musicInfo
- import serverLoginData
- import systemSetting
- import ServerStateChecker
- import localeInfo
- import constInfo
- import uiCommon
- import ime
- import uiScriptLocale
- import time
- import dbg
- import os
- from _weakref import proxy
- def IsLoginDelay():
- return True
- def GetLoginDelay():
- return 4.0
- #update 30.08.2019
- REGBUTTON = "https://www.ephelion2.global/register"
- FORGOTPASS = "https://www.ephelion2.global/lost-pw"
- ADMINS = "https://www.ephelion2.global/team"
- DISCORD = "https://discord.gg/EN9xYE"
- FACEBOOK = "https://www.facebook.com"
- TWITTER = "https://twitter.com/"
- INSTAGRAM = "https://www.instagram.com/"
- YOUTUBE = "https://www.youtube.com/"
- MESSENGER = "https://www.facebook.com/"
- WHATSAPP = "https://www.ephelion2.global/"
- #end
- app.SetGuildMarkPath("test")
- class ConnectingDialog(ui.ScriptWindow):
- def __init__(self):
- ui.ScriptWindow.__init__(self)
- self.SetWindowName("ConnectingDialog")
- self.__LoadDialog()
- self.eventTimeOver = lambda *arg: None
- self.eventExit = lambda *arg: None
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def __LoadDialog(self):
- try:
- PythonScriptLoader = ui.PythonScriptLoader()
- PythonScriptLoader.LoadScriptFile(self, "UIScript/ConnectingDialog.py")
- self.board = self.GetChild("board")
- self.message = self.GetChild("message")
- self.countdownMessage = self.GetChild("countdown_message")
- except:
- import exception
- exception.Abort("ConnectingDialog.LoadDialog.BindObject")
- def Open(self, waitTime):
- curTime = time.clock()
- self.endTime = curTime + waitTime
- self.Lock()
- self.SetCenterPosition()
- self.SetTop()
- self.Show()
- def Close(self):
- self.Unlock()
- self.ClearDictionary()
- self.Hide()
- def Destroy(self):
- self.Hide()
- self.ClearDictionary()
- def SetText(self, text):
- self.message.SetText(text)
- def SetCountDownMessage(self, waitTime):
- self.countdownMessage.SetText("%.0f%s" % (waitTime, localeInfo.SECOND))
- def SAFE_SetTimeOverEvent(self, event):
- self.eventTimeOver = ui.__mem_func__(event)
- def SAFE_SetExitEvent(self, event):
- self.eventExit = ui.__mem_func__(event)
- def OnUpdate(self):
- lastTime = max(0, self.endTime - time.clock())
- if 0 == lastTime:
- self.Close()
- self.eventTimeOver()
- else:
- self.SetCountDownMessage(self.endTime - time.clock())
- def OnPressExitKey(self):
- self.eventExit()
- return True
- class LoginWindow(ui.ScriptWindow):
- def __init__(self, stream):
- print "LoginWindow::LoginWindow"
- ui.ScriptWindow.__init__(self)
- self.SetWindowName("LoginWindow")
- net.SetPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
- net.SetAccountConnectorHandler(self)
- self.connectingDialog = None
- self.stream = stream
- self.isNowCountDown = False
- self.pickedChannel = -1
- self.loginButton = 0
- #update 30.08.2019
- self.ForgotPass = 0
- self.TeamMembers = 0
- self.Register = 0
- self.Facebook = 0
- self.Instagram = 0
- self.Discord = 0
- self.WhatsApp = 0
- self.Messenger = 0
- self.Twitter = 0
- self.YouTube = 0
- #end
- self.cancelConnection = False
- self.questionDialog = None
- self.updateNumber = 0
- self.ChannelButton = [None, None, None, None]
- self.ChannelStatusImage = [None, None, None, None]
- # self.Languages = [None, None, None, None, None]
- self.AccountManager = [
- [None, None, None],
- [None, None, None],
- [None, None, None],
- [None, None, None],
- [None, None, None],
- ]
- self.AccountManagerData = [
- ["", ""],
- ["", ""],
- ["", ""],
- ["", ""],
- ["", ""],
- ]
- # self.LanguageButtonGroup = None
- def __del__(self):
- print "LoginWindow::~LoginWindow"
- net.SetAccountConnectorHandler(0)
- net.ClearPhaseWindow(net.PHASE_WINDOW_LOGIN, self)
- ui.ScriptWindow.__del__(self)
- def LoadAccountData(self):
- with open('lib/encodings/account.cfg', 'r') as content_file:
- encContent = content_file.read()
- content = app.DecryptByHWID(encContent)
- if ';' in content:
- accounts = content.split(';')
- for idx, account in enumerate(accounts):
- if ':#:' in account:
- data = account.split(':#:')
- self.AccountManagerData[idx][0] = data[0]
- self.AccountManagerData[idx][1] = data[1]
- for idx, account in enumerate(self.AccountManagerData):
- if account[0] != "":
- self.AccountManager[idx][0].SetText(account[0])
- def SaveAccountData(self):
- with open('lib/encodings/account.cfg', 'w+') as content_file:
- data = self.AccountManagerData[0][0] + ':#:' + self.AccountManagerData[0][1] + ';'
- data += self.AccountManagerData[1][0] + ':#:' + self.AccountManagerData[1][1] + ';'
- data += self.AccountManagerData[2][0] + ':#:' + self.AccountManagerData[2][1] + ';'
- data += self.AccountManagerData[3][0] + ':#:' + self.AccountManagerData[3][1] + ';'
- data += self.AccountManagerData[4][0] + ':#:' + self.AccountManagerData[4][1]
- encData = app.EncryptByHWID(data)
- content_file.write(encData)
- def Open(self):
- ServerStateChecker.Create(self)
- self.__RefreshServerStateList()
- print "LoginWindow::Open()"
- ServerStateChecker.Request()
- self.loginFailureMsgDict = {
- "ALREADY" : localeInfo.LOGIN_FAILURE_ALREAY,
- "NOID" : localeInfo.LOGIN_FAILURE_NOT_EXIST_ID,
- "WRONGPWD" : localeInfo.LOGIN_FAILURE_WRONG_PASSWORD,
- "FULL" : localeInfo.LOGIN_FAILURE_TOO_MANY_USER,
- "SHUTDOWN" : localeInfo.LOGIN_FAILURE_SHUTDOWN,
- "REPAIR" : localeInfo.LOGIN_FAILURE_REPAIR_ID,
- "BLOCK" : localeInfo.LOGIN_FAILURE_BLOCK_ID,
- "BESAMEKEY" : localeInfo.LOGIN_FAILURE_BE_SAME_KEY,
- "BESAMEKEYk": localeInfo.LOGIN_FAILURE_BE_SAME_KEY,
- "NOTAVAIL" : localeInfo.LOGIN_FAILURE_NOT_AVAIL,
- "NOBILL" : localeInfo.LOGIN_FAILURE_NOBILL,
- "BLKLOGIN" : localeInfo.LOGIN_FAILURE_BLOCK_LOGIN,
- "WEBBLK" : localeInfo.LOGIN_FAILURE_WEB_BLOCK,
- # "VERSION" : localeInfo.LOGIN_FAILURE_VERSION,
- }
- self.loginFailureFuncDict = {
- "WRONGPWD" : self.__DisconnectAndInputPassword,
- "QUIT" : app.Exit,
- }
- self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
- if not self.__LoadScript(uiScriptLocale.LOCALE_UISCRIPT_PATH + "LoginWindow.py"):
- dbg.TraceError("LoginWindow.Open - __LoadScript Error")
- return
- if musicInfo.loginMusic:
- snd.SetMusicVolume(systemSetting.GetMusicVolume())
- snd.FadeInMusic("BGM/" + musicInfo.loginMusic)
- snd.SetSoundVolume(systemSetting.GetSoundVolume())
- ime.AddExceptKey(91)
- ime.AddExceptKey(93)
- if not os.path.exists('lib/encodings/account.cfg'):
- self.SaveAccountData()
- self.LoadAccountData()
- self.Show()
- self.serverInfo.SetText("sv:HQ:0.0.0.0:ÑÑÑÇatrix")
- self.serverInfo.SetText("")
- # if not self.stream.IsChangingChannel():
- self.__LoadLoginInfo("loginInfo.txt")
- self.__OpenLoginBoard()
- if self.stream.isAutoLogin:
- self.Connect()
- app.ShowCursor()
- def Close(self):
- if self.connectingDialog:
- self.connectingDialog.Close()
- self.connectingDialog = None
- print "LoginWindow::Close()"
- if musicInfo.loginMusic != "" and musicInfo.selectMusic != "":
- snd.FadeOutMusic("BGM/" + musicInfo.loginMusic)
- self.idEditLine.SetTabEvent(0)
- self.idEditLine.SetReturnEvent(0)
- self.pwdEditLine.SetReturnEvent(0)
- self.pwdEditLine.SetTabEvent(0)
- self.updateNumber = 0
- self.loginButton = None
- #update 30.08.2019
- self.ForgotPass = None
- self.TeamMembers = None
- self.Register = None
- self.Facebook = None
- self.Instagram = None
- self.Discord = None
- self.WhatsApp = None
- self.Messenger = None
- self.Twitter = None
- self.YouTube = None
- #end
- self.loginBoard = None
- self.idEditLine = None
- self.pwdEditLine = None
- self.connectingDialog = None
- self.serverInfo = None
- self.ChannelButton = [None, None, None, None]
- self.ChannelButton = [None, None, None, None]
- self.ChannelStatusImage = [None, None, None, None]
- # del self.Languages[:]
- self.AccountManager = [
- [None, None, None],
- [None, None, None],
- [None, None, None],
- [None, None, None],
- [None, None, None],
- ]
- self.AccountManagerData = None
- # self.LanguageButtonGroup = None
- self.gameExitButton = None
- self.gameExitButton2 = None
- self.loginFailureMsgDict = None
- self.loginFailureFuncDict = None
- self.stream.popupWindow.Close()
- self.loginFailureFuncDict = None
- self.cancelConnection = False
- self.pickedChannel = -1
- # self.LanguageButtonGroup = None
- self.questionDialog = None
- ime.ClearExceptKey()
- app.HideCursor()
- self.KillFocus()
- self.ClearDictionary()
- self.Hide()
- def __ExitGame(self):
- app.Exit()
- def SetIDEditLineFocus(self):
- if self.idEditLine != None:
- self.idEditLine.SetFocus()
- def SetPasswordEditLineFocus(self):
- if self.pwdEditLine != None:
- self.pwdEditLine.SetFocus()
- if self.idEditLine != None:
- self.idEditLine.KillFocus()
- def FocusInDetails(self):
- if self.idEditLine != None and self.idEditLine.GetText() != "":
- self.idEditLine.SetFocus()
- elif self.pwdEditLine != None:
- self.pwdEditLine.SetFocus()
- def OnEndCountDown(self):
- self.isNowCountDown = False
- self.OnConnectFailure()
- def OnConnectFailure(self):
- if self.isNowCountDown:
- return
- snd.PlaySound("sound/ui/loginfail.wav")
- if self.connectingDialog:
- self.connectingDialog.Close()
- self.connectingDialog = None
- self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_FAILURE, self.FocusInDetails)
- def OnHandShake(self):
- if IsLoginDelay():
- return
- if self.cancelConnection:
- self.DropConnection()
- return
- snd.PlaySound("sound/ui/loginok.wav")
- self.PopupDisplayMessage(localeInfo.LOGIN_CONNECT_SUCCESS)
- def OnLoginStart(self):
- if IsLoginDelay():
- return
- if self.cancelConnection:
- self.DropConnection()
- return
- self.PopupDisplayMessage(localeInfo.LOGIN_PROCESSING)
- constInfo.ACCOUNT_NAME = str(self.idEditLine.GetText())
- def OnLoginFailure(self, error):
- ServerStateChecker.Request()
- if self.connectingDialog:
- self.connectingDialog.Close()
- self.connectingDialog = None
- if error == "SCAM":
- self.questionDialog = uiCommon.QuestionDialog2()
- self.questionDialog.SetText1("Your account is temporarily blocked until you")
- self.questionDialog.SetText2("visit our teamspeak and talk to us.")
- self.questionDialog.acceptButton.Hide()
- self.questionDialog.Open()
- return
- try:
- loginFailureMsg = self.loginFailureMsgDict[error]
- except KeyError:
- loginFailureMsg = localeInfo.LOGIN_FAILURE_UNKNOWN + error
- if self.loginFailureFuncDict:
- self.PopupNotifyMessage(loginFailureMsg, self.loginFailureFuncDict.get(error, self.FocusInDetails))
- snd.PlaySound("sound/ui/loginfail.wav")
- def DropConnection(self):
- net.Disconnect()
- self.PopupNotifyMessage(localeInfo.LOGIN_CONNECT_CANCEL)
- def __DisconnectAndInputID(self):
- if self.connectingDialog:
- self.connectingDialog.Close()
- self.connectingDialog = None
- self.SetIDEditLineFocus()
- net.Disconnect()
- def __DisconnectAndInputPassword(self):
- if self.connectingDialog:
- self.connectingDialog.Close()
- self.connectingDialog = None
- self.SetPasswordEditLineFocus()
- net.Disconnect()
- # def LangToIndex(self, lang):
- # langCodeReplace = {
- # "pl" : 0,
- # "de" : 1,
- # "ro" : 2,
- # "tr" : 3,
- # "en" : 4,
- # }
- # return langCodeReplace[lang]
- # def _CodePageReplace(self, langName):
- # cpReplace = {
- # "pl" : 1250,
- # "de" : 1252,
- # "ro" : 1250,
- # "tr" : 1254,
- # "en" : 1250,
- # }
- # try:
- # return cpReplace[langName]
- # except:
- # return 1250
- def __LoadScript(self, fileName):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, fileName)
- except:
- import exception
- exception.Abort("LoginWindow.__LoadScript.LoadObject")
- try:
- GetObject=self.GetChild
- self.loginBoard = GetObject("LoginBoard")
- self.idEditLine = GetObject("ID_EditLine")
- self.pwdEditLine = GetObject("Password_EditLine")
- self.serverInfo = GetObject("ConnectName")
- self.ChannelButton[0] = GetObject("ChannelButton1")
- self.ChannelButton[1] = GetObject("ChannelButton2")
- self.ChannelButton[2] = GetObject("ChannelButton3")
- self.ChannelButton[3] = GetObject("ChannelButton4")
- self.ChannelStatusImage[1] = GetObject("ChannelStatus2")
- self.ChannelStatusImage[0] = GetObject("ChannelStatus1")
- self.ChannelStatusImage[2] = GetObject("ChannelStatus3")
- self.ChannelStatusImage[3] = GetObject("ChannelStatus4")
- self.AccountManager[0][0] = GetObject("AccountSlot1")
- self.AccountManager[0][1] = GetObject("AccountSlotAdd1")
- self.AccountManager[0][2] = GetObject("AccountSlotErase1")
- self.AccountManager[1][0] = GetObject("AccountSlot2")
- self.AccountManager[1][1] = GetObject("AccountSlotAdd2")
- self.AccountManager[1][2] = GetObject("AccountSlotErase2")
- self.AccountManager[2][0] = GetObject("AccountSlot3")
- self.AccountManager[2][1] = GetObject("AccountSlotAdd3")
- self.AccountManager[2][2] = GetObject("AccountSlotErase3")
- self.AccountManager[3][0] = GetObject("AccountSlot4")
- self.AccountManager[3][1] = GetObject("AccountSlotAdd4")
- self.AccountManager[3][2] = GetObject("AccountSlotErase4")
- self.AccountManager[4][0] = GetObject("AccountSlot5")
- self.AccountManager[4][1] = GetObject("AccountSlotAdd5")
- self.AccountManager[4][2] = GetObject("AccountSlotErase5")
- # self.Languages[0] = GetObject("pl_lang")
- # self.Languages[1] = GetObject("de_lang")
- # self.Languages[2] = GetObject("ro_lang")
- # self.Languages[3] = GetObject("tr_lang")
- # self.Languages[4] = GetObject("en_lang")
- self.gameExitButton2 = GetObject("ExitGameButton2")
- self.gameExitButton = GetObject("ExitGameButton")
- self.loginButton = GetObject("LoginButton")
- #update 30.08.2019
- self.ForgotPass = GetObject("ForgotPass")
- self.TeamMembers = GetObject("TeamMembers")
- self.Register = GetObject("Register")
- self.Facebook = GetObject("FacebookBtn")
- self.YouTube = GetObject("YoutubeBtn")
- self.Twitter = GetObject("TwitterBtn")
- self.Discord = GetObject("DiscordBtn")
- self.Instagram = GetObject("InstagramBtn")
- self.Messenger = GetObject("MessengerBtn")
- self.WhatsApp = GetObject("WappBtn")
- #end
- except:
- import exception
- exception.Abort("LoginWindow.__LoadScript.BindObject")
- # self.LanguageButtonGroup = ui.RadioButtonGroup.CreateSelectDefault([
- # [proxy(self.Languages[0]), lambda : ui.__mem_func__(self.OnClickLanguageButton)("pl"), None],
- # [proxy(self.Languages[1]), lambda : ui.__mem_func__(self.OnClickLanguageButton)("de"), None],
- # [proxy(self.Languages[2]), lambda : ui.__mem_func__(self.OnClickLanguageButton)("ro"), None],
- # [proxy(self.Languages[3]), lambda : ui.__mem_func__(self.OnClickLanguageButton)("tr"), None],
- # [proxy(self.Languages[4]), lambda : ui.__mem_func__(self.OnClickLanguageButton)("en"), None],
- # ], self.LangToIndex(app.GetMyLanguage()))
- self.loginButton.SetEvent(ui.__mem_func__(self.__OnClickLoginButton))
- #update 30.08.2019
- self.ForgotPass.SetEvent(ui.__mem_func__(self.__ForgotPass))
- self.TeamMembers.SetEvent(ui.__mem_func__(self.__TeamMembers))
- self.Register.SetEvent(ui.__mem_func__(self.__Register))
- self.Facebook.SetEvent(ui.__mem_func__(self.__Facebook))
- self.YouTube.SetEvent(ui.__mem_func__(self.__YouTube))
- self.Twitter.SetEvent(ui.__mem_func__(self.__Twitter))
- self.Discord.SetEvent(ui.__mem_func__(self.__Discord))
- self.Instagram.SetEvent(ui.__mem_func__(self.__Instagram))
- self.Messenger.SetEvent(ui.__mem_func__(self.__Messenger))
- self.WhatsApp.SetEvent(ui.__mem_func__(self.__WhatsApp))
- #end
- self.gameExitButton.SetEvent(ui.__mem_func__(self.__OnClickExitButton))
- self.gameExitButton2.SetEvent(ui.__mem_func__(self.__OnClickExitButton))
- self.ChannelButton[0].SetEvent(lambda:ui.__mem_func__(self.__OnClickChannelButton)(0))
- self.ChannelButton[1].SetEvent(lambda:ui.__mem_func__(self.__OnClickChannelButton)(1))
- self.ChannelButton[2].SetEvent(lambda:ui.__mem_func__(self.__OnClickChannelButton)(2))
- self.ChannelButton[3].SetEvent(lambda:ui.__mem_func__(self.__OnClickChannelButton)(3))
- self.AccountManager[0][1].SetEvent(lambda:ui.__mem_func__(self.__OnClickAccountAdd)(0))
- self.AccountManager[0][2].SetEvent(lambda:ui.__mem_func__(self.__OnClickAccountErase)(0))
- self.AccountManager[1][1].SetEvent(lambda:ui.__mem_func__(self.__OnClickAccountAdd)(1))
- self.AccountManager[1][2].SetEvent(lambda:ui.__mem_func__(self.__OnClickAccountErase)(1))
- self.AccountManager[2][1].SetEvent(lambda:ui.__mem_func__(self.__OnClickAccountAdd)(2))
- self.AccountManager[2][2].SetEvent(lambda:ui.__mem_func__(self.__OnClickAccountErase)(2))
- self.AccountManager[3][1].SetEvent(lambda:ui.__mem_func__(self.__OnClickAccountAdd)(3))
- self.AccountManager[3][2].SetEvent(lambda:ui.__mem_func__(self.__OnClickAccountErase)(3))
- self.AccountManager[4][1].SetEvent(lambda:ui.__mem_func__(self.__OnClickAccountAdd)(4))
- self.AccountManager[4][2].SetEvent(lambda:ui.__mem_func__(self.__OnClickAccountErase)(4))
- self.idEditLine.SetReturnEvent(ui.__mem_func__(self.pwdEditLine.SetFocus))
- self.idEditLine.SetTabEvent(ui.__mem_func__(self.pwdEditLine.SetFocus))
- self.pwdEditLine.SetReturnEvent(ui.__mem_func__(self.__OnClickLoginButton))
- self.pwdEditLine.SetTabEvent(ui.__mem_func__(self.idEditLine.SetFocus))
- return 1
- def __OnClickSelectConnectButton(self):
- self.__RefreshServerList()
- self.__OpenServerBoard()
- def __OnAbortConnecting(self):
- self.cancelConnection = True
- net.Disconnect()
- self.FocusInDetails()
- return True
- def Connect(self):
- if IsLoginDelay():
- loginDelay = GetLoginDelay()
- self.connectingDialog = ConnectingDialog()
- self.connectingDialog.Open(loginDelay)
- self.connectingDialog.SAFE_SetTimeOverEvent(self.OnEndCountDown)
- self.connectingDialog.SAFE_SetExitEvent(self.__OnAbortConnecting)
- self.isNowCountDown = True
- else:
- self.stream.popupWindow.Close()
- self.stream.popupWindow.Open(localeInfo.LOGIN_CONNETING, self.__OnAbortConnecting, localeInfo.UI_CANCEL)
- self.cancelConnection = False
- self.stream.Connect()
- def __OnClickExitButton(self):
- self.stream.SetPhaseWindow(0)
- def __SetServerInfo(self, name):
- net.SetGameServInfo(name.strip())
- def __LoadLoginInfo(self, filename):
- loginInfo = {}
- try:
- for line in open(filename, "r"):
- line = line.strip().split('\t')
- if len(line) > 1:
- loginInfo[line[0].strip()] = line[1].strip()
- except:
- print "LoginWindow::__LoadLoginInfo(%s) -- exception occurred" % (filename)
- return
- id = loginInfo.get("id", "")
- pwd = loginInfo.get("pwd", "")
- addr = loginInfo.get("addr", None)
- port = int(loginInfo.get("port", None))
- accountAddr = loginInfo.get("account_addr", None)
- accountPort = int(loginInfo.get("account_port", None))
- self.stream.isAutoLogin = loginInfo.get("auto_login", False)
- self.stream.isAutoSelect = loginInfo.get("auto_select", False)
- serverData = (
- "%s:%d" % (addr, port),
- (addr, port, "10.tga", "10"),
- [("CH1 ", addr, port, accountPort),]
- )
- self.__SetServerInfo("%s, %s " % (serverData[0], serverData[2][0][0]))
- self.stream.SetServerInfo(serverData, 0)
- self.stream.SetCharacterSlot(loginInfo.get("slot", 0))
- self.stream.SetLoginInfo(id, pwd)
- def PopupDisplayMessage(self, msg):
- self.stream.popupWindow.Close()
- self.stream.popupWindow.Open(msg)
- def PopupNotifyMessage(self, msg, func = None):
- if not func:
- func = self.EmptyFunc
- self.stream.popupWindow.Close()
- self.stream.popupWindow.Open(msg, func, localeInfo.UI_OK)
- def OnPressExitKey(self):
- self.stream.popupWindow.Close()
- self.stream.SetPhaseWindow(0)
- return True
- def OnExit(self):
- self.stream.popupWindow.Close()
- def OnUpdate(self):
- if self.updateNumber and self.updateNumber % 10 == 0:
- downIdx = self.GetChannelDownIndex()
- if downIdx >= 0:
- for chIdx, button in enumerate(self.ChannelButton):
- if chIdx != downIdx and not button.IsIn():
- button.SetUpVisual("locale/ro/ui/login/ch"+str(chIdx+1)+"_normal.tga")
- self.ChannelButton[downIdx].SetUpVisual("locale/ro/ui/login/ch"+str(downIdx+1)+"_over.tga")
- ServerStateChecker.Update()
- self.updateNumber = self.updateNumber + 1
- def GetChannelDownIndex(self):
- return self.pickedChannel
- def SetChannelDownIndex(self, idx):
- self.pickedChannel = idx
- def EmptyFunc(self):
- pass
- #update 30.08.2019
- def __ForgotPass(self):
- os.system("start " + FORGOTPASS)
- def __TeamMembers(self):
- os.system("start " + ADMINS)
- def __Register(self):
- os.system("start " + REGBUTTON)
- def __Facebook(self):
- os.system("start " + FACEBOOK)
- def __Discord(self):
- os.system("start " + DISCORD)
- def __YouTube(self):
- os.system("start " + YOUTUBE)
- def __Instagram(self):
- os.system("start " + INSTAGRAM)
- def __Messenger(self):
- os.system("start " + MESSENGER)
- def __Twitter(self):
- os.system("start " + TWITTER)
- def __WhatsApp(self):
- os.system("start " + WHATSAPP)
- #end
- # def OnClickLanguageButton(self, lang):
- # if app.GetMyLanguage() != lang:
- # app.SetMyLanguage(lang)
- # with open('lib/language.pyc', 'w+') as langFile:
- # langFile.write(lang)
- # with open("lib/locale_language.pyc", "w+") as localeConfig:
- # localeConfig.write("10002 %d ro" % (self._CodePageReplace(lang)))
- # app.SetDefaultCodePage(self._CodePageReplace(lang))
- # reload(uiScriptLocale)
- # reload(localeInfo)
- # self.stream.SetLoginPhase()
- def __GetServerIndex(self):
- return 0
- def __GetChannelIndex(self):
- return self.channelList.GetSelectedItem() - 1
- def __SaveChannelInfo(self, serverIndex, channelIndex):
- try:
- open("lib/encodings/channel.inf", "wb+").write("%d %d" % (serverIndex, channelIndex))
- except:
- print "LoginWindow::__SaveChannelInfo - SaveError"
- def __LoadChannelInfo(self):
- try:
- serverIndex, channelIndex = open("lib/encodings/channel.inf").readline().strip().split()
- return int(serverIndex), int(channelIndex)
- except:
- print "LoginWindow::__LoadChannelInfo - OpenError"
- return 0, 0
- def __OpenLoginBoard(self):
- self.loginBoard.Show()
- self.idEditLine.SetFocus()
- sv, channel = self.__LoadChannelInfo()
- self.SetChannelDownIndex(channel)
- def NotifyChannelState(self, key, state):
- serverLoginData.SERVER_STATE_TABLE[key] = state
- serverIndex = self.__GetServerIndex()
- if (key / 10) == serverIndex:
- try:
- stateName = serverLoginData.STATE_DICT[state]
- except:
- stateName = serverLoginData.STATE_NONE
- channelIndex = key % 10
- channelName = serverLoginData.SRV_LIST[0][serverIndex][2][channelIndex][0]
- print "LoginWindow::NotifyChannelState(key=%d, state=%d): serverIndex=%d, channelIndex=%d, channelName=%s, stateName=%s" % (key, state, serverIndex, channelIndex, channelName, stateName)
- try:
- self.ChannelStatusImage[channelIndex].LoadImage("locale/ro/ui/login/%s_state.tga" % stateName)
- except:
- dbg.TraceError("NotifyChannelState can't find image from login state.")
- def __RequestServerStateList(self):
- serverIndex = self.__GetServerIndex()
- channelData = None
- try:
- channelData = serverLoginData.SRV_LIST[0][serverIndex][2]
- except:
- print "LoginWindow::__RequestServerStateList"
- return
- ServerStateChecker.Request()
- def __RefreshServerStateList(self):
- serverIndex = self.__GetServerIndex()
- channelData = None
- try:
- channelData = serverLoginData.SRV_LIST[0][0][2]
- except:
- print "LoginWindow::__RefreshServerStateList"
- return
- for index, channel in enumerate(channelData):
- ServerStateChecker.AddChannel(index, channel[1], channel[2])
- stateName = serverLoginData.STATE_NONE
- print "LoginWindow::__RefreshServerStateList(): key %d, channelName %s, stateName %s" % (index + 1, channel[0], stateName)
- def __OnClickAccountAdd(self, idx):
- if self.AccountManagerData[idx][0] == "":
- id = self.idEditLine.GetText()
- pwd = self.pwdEditLine.GetText()
- if id == "" or pwd == "":
- return
- self.AccountManagerData[idx][0] = id
- self.AccountManagerData[idx][1] = pwd
- self.SaveAccountData()
- self.AccountManager[idx][0].SetText(id)
- else:
- serverData = serverLoginData.SRV_LIST[0][0]
- self.stream.SetServerInfo(serverData, self.GetChannelDownIndex())
- channel = self.GetChannelDownIndex()
- channelData = serverData[2][channel]
- self.__SetServerInfo("%s, %s " % (serverData[0], channelData[0]))
- self.stream.SetLoginInfo(self.AccountManagerData[idx][0], self.AccountManagerData[idx][1])
- self.Connect()
- def __OnClickAccountErase(self, idx):
- self.questionDialog = uiCommon.QuestionDialog()
- self.questionDialog.SetText(localeInfo.REALLY_WANNA_DELETE_ACCOUNT_DATA)
- self.questionDialog.SetAcceptEvent(lambda arg=idx: self.OnDelAccAcceptEvent(arg))
- self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnDelAccQuestionCancel))
- self.questionDialog.Open()
- constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
- def OnDelAccAcceptEvent(self, idx):
- self.OnCloseQuestionDialog()
- self.AccountManagerData[idx][0] = ""
- self.AccountManagerData[idx][1] = ""
- self.AccountManager[idx][0].SetText("Liber")
- self.SaveAccountData()
- def OnDelAccQuestionCancel(self):
- self.OnCloseQuestionDialog()
- def OnCloseQuestionDialog(self):
- if not self.questionDialog:
- return
- self.questionDialog.Close()
- self.questionDialog = None
- constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
- def __OnClickChannelButton(self, channel):
- self.SetChannelDownIndex(channel)
- def __OnClickLoginButton(self):
- channel = -1
- if self.GetChannelDownIndex() < 0:
- self.PopupNotifyMessage(localeInfo.CHANNEL_SELECT_CHANNEL, self.SetIDEditLineFocus)
- return
- else:
- channel = self.GetChannelDownIndex()
- id = self.idEditLine.GetText()
- pwd = self.pwdEditLine.GetText()
- if not id:
- self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_ID, self.SetIDEditLineFocus)
- return
- if not pwd:
- self.PopupNotifyMessage(localeInfo.LOGIN_INPUT_PASSWORD, self.SetPasswordEditLineFocus)
- return
- if not self.stream.isAutoLogin:
- serverID = 0
- self.__SaveChannelInfo(serverID, channel)
- serverData = serverLoginData.SRV_LIST[0][serverID]
- self.stream.SetServerInfo(serverData, channel)
- channelData = serverData[2][channel]
- self.__SetServerInfo("%s, %s " % (serverData[0], channelData[0]))
- self.stream.SetLoginInfo(id, pwd)
- self.Connect()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement