/[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 633 by jonathan, Wed Apr 9 10:11:07 2003 UTC revision 653 by jonathan, Fri Apr 11 14:28:29 2003 UTC
# Line 40  from messages import LAYER_SELECTED, SHA Line 40  from messages import LAYER_SELECTED, SHA
40    
41  from Thuban.UI.dock import DockableWindow, DockFrame, DockPanel  from Thuban.UI.dock import DockableWindow, DockFrame, DockPanel
42    
43    import resource
44    
45    
46  # the directory where the toolbar icons are stored  # the directory where the toolbar icons are stored
47  bitmapdir = os.path.join(Thuban.__path__[0], os.pardir, "Resources", "Bitmaps")  bitmapdir = os.path.join(Thuban.__path__[0], os.pardir, "Resources", "Bitmaps")
# Line 243  class MainWindow(DockFrame): Line 245  class MainWindow(DockFrame):
245              command = registry.Command(name)              command = registry.Command(name)
246              if command is not None:              if command is not None:
247                  ID = self.get_id(name)                  ID = self.get_id(name)
248                  filename = os.path.join(bitmapdir, command.Icon()) + bitmapext                  bitmap = resource.GetBitmapResource(command.Icon(),
249                  bitmap = wxBitmap(filename, wxBITMAP_TYPE_XPM)                                                      wxBITMAP_TYPE_XPM)
250                  toolbar.AddTool(ID, bitmap,                  toolbar.AddTool(ID, bitmap,
251                                  shortHelpString = command.HelpText(),                                  shortHelpString = command.HelpText(),
252                                  isToggle = command.IsCheckCommand())                                  isToggle = command.IsCheckCommand())
# Line 403  class MainWindow(DockFrame): Line 405  class MainWindow(DockFrame):
405    
406      def SetMap(self, map):      def SetMap(self, map):
407          self.canvas.SetMap(map)          self.canvas.SetMap(map)
408            self.__SetTitle(map.Title())
409          #self.legendPanel.SetMap(map)          #self.legendPanel.SetMap(map)
410    
411      def Map(self):      def Map(self):
# Line 517  class MainWindow(DockFrame): Line 520  class MainWindow(DockFrame):
520          dlg.Destroy()          dlg.Destroy()
521          return color          return color
522    
     def LayerFillColor(self):  
         layer = self.current_layer()  
         if layer is not None:  
             color = self.choose_color()  
             if color is not None:  
                 layer.GetClassification().SetDefaultFill(color)  
   
     def LayerTransparentFill(self):  
         layer = self.current_layer()  
         if layer is not None:  
             layer.GetClassification().SetDefaultFill(Color.Transparent)  
   
     def LayerOutlineColor(self):  
         layer = self.current_layer()  
         if layer is not None:  
             color = self.choose_color()  
             if color is not None:  
                 layer.GetClassification().SetDefaultLineColor(color)  
   
     def LayerNoOutline(self):  
         layer = self.current_layer()  
         if layer is not None:  
             layer.GetClassification().SetDefaultLineColor(Color.Transparent)  
   
523      def HideLayer(self):      def HideLayer(self):
524          layer = self.current_layer()          layer = self.current_layer()
525          if layer is not None:          if layer is not None:
# Line 584  class MainWindow(DockFrame): Line 563  class MainWindow(DockFrame):
563              map.SetProjection(proj)              map.SetProjection(proj)
564          proj4Dlg.Destroy()          proj4Dlg.Destroy()
565    
566      def Classify(self):      def LayerEditProperties(self):
567    
568          #          #
569          # the menu option for this should only be available if there          # the menu option for this should only be available if there
# Line 593  class MainWindow(DockFrame): Line 572  class MainWindow(DockFrame):
572          #          #
573    
574          layer = self.current_layer()          layer = self.current_layer()
575          self.OpenClassifier(layer)          self.OpenLayerProperties(layer)
576    
577      def OpenClassifier(self, layer, group = None):      def OpenLayerProperties(self, layer, group = None):
578          name = "classifier" + str(id(layer))          name = "layer_properties" + str(id(layer))
579          dialog = self.get_open_dialog(name)          dialog = self.get_open_dialog(name)
580    
581          if dialog is None:          if dialog is None:
# Line 616  class MainWindow(DockFrame): Line 595  class MainWindow(DockFrame):
595          dialog = self.FindRegisteredDock(name)          dialog = self.FindRegisteredDock(name)
596    
597          if dialog is None:          if dialog is None:
598              title = "Legend: %s" % self.Map().Title()              dialog = self.CreateDock(name, -1, _("Legend"), wxLAYOUT_LEFT)
             dialog = self.CreateDock(name, -1, title, wxLAYOUT_LEFT)  
599              legend.LegendPanel(dialog, None, self)              legend.LegendPanel(dialog, None, self)
600              dialog.Dock()              dialog.Dock()
601              dialog.GetPanel().SetMap(self.Map())              dialog.GetPanel().SetMap(self.Map())
# Line 652  class MainWindow(DockFrame): Line 630  class MainWindow(DockFrame):
630      def PrintMap(self):      def PrintMap(self):
631          self.canvas.Print()          self.canvas.Print()
632    
633        def RenameMap(self):
634            dlg = wxTextEntryDialog(self, "Map Title: ", "Rename Map",
635                                    self.Map().Title())
636            if dlg.ShowModal() == wxID_OK:
637                title = dlg.GetValue()
638                if title != "":
639                    self.Map().SetTitle(title)
640                    self.__SetTitle(title)
641    
642            dlg.Destroy()
643    
644      def identify_view_on_demand(self, layer, shapes):      def identify_view_on_demand(self, layer, shapes):
645          name = "identify_view"          name = "identify_view"
646          if self.canvas.CurrentTool() == "IdentifyTool":          if self.canvas.CurrentTool() == "IdentifyTool":
# Line 663  class MainWindow(DockFrame): Line 652  class MainWindow(DockFrame):
652                  # FIXME: bring dialog to front?                  # FIXME: bring dialog to front?
653                  pass                  pass
654    
655        def __SetTitle(self, title):
656            self.SetTitle("Thuban - " + title)
657    
658  #  #
659  # Define all the commands available in the main window  # Define all the commands available in the main window
660  #  #
# Line 765  _method_command("map_full_extent", _("&F Line 757  _method_command("map_full_extent", _("&F
757                sensitive = _has_visible_map)                sensitive = _has_visible_map)
758  _method_command("map_print", _("Prin&t"), "PrintMap",  _method_command("map_print", _("Prin&t"), "PrintMap",
759                  helptext = _("Print the map"))                  helptext = _("Print the map"))
760    _method_command("map_rename", _("&Rename"), "RenameMap",
761                    helptext = _("Rename the map"))
762    
763  # Layer menu  # Layer menu
764  _method_command("layer_add", _("&Add Layer"), "AddLayer",  _method_command("layer_add", _("&Add Layer"), "AddLayer",
# Line 772  _method_command("layer_add", _("&Add Lay Line 766  _method_command("layer_add", _("&Add Lay
766  _method_command("layer_remove", _("&Remove Layer"), "RemoveLayer",  _method_command("layer_remove", _("&Remove Layer"), "RemoveLayer",
767                  helptext = _("Remove selected layer(s)"),                  helptext = _("Remove selected layer(s)"),
768                  sensitive = _can_remove_layer)                  sensitive = _can_remove_layer)
 _method_command("layer_fill_color", _("&Fill Color"), "LayerFillColor",  
                 helptext = _("Set the fill color of selected layer(s)"),  
                 sensitive = _has_selected_layer)  
 _method_command("layer_transparent_fill", _("&Transparent Fill"),  
                 "LayerTransparentFill",  
                 helptext = _("Do not fill the selected layer(s)"),  
                 sensitive = _has_selected_layer)  
 _method_command("layer_outline_color", _("&Outline Color"), "LayerOutlineColor",  
                 helptext = _("Set the outline color of selected layer(s)"),  
                 sensitive = _has_selected_layer)  
 _method_command("layer_no_outline", _("&No Outline"), "LayerNoOutline",  
                 helptext= _("Do not draw the outline of the selected layer(s)"),  
                 sensitive = _has_selected_layer)  
769  _method_command("layer_raise", _("&Raise"), "RaiseLayer",  _method_command("layer_raise", _("&Raise"), "RaiseLayer",
770                  helptext = _("Raise selected layer(s)"),                  helptext = _("Raise selected layer(s)"),
771                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
# Line 800  _method_command("layer_hide", _("&Hide") Line 781  _method_command("layer_hide", _("&Hide")
781  _method_command("layer_show_table", _("Show Ta&ble"), "LayerShowTable",  _method_command("layer_show_table", _("Show Ta&ble"), "LayerShowTable",
782                  helptext = _("Show the selected layer's table"),                  helptext = _("Show the selected layer's table"),
783                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
784  _method_command("layer_classifier", _("Classify"), "Classify",  _method_command("layer_properties", _("Properties"), "LayerEditProperties",
785                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
786    
787  # the menu structure  # the menu structure
# Line 822  main_menu = Menu("<main>", "<main>", Line 803  main_menu = Menu("<main>", "<main>",
803                          None,                          None,
804                          "toggle_legend",                          "toggle_legend",
805                          None,                          None,
806                          "map_print"]),                          "map_print",
                   Menu("layer", _("&Layer"),  
                        ["layer_fill_color", "layer_transparent_fill",  
                         "layer_outline_color", "layer_no_outline",  
807                          None,                          None,
808                          "layer_raise", "layer_lower",                          "map_rename"]),
809                      Menu("layer", _("&Layer"),
810                            ["layer_raise", "layer_lower",
811                          None,                          None,
812                          "layer_show", "layer_hide",                          "layer_show", "layer_hide",
813                          None,                          None,
814                          "layer_show_table",                          "layer_show_table",
815                          None,                          None,
816                          "layer_classifier"]),                          "layer_properties"]),
817                    Menu("help", _("&Help"),                    Menu("help", _("&Help"),
818                         ["help_about"])])                         ["help_about"])])
819    

Legend:
Removed from v.633  
changed lines
  Added in v.653

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26