factored out the EFFv2 saving into EFFImporter
[gemrb.git] / gemrb / GUIScripts / iwd2 / CSound.py
blob561150b595b82f6369afe73409b6536218995bb7
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, sound (GUICG19)
20 import GemRB
21 from GUIDefines import *
23 SoundWindow = 0
24 TextAreaControl = 0
25 DoneButton = 0
26 TopIndex = 0
28 def OnLoad():
29 global SoundWindow, TextAreaControl, DoneButton, TopIndex
31 GemRB.LoadWindowPack("GUICG", 800, 600)
32 #this hack will redraw the base CG window
33 SoundWindow = GemRB.LoadWindow(19)
34 GemRB.SetVar("Sound",0) #scrapping the sound value
36 BackButton = SoundWindow.GetControl(10)
37 BackButton.SetText(15416)
38 BackButton.SetFlags(IE_GUI_BUTTON_CANCEL,OP_OR)
40 DoneButton = SoundWindow.GetControl(0)
41 DoneButton.SetText(36789)
42 DoneButton.SetFlags(IE_GUI_BUTTON_DEFAULT,OP_OR)
44 TextAreaControl = SoundWindow.GetControl(50)
45 TextAreaControl.SetText(17236)
47 TextAreaControl = SoundWindow.GetControl(45)
48 TextAreaControl.SetFlags(IE_GUI_TEXTAREA_SELECTABLE)
49 TextAreaControl.SetVarAssoc("Sound", 0)
50 RowCount=TextAreaControl.GetCharSounds()
52 DefaultButton = SoundWindow.GetControl(47)
53 DefaultButton.SetText(33479)
55 DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress)
56 BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, BackPress)
57 DefaultButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, DefaultPress)
58 SoundWindow.SetVisible(WINDOW_VISIBLE)
59 return
61 def DefaultPress():
62 GemRB.SetVar("Sound",0) #scrapping the sound value
63 TextAreaControl.SetVarAssoc("Sound", 0)
64 return
66 def BackPress():
67 if SoundWindow:
68 SoundWindow.Unload()
69 GemRB.SetNextScript("Appearance")
70 GemRB.SetVar("Sound",0) #scrapping the sound value
71 return
73 def NextPress():
74 GemRB.SetToken("VoiceSet", TextAreaControl.QueryText())
75 if SoundWindow:
76 SoundWindow.Unload()
77 GemRB.SetNextScript("CharGen8") #name
78 return