client/bin/pack/root/uirestart.py

66 lines
1.4 KiB
Python
Raw Normal View History

import dbg
import app
import net
import ui
###################################################################################################
## Restart
class RestartDialog(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
def __del__(self):
ui.ScriptWindow.__del__(self)
def LoadDialog(self):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "uiscript/restartdialog.py")
except Exception, msg:
2023-07-21 21:55:58 +03:00
import sys
(type, msg, tb)=sys.exc_info()
dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (type, msg))
app.Abort()
return 0
try:
self.restartHereButton=self.GetChild("restart_here_button")
self.restartTownButton=self.GetChild("restart_town_button")
except:
import sys
(type, msg, tb)=sys.exc_info()
dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (type, msg))
app.Abort()
return 0
self.restartHereButton.SetEvent(ui.__mem_func__(self.RestartHere))
self.restartTownButton.SetEvent(ui.__mem_func__(self.RestartTown))
return 1
def Destroy(self):
self.restartHereButton=0
self.restartTownButton=0
self.ClearDictionary()
def OpenDialog(self):
self.Show()
def Close(self):
self.Hide()
2023-07-21 21:55:58 +03:00
return True
def RestartHere(self):
net.SendChatPacket("/restart_here")
def RestartTown(self):
net.SendChatPacket("/restart_town")
def OnPressExitKey(self):
2023-07-21 21:55:58 +03:00
return True
def OnPressEscapeKey(self):
2023-07-21 21:55:58 +03:00
return True