TickHook: Fix crash when TickHook isn't set.
[gemrb.git] / gemrb / GUIScripts / bg2 / ImportGame.py
blobff0b9421b77941956f1f932963c84fb194cf28de
1 # GemRB - Infinity Engine Emulator
2 # Copyright (C) 2003 The GemRB Project
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #character generation, import (GUICG24)
20 import GemRB
22 #import from a game
23 ImportWindow = 0
25 def OnLoad():
26 global ImportWindow
28 GemRB.LoadWindowPack("GUICG",640,480)
29 ImportWindow = GemRB.LoadWindow(20)
31 TextAreaControl = ImportWindow.GetControl(4)
32 TextAreaControl.SetText(53774)
34 TextAreaControl = ImportWindow.GetControl(2)
35 #Fill TextArea Control with character sheets, make textarea a listbox
37 DoneButton = ImportWindow.GetControl(0)
38 DoneButton.SetText(2610)
39 DoneButton.SetState(IE_GUI_BUTTON_DISABLED)
40 DoneButton.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR)
42 CancelButton = ImportWindow.GetControl(1)
43 CancelButton.SetText(15416)
44 CancelButton.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR)
46 DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, Done1Press)
47 CancelButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CancelPress)
48 ImportWindow.SetVisible(WINDOW_VISIBLE)
49 return
51 def Done1Press():
52 DoneButton = ImportWindow.GetControl(0)
53 DoneButton.SetText(11973)
54 DoneButton.SetState(IE_GUI_BUTTON_DISABLED)
55 DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, Done2Press)
56 return
58 def Done2Press():
59 if ImportWindow:
60 ImportWindow.Unload()
61 GemRB.SetNextScript("Start")
62 return
64 def CancelPress():
65 if ImportWindow:
66 ImportWindow.Unload()
67 GemRB.SetNextScript("CharGen")
68 return