factored out the EFFv2 saving into EFFImporter
[gemrb.git] / gemrb / GUIScripts / iwd2 / Songs.py
blobfd6689c2d7d5e9c63b68d6fc31d84d22e806345b
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 #instead of credits, you can listen the songs of the game :)
20 import GemRB
21 from GUIDefines import *
23 MovieWindow = 0
24 TextAreaControl = 0
25 MoviesTable = 0
27 def OnLoad():
28 global MovieWindow, TextAreaControl, MoviesTable
30 GemRB.LoadWindowPack("GUIMOVIE", 800, 600)
31 MovieWindow = GemRB.LoadWindow(2)
32 MovieWindow.SetFrame ()
33 TextAreaControl = MovieWindow.GetControl(0)
34 TextAreaControl.SetFlags(IE_GUI_TEXTAREA_SELECTABLE)
35 PlayButton = MovieWindow.GetControl(2)
36 CreditsButton = MovieWindow.GetControl(3)
37 DoneButton = MovieWindow.GetControl(4)
38 MoviesTable = GemRB.LoadTable("MUSIC")
39 for i in range(0, MoviesTable.GetRowCount() ):
40 s = MoviesTable.GetRowName(i)
41 TextAreaControl.Append(s,-1)
42 TextAreaControl.SetVarAssoc("MovieIndex",0)
43 PlayButton.SetText(17318)
44 CreditsButton.SetText(15591)
45 DoneButton.SetText(11973)
46 DoneButton.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR)
48 PlayButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, PlayPress)
49 CreditsButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CreditsPress)
50 DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, DonePress)
51 MovieWindow.SetVisible(WINDOW_VISIBLE)
52 return
54 def PlayPress():
55 s = GemRB.GetVar("MovieIndex")
56 t = MoviesTable.GetValue(s, 0)
57 GemRB.LoadMusicPL(t,1)
58 return
60 def CreditsPress():
61 GemRB.PlayMovie("CREDITS")
62 return
64 def DonePress():
65 if MovieWindow:
66 MovieWindow.Unload()
67 GemRB.SetNextScript("Start")
68 return