From: <sv...@ww...> - 2008-02-03 19:17:27
|
Author: nsmoooose Date: 2008-02-03 11:17:18 -0800 (Sun, 03 Feb 2008) New Revision: 2215 Modified: trunk/csp/tools/data/parse.py trunk/csp/tools/layout2/__init__.py trunk/csp/tools/layout2/layout.py trunk/csp/tools/layout2/scripts/ui/MainFrame.py trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py trunk/csp/tools/layout2/scripts/ui/commands/FileCommand.py Log: Some layout tool related changes: * It is now possible to recompile the sim.dar file from the layout tool. * Fixed missing inheritance in FileCommand class. * Removed check for a single instance of ObjectXMLArchive. Didn't find any reason for this check. * Path must be converted to utf8 in order for swig to handle it correctly. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2215 Modified: trunk/csp/tools/data/parse.py =================================================================== --- trunk/csp/tools/data/parse.py 2008-02-03 10:17:39 UTC (rev 2214) +++ trunk/csp/tools/data/parse.py 2008-02-03 19:17:18 UTC (rev 2215) @@ -629,12 +629,7 @@ class ObjectXMLArchive: - MASTER = None - def __init__(self, prefix, path): - if ObjectXMLArchive.MASTER is not None: - raise "Can only create one ObjectXMLArchive object" - ObjectXMLArchive.MASTER = self self._basepath = path self._objects = {} self._paths = {} Modified: trunk/csp/tools/layout2/__init__.py =================================================================== --- trunk/csp/tools/layout2/__init__.py 2008-02-03 10:17:39 UTC (rev 2214) +++ trunk/csp/tools/layout2/__init__.py 2008-02-03 19:17:18 UTC (rev 2215) @@ -1,5 +1,5 @@ import os -# this path hack allows the csplib extension module to be loaded +# this path hack allows the layout extension module to be loaded # transparently from the .bin directory. extending rather than # replacing __path__ is necessary for py2exe imports to work. bin = os.path.join(os.path.dirname(__file__), '.bin') Modified: trunk/csp/tools/layout2/layout.py =================================================================== --- trunk/csp/tools/layout2/layout.py 2008-02-03 10:17:39 UTC (rev 2214) +++ trunk/csp/tools/layout2/layout.py 2008-02-03 19:17:18 UTC (rev 2215) @@ -1,8 +1,29 @@ #!/usr/bin/env python +import os +import csp.csplib +import csp.cspsim + from csp.tools.layout2 import layout_module from csp.tools.layout2.scripts.ui.LayoutApplication import LayoutApplication +def loadModules(): + modules = ('chunklod', 'demeter') + extension = { + 'posix' : '.so', + 'nt' : '.dll', + }.get(os.name, '') + for module in modules: + module_path = os.path.join('..', '..', 'modules', module, '.bin', module) + extension + # for windows demos, the modules are instead placed in the current directory. + # TODO move them to ../modules/*.dll? + if not os.path.exists(module_path): + module_path = os.path.join(module) + extension + if not csp.csplib.ModuleLoader.load(module_path): + print('Unable to load required extension module "%s"' % module) + +loadModules() + # Create the application object and run the main loop. app = LayoutApplication(0) app.MainLoop() Modified: trunk/csp/tools/layout2/scripts/ui/MainFrame.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/MainFrame.py 2008-02-03 10:17:39 UTC (rev 2214) +++ trunk/csp/tools/layout2/scripts/ui/MainFrame.py 2008-02-03 19:17:18 UTC (rev 2215) @@ -10,6 +10,7 @@ from commands.MoveCameraToHomeCommand import MoveCameraToHomeCommand from commands.OpenSelectedFileCommand import OpenSelectedFileCommand from commands.QuitCommand import QuitCommand +from commands.ReCompileDataArchiveCommand import ReCompileDataArchiveCommand class MainFrame(wx.Frame): """This is the top window that contains all controls used by the layout editor. @@ -39,15 +40,15 @@ fileMenuCommands = [QuitCommand] viewMenuCommands = [MoveCameraToHomeCommand] - toolbarCommands = [OpenSelectedFileCommand, MoveCameraToHomeCommand] + toolsMenuCommands = [ReCompileDataArchiveCommand] + toolbarCommands = [OpenSelectedFileCommand, MoveCameraToHomeCommand, ReCompileDataArchiveCommand] # Menu items. menuBar = wx.MenuBar() - fileMenu = controlFactory.GenerateMenuItems(self, fileMenuCommands) - menuBar.Append(fileMenu, "File") - viewMenu = controlFactory.GenerateMenuItems(self, viewMenuCommands) - menuBar.Append(viewMenu, "View") + menuBar.Append(controlFactory.GenerateMenuItems(self, fileMenuCommands), "File") + menuBar.Append(controlFactory.GenerateMenuItems(self, viewMenuCommands), "View") + menuBar.Append(controlFactory.GenerateMenuItems(self, toolsMenuCommands), "Tools") self.SetMenuBar(menuBar) Modified: trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py 2008-02-03 10:17:39 UTC (rev 2214) +++ trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py 2008-02-03 19:17:18 UTC (rev 2215) @@ -88,7 +88,7 @@ self.directoryText.SetValue(directoryBrowser.GetPath()) def okButton_Click(self, event): - dataDirectory = self.directoryText.GetValue() + dataDirectory = self.directoryText.GetValue().encode('utf8') application = wx.GetApp() application.Configuration['LayoutApplication.DataDirectory'] = dataDirectory application.Configuration['LayoutApplication.XmlPath'] = os.path.join(dataDirectory, 'xml') Modified: trunk/csp/tools/layout2/scripts/ui/commands/FileCommand.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/commands/FileCommand.py 2008-02-03 10:17:39 UTC (rev 2214) +++ trunk/csp/tools/layout2/scripts/ui/commands/FileCommand.py 2008-02-03 19:17:18 UTC (rev 2215) @@ -1,6 +1,8 @@ #!/usr/bin/env python -class FileCommand: +from Command import Command + +class FileCommand(Command): """Base class for all command objects that involves files.""" def SetFileName(self, fileName): |