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 (GUICG20)
21 from GUIDefines
import *
25 #import from a character sheet
30 global ImportWindow
, TextAreaControl
32 GemRB
.LoadWindowPack("GUICG")
33 ImportWindow
= GemRB
.LoadWindow(20)
35 GUICommon
.CloseOtherWindow(ImportWindow
.Unload
)
37 TextAreaControl
= ImportWindow
.GetControl(4)
38 TextAreaControl
.SetText(10963)
40 TextAreaControl
= ImportWindow
.GetControl(2)
41 TextAreaControl
.SetFlags (IE_GUI_TEXTAREA_SELECTABLE
)
42 TextAreaControl
.GetCharacters()
44 DoneButton
= ImportWindow
.GetControl(0)
45 DoneButton
.SetText (11973)
47 DoneButton
.SetState(IE_GUI_BUTTON_DISABLED
)
49 CancelButton
= ImportWindow
.GetControl(1)
50 CancelButton
.SetText (13727)
52 DoneButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, DonePress
)
53 CancelButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, CancelPress
)
54 TextAreaControl
.SetEvent(IE_GUI_TEXTAREA_ON_CHANGE
, SelectPress
)
55 ImportWindow
.ShowModal(MODAL_SHADOW_NONE
)
59 DoneButton
= ImportWindow
.GetControl(0)
60 DoneButton
.SetState(IE_GUI_BUTTON_ENABLED
)
64 FileName
= TextAreaControl
.QueryText()
65 Slot
= GemRB
.GetVar("Slot")
66 GemRB
.CreatePlayer(FileName
, Slot|
0x8000, 1)
67 GemRB
.SetToken("SmallPortrait", GemRB
.GetPlayerPortrait (Slot
, 1) )
68 GemRB
.SetToken("LargePortrait", GemRB
.GetPlayerPortrait (Slot
, 0) )
69 CharGenCommon
.jumpTo("appearance")
73 GUICommon
.CloseOtherWindow(None)
74 GemRB
.SetNextScript(GemRB
.GetToken("NextScript"))