/[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 829 by jonathan, Tue May 6 12:06:38 2003 UTC revision 879 by jonathan, Fri May 9 16:33:10 2003 UTC
# Line 39  from command import registry, Command, T Line 39  from command import registry, Command, T
39  from messages import LAYER_SELECTED, SHAPES_SELECTED, VIEW_POSITION  from messages import LAYER_SELECTED, SHAPES_SELECTED, VIEW_POSITION
40    
41  from Thuban.UI.dock import DockFrame  from Thuban.UI.dock import DockFrame
42    from Thuban.UI.join import JoinDialog
43    
44  import resource  import resource
45    
# Line 60  class MainWindow(DockFrame): Line 61  class MainWindow(DockFrame):
61      # implemented in the __getattr__ method.      # implemented in the __getattr__ method.
62      delegated_methods = {"SelectLayer": "canvas",      delegated_methods = {"SelectLayer": "canvas",
63                           "SelectShapes": "canvas",                           "SelectShapes": "canvas",
64                             "SelectedShapes": "canvas",
65                           }                           }
66    
67      def __init__(self, parent, ID, title, application, interactor,      def __init__(self, parent, ID, title, application, interactor,
# Line 363  class MainWindow(DockFrame): Line 365  class MainWindow(DockFrame):
365    
366      def OpenSession(self):      def OpenSession(self):
367          self.save_modified_session()          self.save_modified_session()
368          dlg = wxFileDialog(self, _("Open Session"), ".", "", "*.thuban", wxOPEN)          dlg = wxFileDialog(self, _("Open Session"), ".", "",
369                               "Thuban Session File (*.thuban)|*.thuban", wxOPEN)
370          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
371              self.prepare_new_session()              self.prepare_new_session()
372              self.application.OpenSession(dlg.GetPath())              self.application.OpenSession(dlg.GetPath())
# Line 377  class MainWindow(DockFrame): Line 380  class MainWindow(DockFrame):
380    
381      def SaveSessionAs(self):      def SaveSessionAs(self):
382          dlg = wxFileDialog(self, _("Save Session As"), ".", "",          dlg = wxFileDialog(self, _("Save Session As"), ".", "",
383                             "*.thuban", wxSAVE|wxOVERWRITE_PROMPT)                             "Thuban Session File (*.thuban)|*.thuban",
384                               wxSAVE|wxOVERWRITE_PROMPT)
385          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
386              self.application.session.SetFilename(dlg.GetPath())              self.application.session.SetFilename(dlg.GetPath())
387              self.application.SaveSession()              self.application.SaveSession()
# Line 504  class MainWindow(DockFrame): Line 508  class MainWindow(DockFrame):
508          """Return true if a shape is currently selected"""          """Return true if a shape is currently selected"""
509          return self.canvas.HasSelectedShapes()          return self.canvas.HasSelectedShapes()
510    
     def choose_color(self):  
         """Run the color selection dialog and return the selected color.  
   
         If the user cancels, return None.  
         """  
         dlg = wxColourDialog(self)  
         color = None  
         if dlg.ShowModal() == wxID_OK:  
             data = dlg.GetColourData()  
             wxc = data.GetColour()  
             color = Color(wxc.Red() / 255.0,  
                           wxc.Green() / 255.0,  
                           wxc.Blue() / 255.0)  
         dlg.Destroy()  
         return color  
   
511      def HideLayer(self):      def HideLayer(self):
512          layer = self.current_layer()          layer = self.current_layer()
513          if layer is not None:          if layer is not None:
# Line 595  class MainWindow(DockFrame): Line 583  class MainWindow(DockFrame):
583              dialog.Show()              dialog.Show()
584          dialog.Raise()          dialog.Raise()
585    
586        def LayerJoinTable(self):
587            print "LayerJoinTable"
588    
589        def LayerUnjoinTable(self):
590            print "LayerUnjoinTable"
591    
592      def ShowLegend(self):      def ShowLegend(self):
593          if not self.LegendShown():          if not self.LegendShown():
# Line 619  class MainWindow(DockFrame): Line 612  class MainWindow(DockFrame):
612          dialog = self.FindRegisteredDock("legend")          dialog = self.FindRegisteredDock("legend")
613          return dialog is not None and dialog.IsShown()          return dialog is not None and dialog.IsShown()
614    
615        def TableOpen(self):
616            print "TableOpen"
617            dlg = wxFileDialog(self, _("Open Table"), ".", "",
618                               "DBF Files (*.dbf)|*.dbf|" +
619                               "CSV Files (*.csv)|*.csv|" +
620                               "All Files (*.*)|*.*",
621                               wxOPEN)
622            if dlg.ShowModal() == wxID_OK:
623                #self.application.session.OpenTable(dlg.GetPath())
624                pass
625    
626            dlg.Destroy()
627    
628        def TableClose(self):
629            print "TableClose"
630    
631        def TableShow(self):
632            print "TableShow"
633    
634        def TableHide(self):
635            print "TableHide"
636    
637        def TableJoin(self):
638            print "TableJoin"
639            dlg = JoinDialog(self, _("Join Tables"), self.application.session)
640            if dlg.ShowModal() == wxID_OK:
641                print "OK"
642    
643      def ZoomInTool(self):      def ZoomInTool(self):
644          self.canvas.ZoomInTool()          self.canvas.ZoomInTool()
645    
# Line 825  _method_command("layer_show_table", _("S Line 846  _method_command("layer_show_table", _("S
846                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
847  _method_command("layer_properties", _("&Properties..."), "LayerEditProperties",  _method_command("layer_properties", _("&Properties..."), "LayerEditProperties",
848                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
849    _method_command("layer_jointable", _("&Join Table..."), "LayerJoinTable",
850                    sensitive = _has_selected_layer)
851    _method_command("layer_unjointable", _("&Unjoin Table..."), "LayerUnjoinTable",
852                    sensitive = _has_selected_layer)
853    
854    # Table menu
855    _method_command("table_open", _("&Open..."), "TableOpen")
856    _method_command("table_close", _("&Close"), "TableClose")
857    _method_command("table_show", _("&Show"), "TableShow")
858    _method_command("table_hide", _("&Hide"), "TableHide")
859    _method_command("table_join", _("&Join..."), "TableJoin")
860    
861  # the menu structure  # the menu structure
862  main_menu = Menu("<main>", "<main>",  main_menu = Menu("<main>", "<main>",
# Line 854  main_menu = Menu("<main>", "<main>", Line 886  main_menu = Menu("<main>", "<main>",
886                          None,                          None,
887                          "layer_show", "layer_hide",                          "layer_show", "layer_hide",
888                          None,                          None,
889                            "layer_projection",
890                            None,
891                          "layer_show_table",                          "layer_show_table",
892                            "layer_jointable",
893                            "layer_unjointable",
894                          None,                          None,
                         "layer_projection",  
895                          "layer_properties"]),                          "layer_properties"]),
896                      Menu("table", _("&Table"),
897                           ["table_open", "table_close",
898                           None,
899                           "table_show", "table_hide",
900                           None,
901                           "table_join"]),
902                    Menu("help", _("&Help"),                    Menu("help", _("&Help"),
903                         ["help_about"])])                         ["help_about"])])
904    

Legend:
Removed from v.829  
changed lines
  Added in v.879

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26