From: <sv...@ww...> - 2007-04-30 21:49:18
|
Author: nsmoooose Date: 2007-04-30 14:49:06 -0700 (Mon, 30 Apr 2007) New Revision: 2091 Added: branches/python_bindings_for_ui/csp/data/ui/messagebox.py Modified: branches/python_bindings_for_ui/csp/data/ui/localization/english/global.xml branches/python_bindings_for_ui/csp/data/ui/localization/svenska/global.xml branches/python_bindings_for_ui/csp/data/ui/options.py branches/python_bindings_for_ui/csp/data/ui/themes/default/messagebox.xml Log: * Added python message box class. * Messagebox is displayed when display resolution is changed. * Added restart simulation text message to the global string table. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2091 Modified: branches/python_bindings_for_ui/csp/data/ui/localization/english/global.xml =================================================================== --- branches/python_bindings_for_ui/csp/data/ui/localization/english/global.xml 2007-04-30 21:00:10 UTC (rev 2090) +++ branches/python_bindings_for_ui/csp/data/ui/localization/english/global.xml 2007-04-30 21:49:06 UTC (rev 2091) @@ -8,6 +8,7 @@ <String key="ok">OK</String> <String key="options">Options</String> <String key="quit">Quit</String> + <String key="restart_required">Restart is required for changes to take effect.</String> <String key="screen_resolution">Resolution</String> <String key="ui_theme">Theme</String> <String key="ui_language">Language</String> Modified: branches/python_bindings_for_ui/csp/data/ui/localization/svenska/global.xml =================================================================== --- branches/python_bindings_for_ui/csp/data/ui/localization/svenska/global.xml 2007-04-30 21:00:10 UTC (rev 2090) +++ branches/python_bindings_for_ui/csp/data/ui/localization/svenska/global.xml 2007-04-30 21:49:06 UTC (rev 2091) @@ -8,6 +8,7 @@ <String key="ok">OK</String> <String key="options">Installningar</String> <String key="quit">Avsluta</String> + <String key="restart_required">Omstart kravs for att andring skall galla.</String> <String key="screen_resolution">Upplosning</String> <String key="ui_theme">Tema</String> <String key="ui_language">Sprak</String> Added: branches/python_bindings_for_ui/csp/data/ui/messagebox.py =================================================================== --- branches/python_bindings_for_ui/csp/data/ui/messagebox.py 2007-04-30 21:00:10 UTC (rev 2090) +++ branches/python_bindings_for_ui/csp/data/ui/messagebox.py 2007-04-30 21:49:06 UTC (rev 2091) @@ -0,0 +1,55 @@ +#!/usr/bin/python + +# Combat Simulator Project +# Copyright (C) 2002-2005 The Combat Simulator Project +# http://csp.sourceforge.net +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +""" +Combat Simulator Project : Message box script +""" + +import csp.cspsim +from csp.data.ui.utils import SlotManager + +class MessageBox(csp.cspsim.Window, SlotManager): + def __init__(self, cspsim, themeName): + csp.cspsim.Window.__init__(self) + SlotManager.__init__(self) + + self.cspsim = cspsim + + # Load the user interface for this window. + serializer = csp.cspsim.Serialization() + serializer.load(self, themeName, 'messagebox.xml') + + # Listen to the click signal for the ok button. + okButton = self.getById('ok') + if okButton != None: + self.connectToClickSignal(okButton, self.ok_Click) + + def ok_Click(self): + self.close() + + def setMessage(self, message): + messageLabel = self.getById('message') + if messageLabel != None: + messageLabel.setText(message) + + def show(self, parentWindow, message): + self.setMessage(message) + parentWindow.getWindowManager().show(self) + self.centerWindow() \ No newline at end of file Modified: branches/python_bindings_for_ui/csp/data/ui/options.py =================================================================== --- branches/python_bindings_for_ui/csp/data/ui/options.py 2007-04-30 21:00:10 UTC (rev 2090) +++ branches/python_bindings_for_ui/csp/data/ui/options.py 2007-04-30 21:49:06 UTC (rev 2091) @@ -93,6 +93,11 @@ self.configuration.getDisplay().setWidth(width) self.configuration.getDisplay().setHeight(height) + from csp.data.ui.messagebox import MessageBox + messageBox = MessageBox(self.cspsim, self.getTheme()) + messageBox.show(self, '${restart_required}') + + def theme_Changed(self): self.configuration.getUserInterface().setTheme(self.themeListBox.getSelectedItem().getText()) Modified: branches/python_bindings_for_ui/csp/data/ui/themes/default/messagebox.xml =================================================================== --- branches/python_bindings_for_ui/csp/data/ui/themes/default/messagebox.xml 2007-04-30 21:00:10 UTC (rev 2090) +++ branches/python_bindings_for_ui/csp/data/ui/themes/default/messagebox.xml 2007-04-30 21:49:06 UTC (rev 2091) @@ -3,17 +3,18 @@ <Includes> <!-- This include will set the default behaviour on all controls. --> <StyleInclude>styles.xml</StyleInclude> + <StringTableInclude>global.xml</StringTableInclude> </Includes> - <Window CssClass="window_default" SizeWidth="409" SizeHeight="200" LocationZ="30" > + <Window CssClass="window_default" SizeWidth="500" SizeHeight="200" LocationZ="50" > <Control> <MultiControlContainer> <Controls> - <Label Id="caption" LocationX="10" LocationY="2" SizeWidth="398" SizeHeight="30" Text="Combat Simulator Project" /> - <Label CssClass="stripe" LocationX="0" LocationY="30" SizeWidth="398" SizeHeight="10" /> + <Label Id="caption" LocationX="10" LocationY="2" SizeWidth="489" SizeHeight="30" Text="Combat Simulator Project" /> + <Label CssClass="stripe" LocationX="0" LocationY="30" SizeWidth="489" SizeHeight="10" /> - <Label Id="message" LocationX="10" LocationY="55" SizeWidth="398" SizeHeight="30" Text="Combat Simulator Project" /> + <Label Id="message" LocationX="10" LocationY="55" SizeWidth="489" SizeHeight="30" Text="Combat Simulator Project" /> - <Button Id="ok" LocationX="140" LocationY="150" SizeWidth="120" SizeHeight="35" Text="OK" /> + <Button Id="ok" LocationX="170" LocationY="150" SizeWidth="120" SizeHeight="35" Text="OK" /> </Controls> </MultiControlContainer> </Control> |