65 lines
1.4 KiB
Python
65 lines
1.4 KiB
Python
|
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:
|
||
|
(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()
|
||
|
return TRUE
|
||
|
|
||
|
def RestartHere(self):
|
||
|
net.SendChatPacket("/restart_here")
|
||
|
|
||
|
def RestartTown(self):
|
||
|
net.SendChatPacket("/restart_town")
|
||
|
|
||
|
def OnPressExitKey(self):
|
||
|
return TRUE
|
||
|
|
||
|
def OnPressEscapeKey(self):
|
||
|
return TRUE
|