factored out the EFFv2 saving into EFFImporter
[gemrb.git] / gemrb / GUIScripts / bg1 / GUICG1.py
blob984d11814dcf720fa153809ef5717ad90deced77
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, gender (GUICG1)
20 import GemRB
21 from GUIDefines import *
22 from ie_stats import *
24 import CharGenCommon
25 import GUICommon
27 GenderWindow = 0
28 TextAreaControl = 0
29 DoneButton = 0
31 def OnLoad():
32 global GenderWindow, TextAreaControl, DoneButton
34 if GUICommon.CloseOtherWindow (OnLoad):
35 if(GenderWindow):
36 GenderWindow.Unload()
37 GenderWindow = None
38 return
40 GemRB.LoadWindowPack("GUICG")
42 GenderWindow = GemRB.LoadWindow(1)
44 BackButton = GenderWindow.GetControl(6)
45 BackButton.SetText(15416)
46 DoneButton = GenderWindow.GetControl(0)
47 DoneButton.SetText(11973)
48 DoneButton.SetFlags(IE_GUI_BUTTON_DEFAULT,OP_OR)
50 TextAreaControl = GenderWindow.GetControl(5)
51 TextAreaControl.SetText(17236)
53 MaleButton = GenderWindow.GetControl(2)
54 MaleButton.SetFlags(IE_GUI_BUTTON_RADIOBUTTON,OP_OR)
56 FemaleButton = GenderWindow.GetControl(3)
57 FemaleButton.SetFlags(IE_GUI_BUTTON_RADIOBUTTON,OP_OR)
59 GemRB.SetVar("Gender",0)
60 MaleButton.SetVarAssoc("Gender",1)
61 FemaleButton.SetVarAssoc("Gender",2)
62 MaleButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, ClickedMale)
63 FemaleButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, ClickedFemale)
64 DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress)
65 BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CharGenCommon.BackPress)
66 DoneButton.SetState(IE_GUI_BUTTON_DISABLED)
67 GenderWindow.ShowModal(MODAL_SHADOW_NONE)
68 return
70 def ClickedMale():
71 TextAreaControl.SetText(13083)
72 DoneButton.SetState(IE_GUI_BUTTON_ENABLED)
73 return
75 def ClickedFemale():
76 TextAreaControl.SetText(13084)
77 DoneButton.SetState(IE_GUI_BUTTON_ENABLED)
78 return
80 def NextPress():
81 MyChar = GemRB.GetVar ("Slot")
82 #GemRB.CreatePlayer ("charbase", MyChar | 0x8000 )
83 Gender = GemRB.GetVar ("Gender")
84 GemRB.SetPlayerStat (MyChar, IE_SEX, Gender)
85 CharGenCommon.next()
86 return