/[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 357 by bh, Mon Dec 9 10:32:27 2002 UTC revision 563 by jonathan, Wed Mar 26 11:07:02 2003 UTC
# Line 1  Line 1 
1  # Copyright (C) 2001, 2002 by Intevation GmbH  # Copyright (C) 2001, 2002, 2003 by Intevation GmbH
2  # Authors:  # Authors:
3  # Jan-Oliver Wagner <[email protected]>  # Jan-Oliver Wagner <[email protected]>
4  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]>
# Line 12  The main window Line 12  The main window
12    
13  __version__ = "$Revision$"  __version__ = "$Revision$"
14    
15    __ThubanVersion__ = "0.2" #"$THUBAN_0_2$"
16    #__BuildDate__ = "$Date$"
17    
18  import os  import os
19    
20  from wxPython.wx import *  from wxPython.wx import *
21    
22  import Thuban  import Thuban
23    from Thuban import _
24  from Thuban.Model.session import create_empty_session  from Thuban.Model.session import create_empty_session
25  from Thuban.Model.layer import Layer  from Thuban.Model.layer import Layer
26  from Thuban.Model.color import Color  from Thuban.Model.color import Color
# Line 26  import view Line 30  import view
30  import tree  import tree
31  import proj4dialog  import proj4dialog
32  import tableview, identifyview  import tableview, identifyview
33    import classifier
34    import legend
35  from menu import Menu  from menu import Menu
36    
37  from context import Context  from context import Context
38  from command import registry, Command, ToolCommand  from command import registry, Command, ToolCommand
39  from messages import SELECTED_SHAPE, VIEW_POSITION  from messages import LAYER_SELECTED, SHAPES_SELECTED, VIEW_POSITION, DOCKABLE_DOCKED, DOCKABLE_UNDOCKED, DOCKABLE_CLOSED
40    
41    from Thuban.UI.dock import DockableWindow
42    
43    
44  # the directory where the toolbar icons are stored  # the directory where the toolbar icons are stored
45  bitmapdir = os.path.join(Thuban.__path__[0], os.pardir, "Resources", "Bitmaps")  bitmapdir = os.path.join(Thuban.__path__[0], os.pardir, "Resources", "Bitmaps")
46  bitmapext = ".xpm"  bitmapext = ".xpm"
47    
48    ID_WINDOW_LEGEND = 4001
49    ID_WINDOW_CANVAS = 4002
50    
51    
52  class MainWindow(wxFrame):  class MainWindow(wxFrame):
53    
54        # Some messages that can be subscribed/unsubscribed directly through
55        # the MapCanvas come in fact from other objects. This is a map to
56        # map those messages to the names of the instance variables they
57        # actually come from. This delegation is implemented in the
58        # Subscribe and unsubscribed methods
59        delegated_messages = {LAYER_SELECTED: "canvas",
60                              SHAPES_SELECTED: "canvas"}
61    
62        # Methods delegated to some instance variables. The delegation is
63        # implemented in the __getattr__ method.
64        delegated_methods = {"SelectLayer": "canvas",
65                             "SelectShapes": "canvas",
66                             }
67    
68      def __init__(self, parent, ID, title, application, interactor,      def __init__(self, parent, ID, title, application, interactor,
69                   initial_message = None, size = wxSize(-1, -1)):                   initial_message = None, size = wxSize(-1, -1)):
70          wxFrame.__init__(self, parent, ID, title, wxDefaultPosition, size)          wxFrame.__init__(self, parent, ID, title, wxDefaultPosition, size)
71    
72          self.application = application          self.application = application
         self.interactor = interactor  
73    
74          self.CreateStatusBar()          self.CreateStatusBar()
75          if initial_message:          if initial_message:
# Line 63  class MainWindow(wxFrame): Line 87  class MainWindow(wxFrame):
87          # call Realize to make sure that the tools appear.          # call Realize to make sure that the tools appear.
88          toolbar.Realize()          toolbar.Realize()
89    
90            win = wxSashLayoutWindow(self, ID_WINDOW_LEGEND,
91                                     style=wxNO_BORDER|wxSW_3D)
92            win.SetOrientation(wxLAYOUT_VERTICAL)
93            win.SetAlignment(wxLAYOUT_LEFT)
94            win.SetSashVisible(wxSASH_RIGHT, True)
95            win.SetSashBorder(wxSASH_RIGHT, True)
96            win.Hide()
97            self.sash_legend = win
98    
99    
100          # Create the map canvas          # Create the map canvas
101          canvas = view.MapCanvas(self, -1, interactor)          canvas = view.MapCanvas(self, -1)
102          canvas.Subscribe(VIEW_POSITION, self.view_position_changed)          canvas.Subscribe(VIEW_POSITION, self.view_position_changed)
103            canvas.Subscribe(SHAPES_SELECTED, self.identify_view_on_demand)
104          self.canvas = canvas          self.canvas = canvas
105    
106            self.SetAutoLayout(True)
107    
108          self.init_dialogs()          self.init_dialogs()
109    
110          interactor.Subscribe(SELECTED_SHAPE, self.identify_view_on_demand)          self.legendPanel = None
111            self.legendWindow = None
112    
113    
114    
115          EVT_CLOSE(self, self.OnClose)          EVT_CLOSE(self, self.OnClose)
116            EVT_SASH_DRAGGED_RANGE(self,
117                ID_WINDOW_LEGEND, ID_WINDOW_CANVAS,
118                self._OnSashDrag)
119            EVT_SIZE(self, self._OnSize)
120    
121        def Subscribe(self, channel, *args):
122            """Subscribe a function to a message channel.
123    
124            If channel is one of the delegated messages call the appropriate
125            object's Subscribe method. Otherwise do nothing.
126            """
127            if channel in self.delegated_messages:
128                object = getattr(self, self.delegated_messages[channel])
129                object.Subscribe(channel, *args)
130            else:
131                print "Trying to subscribe to unsupported channel %s" % channel
132    
133        def Unsubscribe(self, channel, *args):
134            """Unsubscribe a function from a message channel.
135    
136            If channel is one of the delegated messages call the appropriate
137            object's Unsubscribe method. Otherwise do nothing.
138            """
139            if channel in self.delegated_messages:
140                object = getattr(self, self.delegated_messages[channel])
141                object.Unsubscribe(channel, *args)
142    
143        def __getattr__(self, attr):
144            """If attr is one of the delegated methods return that method
145    
146            Otherwise raise AttributeError.
147            """
148            if attr in self.delegated_methods:
149                return getattr(getattr(self, self.delegated_methods[attr]), attr)
150            raise AttributeError(attr)
151    
152      def init_ids(self):      def init_ids(self):
153          """Initialize the ids"""          """Initialize the ids"""
# Line 168  class MainWindow(wxFrame): Line 243  class MainWindow(wxFrame):
243                              command.IsCheckCommand())                              command.IsCheckCommand())
244                  self.bind_command_events(command, ID)                  self.bind_command_events(command, ID)
245              else:              else:
246                  print "Unknown command %s" % name                  print _("Unknown command %s") % name
247    
248      def add_toolbar_command(self, toolbar, name):      def add_toolbar_command(self, toolbar, name):
249          """Add the command with name name to the toolbar toolbar.          """Add the command with name name to the toolbar toolbar.
# Line 190  class MainWindow(wxFrame): Line 265  class MainWindow(wxFrame):
265                                  isToggle = command.IsCheckCommand())                                  isToggle = command.IsCheckCommand())
266                  self.bind_command_events(command, ID)                  self.bind_command_events(command, ID)
267              else:              else:
268                  print "Unknown command %s" % name                  print _("Unknown command %s") % name
269    
270      def Context(self):      def Context(self):
271          """Return the context object for a command invoked from this window          """Return the context object for a command invoked from this window
# Line 203  class MainWindow(wxFrame): Line 278  class MainWindow(wxFrame):
278              command = registry.Command(name)              command = registry.Command(name)
279              command.Execute(self.Context())              command.Execute(self.Context())
280          else:          else:
281              print "Unknown command ID %d" % event.GetId()              print _("Unknown command ID %d") % event.GetId()
282    
283      def update_command_ui(self, event):      def update_command_ui(self, event):
284          #print "update_command_ui", self.id_to_name[event.GetId()]          #print "update_command_ui", self.id_to_name[event.GetId()]
# Line 242  class MainWindow(wxFrame): Line 317  class MainWindow(wxFrame):
317    
318      def add_dialog(self, name, dialog):      def add_dialog(self, name, dialog):
319          if self.dialogs.has_key(name):          if self.dialogs.has_key(name):
320              raise RuntimeError("The Dialog named %s is already open" % name)              raise RuntimeError(_("The Dialog named %s is already open") % name)
321          self.dialogs[name] = dialog          self.dialogs[name] = dialog
322    
323      def dialog_open(self, name):      def dialog_open(self, name):
# Line 284  class MainWindow(wxFrame): Line 359  class MainWindow(wxFrame):
359              flags = wxYES_NO | wxICON_QUESTION              flags = wxYES_NO | wxICON_QUESTION
360              if can_veto:              if can_veto:
361                  flags = flags | wxCANCEL                  flags = flags | wxCANCEL
362              result = self.RunMessageBox("Exit",              result = self.RunMessageBox(_("Exit"),
363                                          ("The session has been modified."                                          _("The session has been modified."
364                                           " Do you want to save it?"),                                           " Do you want to save it?"),
365                                          flags)                                          flags)
366              if result == wxID_YES:              if result == wxID_YES:
# Line 294  class MainWindow(wxFrame): Line 369  class MainWindow(wxFrame):
369              result = wxID_NO              result = wxID_NO
370          return result          return result
371    
372        def prepare_new_session(self):
373            for d in self.dialogs.values():
374                if not isinstance(d, tree.SessionTreeView):
375                    d.Close()
376    
377      def NewSession(self):      def NewSession(self):
378          self.save_modified_session()          self.save_modified_session()
379            self.prepare_new_session()
380          self.application.SetSession(create_empty_session())          self.application.SetSession(create_empty_session())
381    
382      def OpenSession(self):      def OpenSession(self):
383          self.save_modified_session()          self.save_modified_session()
384          dlg = wxFileDialog(self, "Select a session file", ".", "",          dlg = wxFileDialog(self, _("Open Session"), ".", "", "*.thuban", wxOPEN)
                            "*.thuban", wxOPEN)  
385          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
386                self.prepare_new_session()
387              self.application.OpenSession(dlg.GetPath())              self.application.OpenSession(dlg.GetPath())
388          dlg.Destroy()          dlg.Destroy()
389    
390      def SaveSession(self):      def SaveSession(self):
391          if self.application.session.filename == None:          if self.application.session.filename == None:
392              self.SaveSessionAs()              self.SaveSessionAs()
393          self.application.SaveSession()          else:
394                self.application.SaveSession()
395    
396      def SaveSessionAs(self):      def SaveSessionAs(self):
397          dlg = wxFileDialog(self, "Enter a filename for session", ".", "",          dlg = wxFileDialog(self, _("Save Session As"), ".", "",
398                             "*.thuban", wxOPEN)                             "*.thuban", wxOPEN)
399          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
400              self.application.session.SetFilename(dlg.GetPath())              self.application.session.SetFilename(dlg.GetPath())
# Line 335  class MainWindow(wxFrame): Line 417  class MainWindow(wxFrame):
417    
418      def SetMap(self, map):      def SetMap(self, map):
419          self.canvas.SetMap(map)          self.canvas.SetMap(map)
420            #self.legendPanel.SetMap(map)
421    
422      def Map(self):      def Map(self):
423          """Return the map displayed by this mainwindow"""          """Return the map displayed by this mainwindow"""
424    
425            # sanity check
426            #assert(self.canvas.Map() is self.legendPanel.GetMap())
427    
428          return self.canvas.Map()          return self.canvas.Map()
429    
430      def ShowSessionTree(self):      def ShowSessionTree(self):
# Line 346  class MainWindow(wxFrame): Line 433  class MainWindow(wxFrame):
433          if dialog is None:          if dialog is None:
434              dialog = tree.SessionTreeView(self, self.application, name)              dialog = tree.SessionTreeView(self, self.application, name)
435              self.add_dialog(name, dialog)              self.add_dialog(name, dialog)
436              dialog.Show(true)              dialog.Show(True)
437          else:          else:
438              # FIXME: bring dialog to front here              # FIXME: bring dialog to front here
439              pass              pass
440    
441    
442      def About(self):      def About(self):
443          self.RunMessageBox("About",          self.RunMessageBox(_("About"),
444                             ("Thuban is a program for\n"                             _("Thuban v%s\n"
445                                #"Build Date: %s\n"
446                                "\n"
447                                "Thuban is a program for\n"
448                              "exploring geographic data.\n"                              "exploring geographic data.\n"
449                              "Copyright (C) 2001, 2002 Intevation GmbH.\n"                              "Copyright (C) 2001-2003 Intevation GmbH.\n"
450                              "Thuban is licensed under the GPL"),                              "Thuban is licensed under the GNU GPL"
451                               % __ThubanVersion__), #__BuildDate__)),
452                             wxOK | wxICON_INFORMATION)                             wxOK | wxICON_INFORMATION)
453    
454      def AddLayer(self):      def AddLayer(self):
455          dlg = wxFileDialog(self, "Select a data file", ".", "", "*.*",          dlg = wxFileDialog(self, _("Select a data file"), ".", "", "*.*",
456                             wxOPEN)                             wxOPEN)
457          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
458              filename = dlg.GetPath()              filename = dlg.GetPath()
# Line 372  class MainWindow(wxFrame): Line 464  class MainWindow(wxFrame):
464                  map.AddLayer(layer)                  map.AddLayer(layer)
465              except IOError:              except IOError:
466                  # the layer couldn't be opened                  # the layer couldn't be opened
467                  self.RunMessageBox("Add Layer",                  self.RunMessageBox(_("Add Layer"),
468                                     "Can't open the file '%s'." % filename)                                     _("Can't open the file '%s'.") % filename)
469              else:              else:
470                  if not has_layers:                  if not has_layers:
471                      # if we're adding a layer to an empty map, for the                      # if we're adding a layer to an empty map, fit the
472                      # new map to the window                      # new map to the window
473                      self.canvas.FitMapToWindow()                      self.canvas.FitMapToWindow()
474          dlg.Destroy()          dlg.Destroy()
# Line 414  class MainWindow(wxFrame): Line 506  class MainWindow(wxFrame):
506    
507          If no layer is selected, return None          If no layer is selected, return None
508          """          """
509          return self.interactor.SelectedLayer()          return self.canvas.SelectedLayer()
510    
511      def has_selected_layer(self):      def has_selected_layer(self):
512          """Return true if a layer is currently selected"""          """Return true if a layer is currently selected"""
513          return self.interactor.HasSelectedLayer()          return self.canvas.HasSelectedLayer()
514    
515      def choose_color(self):      def choose_color(self):
516          """Run the color selection dialog and return the selected color.          """Run the color selection dialog and return the selected color.
# Line 441  class MainWindow(wxFrame): Line 533  class MainWindow(wxFrame):
533          if layer is not None:          if layer is not None:
534              color = self.choose_color()              color = self.choose_color()
535              if color is not None:              if color is not None:
536                  layer.SetFill(color)                  layer.GetClassification().SetDefaultFill(color)
537    
538      def LayerTransparentFill(self):      def LayerTransparentFill(self):
539          layer = self.current_layer()          layer = self.current_layer()
540          if layer is not None:          if layer is not None:
541              layer.SetFill(None)              layer.GetClassification().SetDefaultFill(Color.None)
542    
543      def LayerOutlineColor(self):      def LayerOutlineColor(self):
544          layer = self.current_layer()          layer = self.current_layer()
545          if layer is not None:          if layer is not None:
546              color = self.choose_color()              color = self.choose_color()
547              if color is not None:              if color is not None:
548                  layer.SetStroke(color)                  layer.GetClassification().SetDefaultLineColor(color)
549    
550      def LayerNoOutline(self):      def LayerNoOutline(self):
551          layer = self.current_layer()          layer = self.current_layer()
552          if layer is not None:          if layer is not None:
553              layer.SetStroke(None)              layer.GetClassification().SetDefaultLineColor(Color.None)
554    
555      def HideLayer(self):      def HideLayer(self):
556          layer = self.current_layer()          layer = self.current_layer()
# Line 477  class MainWindow(wxFrame): Line 569  class MainWindow(wxFrame):
569              name = "table_view" + str(id(table))              name = "table_view" + str(id(table))
570              dialog = self.get_open_dialog(name)              dialog = self.get_open_dialog(name)
571              if dialog is None:              if dialog is None:
572                  dialog = tableview.LayerTableFrame(self, self.interactor, name,                  dialog = tableview.LayerTableFrame(self, name,
573                                                     "Table: %s" % layer.Title(),                                                 _("Table: %s") % layer.Title(),
574                                                     layer, table)                                                     layer, table)
575                  self.add_dialog(name, dialog)                  self.add_dialog(name, dialog)
576                  dialog.Show(true)                  dialog.Show(true)
# Line 503  class MainWindow(wxFrame): Line 595  class MainWindow(wxFrame):
595              map.SetProjection(proj)              map.SetProjection(proj)
596          proj4Dlg.Destroy()          proj4Dlg.Destroy()
597    
598        def Classify(self):
599    
600            #
601            # the menu option for this should only be available if there
602            # is a current layer, so we don't need to check if the
603            # current layer is None
604            #
605    
606            layer = self.current_layer()
607            self.OpenClassifier(layer)
608    
609        def OpenClassifier(self, layer):
610            name = "classifier" + str(id(layer))
611            dialog = self.get_open_dialog(name)
612    
613            if dialog is None:
614                dialog = classifier.Classifier(self, name, layer)
615                self.add_dialog(name, dialog)
616                dialog.Show()
617    
618    
619        def ShowLegend(self, switch = False):
620            
621            name = "legend"
622            dialog = self.get_open_dialog(name)
623    
624            if dialog is None:
625                self.legendPanel = \
626                    legend.LegendPanel(self.sash_legend, None, self)
627                dialog = DockableWindow(self, -1, name,
628                                        "Legend: %s" % self.Map().Title(),
629                                        self.sash_legend, self.legendPanel)
630    
631    
632                self.add_dialog(name, dialog)
633    
634                dialog.Subscribe(DOCKABLE_DOCKED, self._OnLegendDock)
635                dialog.Subscribe(DOCKABLE_UNDOCKED, self._OnLegendUnDock)
636                dialog.Subscribe(DOCKABLE_CLOSED, self._OnLegendClosed)
637    
638                self.legendWindow = dialog
639                self.legendPanel.SetMap(self.Map())
640    
641            dialog.Show()
642    
643      def ZoomInTool(self):      def ZoomInTool(self):
644          self.canvas.ZoomInTool()          self.canvas.ZoomInTool()
645    
# Line 525  class MainWindow(wxFrame): Line 662  class MainWindow(wxFrame):
662      def PrintMap(self):      def PrintMap(self):
663          self.canvas.Print()          self.canvas.Print()
664    
665      def identify_view_on_demand(self, layer, shape):      def identify_view_on_demand(self, layer, shapes):
666          name = "identify_view"          name = "identify_view"
667          if self.canvas.CurrentTool() == "IdentifyTool":          if self.canvas.CurrentTool() == "IdentifyTool":
668              if not self.dialog_open(name):              if not self.dialog_open(name):
669                  dialog = identifyview.IdentifyView(self, self.interactor, name)                  dialog = identifyview.IdentifyView(self, name)
670                  self.add_dialog(name, dialog)                  self.add_dialog(name, dialog)
671                  dialog.Show(true)                  dialog.Show(True)
672              else:              else:
673                  # FIXME: bring dialog to front?                  # FIXME: bring dialog to front?
674                  pass                  pass
675    
676    
677        def _OnSashDrag(self, event):
678    
679            if event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE:
680                return
681    
682            id = event.GetId()
683    
684            rect = event.GetDragRect()
685    
686            if id == ID_WINDOW_LEGEND:
687                #assert(self.legendPanel.IsDocked())
688                assert(self.legendWindow.IsDocked())
689                #assert(self.legendPanel.GetParent() is self.sash_legend)
690                self.__SetLegendDockSize(rect)
691    
692            wxLayoutAlgorithm().LayoutWindow(self, self.canvas)
693    
694        def _OnSize(self, event):
695            wxLayoutAlgorithm().LayoutWindow(self, self.canvas)
696    
697        def _OnLegendDock(self, id, win):
698            if not self.sash_legend.IsShown():
699                self.sash_legend.Show()
700                self.__SetLegendDockSize(None)
701                wxLayoutAlgorithm().LayoutWindow(self, self.canvas)
702    
703        def _OnLegendUnDock(self, id, win):
704            if self.sash_legend.IsShown():
705                self.sash_legend.Hide()
706                wxLayoutAlgorithm().LayoutWindow(self, self.canvas)
707    
708        def _OnLegendClosed(self, id, win):
709            if self.sash_legend.IsShown():
710                self.sash_legend.Hide()
711                wxLayoutAlgorithm().LayoutWindow(self, self.canvas)
712    
713        def __SetLegendDockSize(self, rect):
714        
715            w, h = self.legendWindow.GetBestSize()
716            #w, h = self.legendPanel.GetBestSize()
717    
718            if rect is not None:
719                rw = rect.width
720                rh = rect.height
721                if rw < w: rw = w
722            else:
723                rw = w
724                rh = h
725    
726            rw += 2 # XXX: without this the sash isn't visible!?!?!?!
727    
728            self.sash_legend.SetDefaultSize(wxSize(rw, 1000))
729    
730  #  #
731  # Define all the commands available in the main window  # Define all the commands available in the main window
732  #  #
# Line 594  def _has_visible_map(context): Line 785  def _has_visible_map(context):
785                  return 1                  return 1
786      return 0      return 0
787    
788    def _has_legend_shown(context):
789        """Return true if the legend window is shown"""
790        return context.mainwindow.get_open_dialog("legend") is None
791    
792    
793  # File menu  # File menu
794  _method_command("new_session", "&New Session", "NewSession")  _method_command("new_session", _("&New Session"), "NewSession")
795  _method_command("open_session", "&Open Session", "OpenSession")  _method_command("open_session", _("&Open Session"), "OpenSession")
796  _method_command("save_session", "&Save Session", "SaveSession")  _method_command("save_session", _("&Save Session"), "SaveSession")
797  _method_command("save_session_as", "Save Session &As", "SaveSessionAs")  _method_command("save_session_as", _("Save Session &As"), "SaveSessionAs")
798  _method_command("show_session_tree", "Show Session &Tree", "ShowSessionTree",  _method_command("show_session_tree", _("Show Session &Tree"), "ShowSessionTree",
799                  sensitive = _has_tree_window_shown)                  sensitive = _has_tree_window_shown)
800  _method_command("exit", "E&xit", "Exit")  _method_command("exit", _("E&xit"), "Exit")
801    
802  # Help menu  # Help menu
803  _method_command("help_about", "&About", "About")  _method_command("help_about", _("&About"), "About")
804    
805    
806  # Map menu  # Map menu
807  _method_command("map_projection", "Pro&jection", "Projection")  _method_command("map_projection", _("Pro&jection"), "Projection")
808    
809  _tool_command("map_zoom_in_tool", "&Zoom in", "ZoomInTool", "ZoomInTool",  _tool_command("map_zoom_in_tool", _("&Zoom in"), "ZoomInTool", "ZoomInTool",
810                helptext = "Switch to map-mode 'zoom-in'", icon = "zoom_in",                helptext = _("Switch to map-mode 'zoom-in'"), icon = "zoom_in",
811                sensitive = _has_visible_map)                sensitive = _has_visible_map)
812  _tool_command("map_zoom_out_tool", "Zoom &out", "ZoomOutTool", "ZoomOutTool",  _tool_command("map_zoom_out_tool", _("Zoom &out"), "ZoomOutTool", "ZoomOutTool",
813                helptext = "Switch to map-mode 'zoom-out'", icon = "zoom_out",                helptext = _("Switch to map-mode 'zoom-out'"), icon = "zoom_out",
814                sensitive = _has_visible_map)                sensitive = _has_visible_map)
815  _tool_command("map_pan_tool", "&Pan", "PanTool", "PanTool",  _tool_command("map_pan_tool", _("&Pan"), "PanTool", "PanTool",
816                helptext = "Switch to map-mode 'pan'", icon = "pan",                helptext = _("Switch to map-mode 'pan'"), icon = "pan",
817                sensitive = _has_visible_map)                sensitive = _has_visible_map)
818  _tool_command("map_identify_tool", "&Identify", "IdentifyTool", "IdentifyTool",  _tool_command("map_identify_tool", _("&Identify"), "IdentifyTool",
819                helptext = "Switch to map-mode 'identify'", icon = "identify",                "IdentifyTool",
820                  helptext = _("Switch to map-mode 'identify'"), icon = "identify",
821                sensitive = _has_visible_map)                sensitive = _has_visible_map)
822  _tool_command("map_label_tool", "&Label", "LabelTool", "LabelTool",  _tool_command("map_label_tool", _("&Label"), "LabelTool", "LabelTool",
823                helptext = "Add/Remove labels", icon = "label",                helptext = _("Add/Remove labels"), icon = "label",
824                sensitive = _has_visible_map)                sensitive = _has_visible_map)
825  _method_command("map_full_extent", "&Full extent", "FullExtent",  _method_command("map_full_extent", _("&Full extent"), "FullExtent",
826                 helptext = "Full Extent", icon = "fullextent",                 helptext = _("Full Extent"), icon = "fullextent",
827                sensitive = _has_visible_map)                sensitive = _has_visible_map)
828  _method_command("map_print", "Prin&t", "PrintMap", helptext = "Print the map")  _method_command("map_print", _("Prin&t"), "PrintMap",
829                    helptext = _("Print the map"))
830    
831  # Layer menu  # Layer menu
832  _method_command("layer_add", "&Add Layer", "AddLayer",  _method_command("layer_add", _("&Add Layer"), "AddLayer",
833                  helptext = "Add a new layer to active map")                  helptext = _("Add a new layer to active map"))
834  _method_command("layer_remove", "&Remove Layer", "RemoveLayer",  _method_command("layer_remove", _("&Remove Layer"), "RemoveLayer",
835                  helptext = "Remove selected layer(s)",                  helptext = _("Remove selected layer(s)"),
836                  sensitive = _can_remove_layer)                  sensitive = _can_remove_layer)
837  _method_command("layer_fill_color", "&Fill Color", "LayerFillColor",  _method_command("layer_fill_color", _("&Fill Color"), "LayerFillColor",
838                  helptext = "Set the fill color of selected layer(s)",                  helptext = _("Set the fill color of selected layer(s)"),
839                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
840  _method_command("layer_transparent_fill", "&Transparent Fill",  _method_command("layer_transparent_fill", _("&Transparent Fill"),
841                  "LayerTransparentFill",                  "LayerTransparentFill",
842                  helptext = "Do not fill the selected layer(s)",                  helptext = _("Do not fill the selected layer(s)"),
843                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
844  _method_command("layer_outline_color", "&Outline Color", "LayerOutlineColor",  _method_command("layer_outline_color", _("&Outline Color"), "LayerOutlineColor",
845                  helptext = "Set the outline color of selected layer(s)",                  helptext = _("Set the outline color of selected layer(s)"),
846                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
847  _method_command("layer_no_outline", "&No Outline", "LayerNoOutline",  _method_command("layer_no_outline", _("&No Outline"), "LayerNoOutline",
848                  helptext = "Do not draw the outline of the selected layer(s)",                  helptext= _("Do not draw the outline of the selected layer(s)"),
849                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
850  _method_command("layer_raise", "&Raise", "RaiseLayer",  _method_command("layer_raise", _("&Raise"), "RaiseLayer",
851                  helptext = "Raise selected layer(s)",                  helptext = _("Raise selected layer(s)"),
852                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
853  _method_command("layer_lower", "&Lower", "LowerLayer",  _method_command("layer_lower", _("&Lower"), "LowerLayer",
854                  helptext = "Lower selected layer(s)",                  helptext = _("Lower selected layer(s)"),
855                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
856  _method_command("layer_show", "&Show", "ShowLayer",  _method_command("layer_show", _("&Show"), "ShowLayer",
857                  helptext = "Make selected layer(s) visible",                  helptext = _("Make selected layer(s) visible"),
858                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
859  _method_command("layer_hide", "&Hide", "HideLayer",  _method_command("layer_hide", _("&Hide"), "HideLayer",
860                  helptext = "Make selected layer(s) unvisible",                  helptext = _("Make selected layer(s) unvisible"),
861                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
862  _method_command("layer_show_table", "Show Ta&ble", "LayerShowTable",  _method_command("layer_show_table", _("Show Ta&ble"), "LayerShowTable",
863                  helptext = "Show the selected layer's table",                  helptext = _("Show the selected layer's table"),
864                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
865    _method_command("layer_classifier", _("Classify"), "Classify",
866                    sensitive = _has_selected_layer)
867    _method_command("show_legend", _("Legend"), "ShowLegend",
868                    sensitive = _has_legend_shown)
869    
870  # the menu structure  # the menu structure
871  main_menu = Menu("<main>", "<main>",  main_menu = Menu("<main>", "<main>",
872                   [Menu("file", "&File",                   [Menu("file", _("&File"),
873                         ["new_session", "open_session", None,                         ["new_session", "open_session", None,
874                          "save_session", "save_session_as", None,                          "save_session", "save_session_as", None,
875                          "show_session_tree", None,                          "show_session_tree", None,
876                            "show_legend", None,
877                          "exit"]),                          "exit"]),
878                    Menu("map", "&Map",                    Menu("map", _("&Map"),
879                         ["layer_add", "layer_remove",                         ["layer_add", "layer_remove",
880                          None,                          None,
881                          "map_projection",                          "map_projection",
# Line 685  main_menu = Menu("<main>", "<main>", Line 886  main_menu = Menu("<main>", "<main>",
886                          "map_full_extent",                          "map_full_extent",
887                          None,                          None,
888                          "map_print"]),                          "map_print"]),
889                    Menu("layer", "&Layer",                    Menu("layer", _("&Layer"),
890                         ["layer_fill_color", "layer_transparent_fill",                         ["layer_fill_color", "layer_transparent_fill",
891                          "layer_outline_color", "layer_no_outline",                          "layer_outline_color", "layer_no_outline",
892                          None,                          None,
# Line 693  main_menu = Menu("<main>", "<main>", Line 894  main_menu = Menu("<main>", "<main>",
894                          None,                          None,
895                          "layer_show", "layer_hide",                          "layer_show", "layer_hide",
896                          None,                          None,
897                          "layer_show_table"]),                          "layer_show_table",
898                    Menu("help", "&Help",                          None,
899                            "layer_classifier"]),
900                      Menu("help", _("&Help"),
901                         ["help_about"])])                         ["help_about"])])
902    
903  # the main toolbar  # the main toolbar

Legend:
Removed from v.357  
changed lines
  Added in v.563

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26