/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/mainwindow.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/mainwindow.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1448 by jonathan, Thu Jul 17 14:59:41 2003 UTC revision 1464 by bh, Fri Jul 18 18:20:40 2003 UTC
# Line 43  from menu import Menu Line 43  from menu import Menu
43    
44  from context import Context  from context import Context
45  from command import registry, Command, ToolCommand  from command import registry, Command, ToolCommand
46  from messages import LAYER_SELECTED, SHAPES_SELECTED, VIEW_POSITION  from messages import LAYER_SELECTED, SHAPES_SELECTED, VIEW_POSITION, \
47         MAP_REPLACED
48  from about import About  from about import About
49    
50  from Thuban.UI.dock import DockFrame  from Thuban.UI.dock import DockFrame
# Line 63  class MainWindow(DockFrame): Line 64  class MainWindow(DockFrame):
64      # actually come from. This delegation is implemented in the      # actually come from. This delegation is implemented in the
65      # Subscribe and unsubscribed methods      # Subscribe and unsubscribed methods
66      delegated_messages = {LAYER_SELECTED: "canvas",      delegated_messages = {LAYER_SELECTED: "canvas",
67                            SHAPES_SELECTED: "canvas"}                            SHAPES_SELECTED: "canvas",
68                              MAP_REPLACED: "canvas"}
69    
70      # Methods delegated to some instance variables. The delegation is      # Methods delegated to some instance variables. The delegation is
71      # implemented in the __getattr__ method.      # implemented in the __getattr__ method.
# Line 364  class MainWindow(DockFrame): Line 366  class MainWindow(DockFrame):
366              result = wxID_NO              result = wxID_NO
367          return result          return result
368    
     def prepare_new_session(self):  
         for d in self.dialogs.values():  
             if not isinstance(d, tree.SessionTreeView):  
                 d.Close()  
   
369      def NewSession(self):      def NewSession(self):
370          if self.save_modified_session() != wxID_CANCEL:          if self.save_modified_session() != wxID_CANCEL:
             self.prepare_new_session()  
371              self.application.SetSession(create_empty_session())              self.application.SetSession(create_empty_session())
372    
373      def OpenSession(self):      def OpenSession(self):
# Line 380  class MainWindow(DockFrame): Line 376  class MainWindow(DockFrame):
376                                 "Thuban Session File (*.thuban)|*.thuban",                                 "Thuban Session File (*.thuban)|*.thuban",
377                                 wxOPEN)                                 wxOPEN)
378              if dlg.ShowModal() == wxID_OK:              if dlg.ShowModal() == wxID_OK:
                 self.prepare_new_session()  
379                  self.application.OpenSession(dlg.GetPath())                  self.application.OpenSession(dlg.GetPath())
380              dlg.Destroy()              dlg.Destroy()
381    

Legend:
Removed from v.1448  
changed lines
  Added in v.1464

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26