From: <sv...@ww...> - 2007-04-29 11:09:21
|
Author: nsmoooose Date: 2007-04-29 04:09:13 -0700 (Sun, 29 Apr 2007) New Revision: 2088 Modified: branches/python_bindings_for_ui/csp/cspsim/CSPSim.cpp branches/python_bindings_for_ui/csp/cspsim/CSPSim.h branches/python_bindings_for_ui/csp/cspsim/cspsim.i branches/python_bindings_for_ui/csp/cspsim/swig/CSPSim.i branches/python_bindings_for_ui/csp/cspsim/swig/Config.i branches/python_bindings_for_ui/csp/cspsim/swig/wf.i branches/python_bindings_for_ui/csp/cspsim/wf/WindowManager.cpp branches/python_bindings_for_ui/csp/cspsim/wf/WindowManager.h branches/python_bindings_for_ui/csp/data/ui/startup.py Log: It is now possible to change the configuration again using the python scripted window. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2088 Modified: branches/python_bindings_for_ui/csp/cspsim/CSPSim.cpp =================================================================== --- branches/python_bindings_for_ui/csp/cspsim/CSPSim.cpp 2007-04-27 11:23:21 UTC (rev 2087) +++ branches/python_bindings_for_ui/csp/cspsim/CSPSim.cpp 2007-04-29 11:09:13 UTC (rev 2088) @@ -183,6 +183,10 @@ m_ConfigurationChanged->emit(data.get()); } +wf::Signal* CSPSim::getConfigurationChangedSignal() { + return m_ConfigurationChanged.get(); +} + void CSPSim::setActiveObject(Ref<DynamicObject> object) { if (object.valid()) { CSPLOG(INFO, APP) << "Setting active object to " << *object; Modified: branches/python_bindings_for_ui/csp/cspsim/CSPSim.h =================================================================== --- branches/python_bindings_for_ui/csp/cspsim/CSPSim.h 2007-04-27 11:23:21 UTC (rev 2087) +++ branches/python_bindings_for_ui/csp/cspsim/CSPSim.h 2007-04-29 11:09:13 UTC (rev 2088) @@ -105,6 +105,7 @@ virtual void quit(); virtual void cleanup(); + virtual wf::Signal* getConfigurationChangedSignal(); virtual config::Configuration* getConfiguration(); virtual void setConfiguration(config::Configuration* config); @@ -133,7 +134,7 @@ DataManager & getDataManager() { return *m_DataManager; } Atmosphere const * getAtmosphere() const { return m_Atmosphere.get(); } - + protected: void initSim(); Modified: branches/python_bindings_for_ui/csp/cspsim/cspsim.i =================================================================== --- branches/python_bindings_for_ui/csp/cspsim/cspsim.i 2007-04-27 11:23:21 UTC (rev 2087) +++ branches/python_bindings_for_ui/csp/cspsim/cspsim.i 2007-04-29 11:09:13 UTC (rev 2088) @@ -36,6 +36,6 @@ %include <csp/cspsim/swig/Config.i> %include <csp/cspsim/swig/VirtualScene.i> %include <csp/cspsim/swig/Screens.i> +%include <csp/cspsim/swig/wf.i> %include <csp/cspsim/swig/CSPSim.i> -%include <csp/cspsim/swig/wf.i> %include <csp/cspsim/swig/windows.i> Modified: branches/python_bindings_for_ui/csp/cspsim/swig/CSPSim.i =================================================================== --- branches/python_bindings_for_ui/csp/cspsim/swig/CSPSim.i 2007-04-27 11:23:21 UTC (rev 2087) +++ branches/python_bindings_for_ui/csp/cspsim/swig/CSPSim.i 2007-04-29 11:09:13 UTC (rev 2088) @@ -48,6 +48,8 @@ namespace csp { +%newobject CSPSim::getConfiguration(); + class CSPSim { public: static csp::CSPSim *theSim; @@ -68,7 +70,9 @@ virtual config::Configuration* getConfiguration(); virtual void setConfiguration(config::Configuration* config); + virtual wf::Signal* getConfigurationChangedSignal(); + SDL_Surface * getSDLScreen(); csp::SimDate & getCurrentTime(); csp::SimTime const & getFrameRate() const; Modified: branches/python_bindings_for_ui/csp/cspsim/swig/Config.i =================================================================== --- branches/python_bindings_for_ui/csp/cspsim/swig/Config.i 2007-04-27 11:23:21 UTC (rev 2087) +++ branches/python_bindings_for_ui/csp/cspsim/swig/Config.i 2007-04-29 11:09:13 UTC (rev 2088) @@ -37,6 +37,8 @@ %feature("ref") UserInterface "$this->_incref();" %feature("unref") UserInterface "$this->_decref();" +%newobject Display::clone(); + class Display { public: Display(int width, int height, bool fullscreen); @@ -56,6 +58,8 @@ typedef std::vector<std::string> StringVector; +%newobject UserInterface::clone(); + class UserInterface { public: UserInterface(const std::string& language, const std::string& theme); @@ -73,6 +77,10 @@ virtual StringVector enumerateLanguages(); }; +%newobject Configuration::getDisplay(); +%newobject Configuration::getUserInterface(); +%newobject Configuration::clone(); + class Configuration { public: Configuration(Display* display, UserInterface* userInterface); Modified: branches/python_bindings_for_ui/csp/cspsim/swig/wf.i =================================================================== --- branches/python_bindings_for_ui/csp/cspsim/swig/wf.i 2007-04-27 11:23:21 UTC (rev 2087) +++ branches/python_bindings_for_ui/csp/cspsim/swig/wf.i 2007-04-29 11:09:13 UTC (rev 2088) @@ -222,6 +222,7 @@ public: virtual void show(Window* window); virtual void close(Window* window); + virtual void closeAll(); }; class Window : public SingleControlContainer { Modified: branches/python_bindings_for_ui/csp/cspsim/wf/WindowManager.cpp =================================================================== --- branches/python_bindings_for_ui/csp/cspsim/wf/WindowManager.cpp 2007-04-27 11:23:21 UTC (rev 2087) +++ branches/python_bindings_for_ui/csp/cspsim/wf/WindowManager.cpp 2007-04-29 11:09:13 UTC (rev 2088) @@ -229,6 +229,11 @@ myWindow->dispose(); } +void WindowManager::closeAll() { + closeByType<Window>(); +} + + Size WindowManager::getScreenSize() const { return Size(CSPSim::theSim->getSDLScreen()->w, CSPSim::theSim->getSDLScreen()->h); } Modified: branches/python_bindings_for_ui/csp/cspsim/wf/WindowManager.h =================================================================== --- branches/python_bindings_for_ui/csp/cspsim/wf/WindowManager.h 2007-04-27 11:23:21 UTC (rev 2087) +++ branches/python_bindings_for_ui/csp/cspsim/wf/WindowManager.h 2007-04-29 11:09:13 UTC (rev 2088) @@ -59,6 +59,7 @@ virtual void show(Window* window); virtual void close(Window* window); + virtual void closeAll(); virtual Size getScreenSize() const; Modified: branches/python_bindings_for_ui/csp/data/ui/startup.py =================================================================== --- branches/python_bindings_for_ui/csp/data/ui/startup.py 2007-04-27 11:23:21 UTC (rev 2087) +++ branches/python_bindings_for_ui/csp/data/ui/startup.py 2007-04-29 11:09:13 UTC (rev 2088) @@ -45,9 +45,9 @@ def run(self): # We want to connect to the configuration changed event. - #from csp.data.ui.utils import SlotProxy - #self.configurationChangedSlot = SlotProxy(self.configuration_Changed) - #self.cspsim.getConfigurationChangedSignal().connect(self.configurationChangedSlot) + from csp.data.ui.utils import SlotProxy + self.configurationChangedSlot = SlotProxy(self.configuration_Changed) + self.cspsim.getConfigurationChangedSignal().connect(self.configurationChangedSlot) self.cspsim.displayMenuScreen() self.menuScreen = self.cspsim.getCurrentScreen() @@ -58,4 +58,7 @@ self.cspsim.run() def configuration_Changed(self): - print 'configuration changed' \ No newline at end of file + self.windowManager.closeAll() + self.configuration = self.cspsim.getConfiguration() + self.displayDesktop() + self.displayMainMenu() |