import ui import background import mouseModule import player import net import snd import safebox import chat import app import localeInfo import uiScriptLocale import shop import event import game import time import constInfo class PasswordDialog(ui.ScriptWindow): def __init__(self): ui.ScriptWindow.__init__(self) self.__LoadDialog() self.IsShow = False self.isCreate = False self.Refreshdepolar() self.sendMessage = "/safebox_password " def __del__(self): ui.ScriptWindow.__del__(self) def __LoadDialog(self): try: pyScrLoader = ui.PythonScriptLoader() # if localeInfo.IsEUROPE()and app.GetLocalePath() != "locale/ca"and app.GetLocalePath() != "locale/sg" : pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "passworddialog2.py") # else: # pyScrLoader.LoadScriptFile(self, "uiscript/passworddialog.py") except: import exception exception.Abort("PasswordDialog.__LoadDialog.LoadObject") try: self.titleName = self.GetChild("TitleName") self.GetChild("titlebar").SetCloseEvent(ui.__mem_func__(self.CloseDialog)) self.passwordValue = self.GetChild("password_value") self.acceptButton = self.GetChild("accept_button") self.NormalDepo = self.GetChild("normal_button") self.NesneDepo = self.GetChild("nesne_button") except: import exception exception.Abort("PasswordDialog.__LoadDialog.BindObject") self.passwordValue.OnIMEReturn = self.OnAccept self.passwordValue.OnPressEscapeKey = self.OnCancel self.acceptButton.SetEvent(ui.__mem_func__(self.OnAccept)) self.NormalDepo.SetEvent(ui.__mem_func__(self.__NormalDepo)) self.NesneDepo.SetEvent(ui.__mem_func__(self.__NesneDepo)) def Destroy(self): self.ClearDictionary() self.titleName = None self.passwordValue = None self.acceptButton = None def SetTitle(self, title): self.titleName.SetText(title) def ShowDialog(self, isCreate): self.SetCenterPosition() self.Show() def SetSendMessage(self, msg): self.sendMessage = msg def ShowDialog(self, isCreate): self.passwordValue.SetText("") self.passwordValue.SetFocus() self.SetCenterPosition() self.Show() def CloseDialog(self): self.passwordValue.KillFocus() self.Hide() self.IsShow = True def CloseDialog(self): self.passwordValue.KillFocus() self.Hide() def OnAccept(self): if constInfo.depolar == 1: net.SendChatPacket(self.sendMessage + self.passwordValue.GetText()) elif constInfo.depolar == 0: net.SendChatPacket("/mall_password " + self.passwordValue.GetText()) self.CloseDialog() return TRUE def __NormalDepo(self): constInfo.depolar = 1 self.Refreshdepolar() def __NesneDepo(self): constInfo.depolar = 0 self.Refreshdepolar() def Refreshdepolar(self): if constInfo.depolar == 1: self.NormalDepo.Down() self.NesneDepo.SetUp() else: self.NesneDepo.Down() self.NormalDepo.SetUp() def OnCancel(self): self.Hide() return True def Show(self): if self.IsShowWindow(): return ui.ScriptWindow.Show(self) self.SetCenterPosition() self.SetTop() self.IsShow = True def Close(self): self.Hide() self.IsShow = True def OnPressEscapeKey(self): self.Close() return True def IsShowWindow(self): return self.IsShow