/[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 351 by frank, Wed Nov 6 14:46:33 2002 UTC revision 573 by jonathan, Fri Mar 28 17:07:06 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  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, DockFrame, DockPanel
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(DockFrame):
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)          DockFrame.__init__(self, parent, ID, title, wxDefaultPosition, size)
71            #wxFrame.__init__(self, parent, ID, title, wxDefaultPosition, size)
72    
73          self.application = application          self.application = application
         self.interactor = interactor  
74    
75          self.CreateStatusBar()          self.CreateStatusBar()
76          if initial_message:          if initial_message:
# Line 63  class MainWindow(wxFrame): Line 88  class MainWindow(wxFrame):
88          # call Realize to make sure that the tools appear.          # call Realize to make sure that the tools appear.
89          toolbar.Realize()          toolbar.Realize()
90    
91    
92          # Create the map canvas          # Create the map canvas
93          canvas = view.MapCanvas(self, -1, interactor)          canvas = view.MapCanvas(self, -1)
94          canvas.Subscribe(VIEW_POSITION, self.view_position_changed)          canvas.Subscribe(VIEW_POSITION, self.view_position_changed)
95            canvas.Subscribe(SHAPES_SELECTED, self.identify_view_on_demand)
96          self.canvas = canvas          self.canvas = canvas
97    
98          self.init_dialogs()          self.SetMainWindow(self.canvas)
99    
100          interactor.Subscribe(SELECTED_SHAPE, self.identify_view_on_demand)          self.SetAutoLayout(True)
101    
102            self.init_dialogs()
103    
104          EVT_CLOSE(self, self.OnClose)          EVT_CLOSE(self, self.OnClose)
105    
106        def Subscribe(self, channel, *args):
107            """Subscribe a function to a message channel.
108    
109            If channel is one of the delegated messages call the appropriate
110            object's Subscribe method. Otherwise do nothing.
111            """
112            if channel in self.delegated_messages:
113                object = getattr(self, self.delegated_messages[channel])
114                object.Subscribe(channel, *args)
115            else:
116                print "Trying to subscribe to unsupported channel %s" % channel
117    
118        def Unsubscribe(self, channel, *args):
119            """Unsubscribe a function from a message channel.
120    
121            If channel is one of the delegated messages call the appropriate
122            object's Unsubscribe method. Otherwise do nothing.
123            """
124            if channel in self.delegated_messages:
125                object = getattr(self, self.delegated_messages[channel])
126                object.Unsubscribe(channel, *args)
127    
128        def __getattr__(self, attr):
129            """If attr is one of the delegated methods return that method
130    
131            Otherwise raise AttributeError.
132            """
133            if attr in self.delegated_methods:
134                return getattr(getattr(self, self.delegated_methods[attr]), attr)
135            raise AttributeError(attr)
136    
137      def init_ids(self):      def init_ids(self):
138          """Initialize the ids"""          """Initialize the ids"""
139          self.current_id = 6000          self.current_id = 6000
# Line 168  class MainWindow(wxFrame): Line 228  class MainWindow(wxFrame):
228                              command.IsCheckCommand())                              command.IsCheckCommand())
229                  self.bind_command_events(command, ID)                  self.bind_command_events(command, ID)
230              else:              else:
231                  print "Unknown command %s" % name                  print _("Unknown command %s") % name
232    
233      def add_toolbar_command(self, toolbar, name):      def add_toolbar_command(self, toolbar, name):
234          """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 250  class MainWindow(wxFrame):
250                                  isToggle = command.IsCheckCommand())                                  isToggle = command.IsCheckCommand())
251                  self.bind_command_events(command, ID)                  self.bind_command_events(command, ID)
252              else:              else:
253                  print "Unknown command %s" % name                  print _("Unknown command %s") % name
254    
255      def Context(self):      def Context(self):
256          """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 263  class MainWindow(wxFrame):
263              command = registry.Command(name)              command = registry.Command(name)
264              command.Execute(self.Context())              command.Execute(self.Context())
265          else:          else:
266              print "Unknown command ID %d" % event.GetId()              print _("Unknown command ID %d") % event.GetId()
267    
268      def update_command_ui(self, event):      def update_command_ui(self, event):
269          #print "update_command_ui", self.id_to_name[event.GetId()]          #print "update_command_ui", self.id_to_name[event.GetId()]
270          context = self.Context()          context = self.Context()
271          command = registry.Command(self.id_to_name[event.GetId()])          command = registry.Command(self.id_to_name[event.GetId()])
272          if command is not None:          if command is not None:
273              event.Enable(command.Sensitive(context))              sensitive = command.Sensitive(context)
274                event.Enable(sensitive)
275                if command.IsTool() and not sensitive and command.Checked(context):
276                    # When a checked tool command is disabled deselect all
277                    # tools. Otherwise the tool would remain active but it
278                    # might lead to errors if the tools stays active. This
279                    # problem occurred in GREAT-ER and this fixes it, but
280                    # it's not clear to me whether this is really the best
281                    # way to do it (BH, 20021206).
282                    self.canvas.SelectTool(None)
283              event.SetText(command.DynText(context))              event.SetText(command.DynText(context))
284              if command.IsCheckCommand():              if command.IsCheckCommand():
285                  event.Check(command.Checked(context))                      event.Check(command.Checked(context))
286    
287      def RunMessageBox(self, title, text, flags = wxOK | wxICON_INFORMATION):      def RunMessageBox(self, title, text, flags = wxOK | wxICON_INFORMATION):
288          """Run a modal message box with the given text, title and flags          """Run a modal message box with the given text, title and flags
# Line 233  class MainWindow(wxFrame): Line 302  class MainWindow(wxFrame):
302    
303      def add_dialog(self, name, dialog):      def add_dialog(self, name, dialog):
304          if self.dialogs.has_key(name):          if self.dialogs.has_key(name):
305              raise RuntimeError("The Dialog named %s is already open" % name)              raise RuntimeError(_("The Dialog named %s is already open") % name)
306          self.dialogs[name] = dialog          self.dialogs[name] = dialog
307    
308      def dialog_open(self, name):      def dialog_open(self, name):
# Line 275  class MainWindow(wxFrame): Line 344  class MainWindow(wxFrame):
344              flags = wxYES_NO | wxICON_QUESTION              flags = wxYES_NO | wxICON_QUESTION
345              if can_veto:              if can_veto:
346                  flags = flags | wxCANCEL                  flags = flags | wxCANCEL
347              result = self.RunMessageBox("Exit",              result = self.RunMessageBox(_("Exit"),
348                                          ("The session has been modified."                                          _("The session has been modified."
349                                           " Do you want to save it?"),                                           " Do you want to save it?"),
350                                          flags)                                          flags)
351              if result == wxID_YES:              if result == wxID_YES:
# Line 285  class MainWindow(wxFrame): Line 354  class MainWindow(wxFrame):
354              result = wxID_NO              result = wxID_NO
355          return result          return result
356    
357        def prepare_new_session(self):
358            for d in self.dialogs.values():
359                if not isinstance(d, tree.SessionTreeView):
360                    d.Close()
361    
362      def NewSession(self):      def NewSession(self):
363          self.save_modified_session()          self.save_modified_session()
364            self.prepare_new_session()
365          self.application.SetSession(create_empty_session())          self.application.SetSession(create_empty_session())
366    
367      def OpenSession(self):      def OpenSession(self):
368          self.save_modified_session()          self.save_modified_session()
369          dlg = wxFileDialog(self, "Select a session file", ".", "",          dlg = wxFileDialog(self, _("Open Session"), ".", "", "*.thuban", wxOPEN)
                            "*.thuban", wxOPEN)  
370          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
371                self.prepare_new_session()
372              self.application.OpenSession(dlg.GetPath())              self.application.OpenSession(dlg.GetPath())
373          dlg.Destroy()          dlg.Destroy()
374    
375      def SaveSession(self):      def SaveSession(self):
376          if self.application.session.filename == None:          if self.application.session.filename == None:
377              self.SaveSessionAs()              self.SaveSessionAs()
378          self.application.SaveSession()          else:
379                self.application.SaveSession()
380    
381      def SaveSessionAs(self):      def SaveSessionAs(self):
382          dlg = wxFileDialog(self, "Enter a filename for session", ".", "",          dlg = wxFileDialog(self, _("Save Session As"), ".", "",
383                             "*.thuban", wxOPEN)                             "*.thuban", wxOPEN)
384          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
385              self.application.session.SetFilename(dlg.GetPath())              self.application.session.SetFilename(dlg.GetPath())
# Line 326  class MainWindow(wxFrame): Line 402  class MainWindow(wxFrame):
402    
403      def SetMap(self, map):      def SetMap(self, map):
404          self.canvas.SetMap(map)          self.canvas.SetMap(map)
405            #self.legendPanel.SetMap(map)
406    
407      def Map(self):      def Map(self):
408          """Return the map displayed by this mainwindow"""          """Return the map displayed by this mainwindow"""
409    
410            # sanity check
411            #assert(self.canvas.Map() is self.legendPanel.GetMap())
412    
413          return self.canvas.Map()          return self.canvas.Map()
414    
415      def ShowSessionTree(self):      def ShowSessionTree(self):
# Line 337  class MainWindow(wxFrame): Line 418  class MainWindow(wxFrame):
418          if dialog is None:          if dialog is None:
419              dialog = tree.SessionTreeView(self, self.application, name)              dialog = tree.SessionTreeView(self, self.application, name)
420              self.add_dialog(name, dialog)              self.add_dialog(name, dialog)
421              dialog.Show(true)              dialog.Show(True)
422          else:          else:
423              # FIXME: bring dialog to front here              # FIXME: bring dialog to front here
424              pass              pass
425    
426    
427      def About(self):      def About(self):
428          self.RunMessageBox("About",          self.RunMessageBox(_("About"),
429                             ("Thuban is a program for\n"                             _("Thuban v%s\n"
430                                #"Build Date: %s\n"
431                                "\n"
432                                "Thuban is a program for\n"
433                              "exploring geographic data.\n"                              "exploring geographic data.\n"
434                              "Copyright (C) 2001, 2002 Intevation GmbH.\n"                              "Copyright (C) 2001-2003 Intevation GmbH.\n"
435                              "Thuban is licensed under the GPL"),                              "Thuban is licensed under the GNU GPL"
436                               % __ThubanVersion__), #__BuildDate__)),
437                             wxOK | wxICON_INFORMATION)                             wxOK | wxICON_INFORMATION)
438    
439      def AddLayer(self):      def AddLayer(self):
440          dlg = wxFileDialog(self, "Select a data file", ".", "", "*.*",          dlg = wxFileDialog(self, _("Select a data file"), ".", "", "*.*",
441                             wxOPEN)                             wxOPEN)
442          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
443              filename = dlg.GetPath()              filename = dlg.GetPath()
# Line 363  class MainWindow(wxFrame): Line 449  class MainWindow(wxFrame):
449                  map.AddLayer(layer)                  map.AddLayer(layer)
450              except IOError:              except IOError:
451                  # the layer couldn't be opened                  # the layer couldn't be opened
452                  self.RunMessageBox("Add Layer",                  self.RunMessageBox(_("Add Layer"),
453                                     "Can't open the file '%s'." % filename)                                     _("Can't open the file '%s'.") % filename)
454              else:              else:
455                  if not has_layers:                  if not has_layers:
456                      # if we're adding a layer to an empty map, for the                      # if we're adding a layer to an empty map, fit the
457                      # new map to the window                      # new map to the window
458                      self.canvas.FitMapToWindow()                      self.canvas.FitMapToWindow()
459          dlg.Destroy()          dlg.Destroy()
# Line 405  class MainWindow(wxFrame): Line 491  class MainWindow(wxFrame):
491    
492          If no layer is selected, return None          If no layer is selected, return None
493          """          """
494          return self.interactor.SelectedLayer()          return self.canvas.SelectedLayer()
495    
496      def has_selected_layer(self):      def has_selected_layer(self):
497          """Return true if a layer is currently selected"""          """Return true if a layer is currently selected"""
498          return self.interactor.HasSelectedLayer()          return self.canvas.HasSelectedLayer()
499    
500      def choose_color(self):      def choose_color(self):
501          """Run the color selection dialog and return the selected color.          """Run the color selection dialog and return the selected color.
# Line 432  class MainWindow(wxFrame): Line 518  class MainWindow(wxFrame):
518          if layer is not None:          if layer is not None:
519              color = self.choose_color()              color = self.choose_color()
520              if color is not None:              if color is not None:
521                  layer.SetFill(color)                  layer.GetClassification().SetDefaultFill(color)
522    
523      def LayerTransparentFill(self):      def LayerTransparentFill(self):
524          layer = self.current_layer()          layer = self.current_layer()
525          if layer is not None:          if layer is not None:
526              layer.SetFill(None)              layer.GetClassification().SetDefaultFill(Color.None)
527    
528      def LayerOutlineColor(self):      def LayerOutlineColor(self):
529          layer = self.current_layer()          layer = self.current_layer()
530          if layer is not None:          if layer is not None:
531              color = self.choose_color()              color = self.choose_color()
532              if color is not None:              if color is not None:
533                  layer.SetStroke(color)                  layer.GetClassification().SetDefaultLineColor(color)
534    
535      def LayerNoOutline(self):      def LayerNoOutline(self):
536          layer = self.current_layer()          layer = self.current_layer()
537          if layer is not None:          if layer is not None:
538              layer.SetStroke(None)              layer.GetClassification().SetDefaultLineColor(Color.None)
539    
540      def HideLayer(self):      def HideLayer(self):
541          layer = self.current_layer()          layer = self.current_layer()
# Line 468  class MainWindow(wxFrame): Line 554  class MainWindow(wxFrame):
554              name = "table_view" + str(id(table))              name = "table_view" + str(id(table))
555              dialog = self.get_open_dialog(name)              dialog = self.get_open_dialog(name)
556              if dialog is None:              if dialog is None:
557                  dialog = tableview.LayerTableFrame(self, self.interactor, name,                  dialog = tableview.LayerTableFrame(self, name,
558                                                     "Table: %s" % layer.Title(),                                                 _("Table: %s") % layer.Title(),
559                                                     layer, table)                                                     layer, table)
560                  self.add_dialog(name, dialog)                  self.add_dialog(name, dialog)
561                  dialog.Show(true)                  dialog.Show(true)
# Line 494  class MainWindow(wxFrame): Line 580  class MainWindow(wxFrame):
580              map.SetProjection(proj)              map.SetProjection(proj)
581          proj4Dlg.Destroy()          proj4Dlg.Destroy()
582    
583        def Classify(self):
584    
585            #
586            # the menu option for this should only be available if there
587            # is a current layer, so we don't need to check if the
588            # current layer is None
589            #
590    
591            layer = self.current_layer()
592            self.OpenClassifier(layer)
593    
594        def OpenClassifier(self, layer, group = None):
595            name = "classifier" + str(id(layer))
596            dialog = self.get_open_dialog(name)
597    
598            if dialog is None:
599                dialog = classifier.Classifier(self, name, layer, group)
600                self.add_dialog(name, dialog)
601                dialog.Show()
602            dialog.Raise()
603    
604    
605        def ShowLegend(self, switch = False):
606            name = "legend"
607            dialog = self.FindRegisteredDock(name)
608    
609            if dialog is None:
610                title = "Legend: %s" % self.Map().Title()
611                dialog = self.CreateDock(name, -1, title, wxLAYOUT_LEFT)
612                legend.LegendPanel(dialog, None, self)
613    
614            dialog.GetPanel().SetMap(self.Map())
615            dialog.Show()
616    
617      def ZoomInTool(self):      def ZoomInTool(self):
618          self.canvas.ZoomInTool()          self.canvas.ZoomInTool()
619    
# Line 516  class MainWindow(wxFrame): Line 636  class MainWindow(wxFrame):
636      def PrintMap(self):      def PrintMap(self):
637          self.canvas.Print()          self.canvas.Print()
638    
639      def identify_view_on_demand(self, layer, shape):      def identify_view_on_demand(self, layer, shapes):
640          name = "identify_view"          name = "identify_view"
641          if self.canvas.CurrentTool() == "IdentifyTool":          if self.canvas.CurrentTool() == "IdentifyTool":
642              if not self.dialog_open(name):              if not self.dialog_open(name):
643                  dialog = identifyview.IdentifyView(self, self.interactor, name)                  dialog = identifyview.IdentifyView(self, name)
644                  self.add_dialog(name, dialog)                  self.add_dialog(name, dialog)
645                  dialog.Show(true)                  dialog.Show(True)
646              else:              else:
647                  # FIXME: bring dialog to front?                  # FIXME: bring dialog to front?
648                  pass                  pass
# Line 558  def make_check_current_tool(toolname): Line 678  def make_check_current_tool(toolname):
678  def _tool_command(name, title, method, toolname, helptext = "",  def _tool_command(name, title, method, toolname, helptext = "",
679                    icon = "", sensitive = None):                    icon = "", sensitive = None):
680      """Add a tool command"""      """Add a tool command"""
681      registry.Add(Command(name, title, call_method, args=(method,),      registry.Add(ToolCommand(name, title, call_method, args=(method,),
682                           helptext = helptext, icon = icon,                               helptext = helptext, icon = icon,
683                           checked = make_check_current_tool(toolname),                               checked = make_check_current_tool(toolname),
684                           sensitive = sensitive))                               sensitive = sensitive))
685    
686  def _has_selected_layer(context):  def _has_selected_layer(context):
687      """Return true if a layer is selected in the context"""      """Return true if a layer is selected in the context"""
# Line 585  def _has_visible_map(context): Line 705  def _has_visible_map(context):
705                  return 1                  return 1
706      return 0      return 0
707    
708    def _has_legend_shown(context):
709        """Return true if the legend window is shown"""
710        return context.mainwindow.FindRegisteredDock("legend") is None
711    
712    
713  # File menu  # File menu
714  _method_command("new_session", "&New Session", "NewSession")  _method_command("new_session", _("&New Session"), "NewSession")
715  _method_command("open_session", "&Open Session", "OpenSession")  _method_command("open_session", _("&Open Session"), "OpenSession")
716  _method_command("save_session", "&Save Session", "SaveSession")  _method_command("save_session", _("&Save Session"), "SaveSession")
717  _method_command("save_session_as", "Save Session &As", "SaveSessionAs")  _method_command("save_session_as", _("Save Session &As"), "SaveSessionAs")
718  _method_command("show_session_tree", "Show Session &Tree", "ShowSessionTree",  _method_command("show_session_tree", _("Show Session &Tree"), "ShowSessionTree",
719                  sensitive = _has_tree_window_shown)                  sensitive = _has_tree_window_shown)
720  _method_command("exit", "E&xit", "Exit")  _method_command("exit", _("E&xit"), "Exit")
721    
722  # Help menu  # Help menu
723  _method_command("help_about", "&About", "About")  _method_command("help_about", _("&About"), "About")
724    
725    
726  # Map menu  # Map menu
727  _method_command("map_projection", "Pro&jection", "Projection")  _method_command("map_projection", _("Pro&jection"), "Projection")
728    
729  _tool_command("map_zoom_in_tool", "&Zoom in", "ZoomInTool", "ZoomInTool",  _tool_command("map_zoom_in_tool", _("&Zoom in"), "ZoomInTool", "ZoomInTool",
730                helptext = "Switch to map-mode 'zoom-in'", icon = "zoom_in",                helptext = _("Switch to map-mode 'zoom-in'"), icon = "zoom_in",
731                sensitive = _has_visible_map)                sensitive = _has_visible_map)
732  _tool_command("map_zoom_out_tool", "Zoom &out", "ZoomOutTool", "ZoomOutTool",  _tool_command("map_zoom_out_tool", _("Zoom &out"), "ZoomOutTool", "ZoomOutTool",
733                helptext = "Switch to map-mode 'zoom-out'", icon = "zoom_out",                helptext = _("Switch to map-mode 'zoom-out'"), icon = "zoom_out",
734                sensitive = _has_visible_map)                sensitive = _has_visible_map)
735  _tool_command("map_pan_tool", "&Pan", "PanTool", "PanTool",  _tool_command("map_pan_tool", _("&Pan"), "PanTool", "PanTool",
736                helptext = "Switch to map-mode 'pan'", icon = "pan",                helptext = _("Switch to map-mode 'pan'"), icon = "pan",
737                sensitive = _has_visible_map)                sensitive = _has_visible_map)
738  _tool_command("map_identify_tool", "&Identify", "IdentifyTool", "IdentifyTool",  _tool_command("map_identify_tool", _("&Identify"), "IdentifyTool",
739                helptext = "Switch to map-mode 'identify'", icon = "identify",                "IdentifyTool",
740                  helptext = _("Switch to map-mode 'identify'"), icon = "identify",
741                sensitive = _has_visible_map)                sensitive = _has_visible_map)
742  _tool_command("map_label_tool", "&Label", "LabelTool", "LabelTool",  _tool_command("map_label_tool", _("&Label"), "LabelTool", "LabelTool",
743                helptext = "Add/Remove labels", icon = "label",                helptext = _("Add/Remove labels"), icon = "label",
744                sensitive = _has_visible_map)                sensitive = _has_visible_map)
745  _method_command("map_full_extent", "&Full extent", "FullExtent",  _method_command("map_full_extent", _("&Full extent"), "FullExtent",
746                 helptext = "Full Extent", icon = "fullextent",                 helptext = _("Full Extent"), icon = "fullextent",
747                sensitive = _has_visible_map)                sensitive = _has_visible_map)
748  _method_command("map_print", "Prin&t", "PrintMap", helptext = "Print the map")  _method_command("map_print", _("Prin&t"), "PrintMap",
749                    helptext = _("Print the map"))
750    
751  # Layer menu  # Layer menu
752  _method_command("layer_add", "&Add Layer", "AddLayer",  _method_command("layer_add", _("&Add Layer"), "AddLayer",
753                  helptext = "Add a new layer to active map")                  helptext = _("Add a new layer to active map"))
754  _method_command("layer_remove", "&Remove Layer", "RemoveLayer",  _method_command("layer_remove", _("&Remove Layer"), "RemoveLayer",
755                  helptext = "Remove selected layer(s)",                  helptext = _("Remove selected layer(s)"),
756                  sensitive = _can_remove_layer)                  sensitive = _can_remove_layer)
757  _method_command("layer_fill_color", "&Fill Color", "LayerFillColor",  _method_command("layer_fill_color", _("&Fill Color"), "LayerFillColor",
758                  helptext = "Set the fill color of selected layer(s)",                  helptext = _("Set the fill color of selected layer(s)"),
759                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
760  _method_command("layer_transparent_fill", "&Transparent Fill",  _method_command("layer_transparent_fill", _("&Transparent Fill"),
761                  "LayerTransparentFill",                  "LayerTransparentFill",
762                  helptext = "Do not fill the selected layer(s)",                  helptext = _("Do not fill the selected layer(s)"),
763                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
764  _method_command("layer_outline_color", "&Outline Color", "LayerOutlineColor",  _method_command("layer_outline_color", _("&Outline Color"), "LayerOutlineColor",
765                  helptext = "Set the outline color of selected layer(s)",                  helptext = _("Set the outline color of selected layer(s)"),
766                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
767  _method_command("layer_no_outline", "&No Outline", "LayerNoOutline",  _method_command("layer_no_outline", _("&No Outline"), "LayerNoOutline",
768                  helptext = "Do not draw the outline of the selected layer(s)",                  helptext= _("Do not draw the outline of the selected layer(s)"),
769                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
770  _method_command("layer_raise", "&Raise", "RaiseLayer",  _method_command("layer_raise", _("&Raise"), "RaiseLayer",
771                  helptext = "Raise selected layer(s)",                  helptext = _("Raise selected layer(s)"),
772                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
773  _method_command("layer_lower", "&Lower", "LowerLayer",  _method_command("layer_lower", _("&Lower"), "LowerLayer",
774                  helptext = "Lower selected layer(s)",                  helptext = _("Lower selected layer(s)"),
775                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
776  _method_command("layer_show", "&Show", "ShowLayer",  _method_command("layer_show", _("&Show"), "ShowLayer",
777                  helptext = "Make selected layer(s) visible",                  helptext = _("Make selected layer(s) visible"),
778                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
779  _method_command("layer_hide", "&Hide", "HideLayer",  _method_command("layer_hide", _("&Hide"), "HideLayer",
780                  helptext = "Make selected layer(s) unvisible",                  helptext = _("Make selected layer(s) unvisible"),
781                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
782  _method_command("layer_show_table", "Show Ta&ble", "LayerShowTable",  _method_command("layer_show_table", _("Show Ta&ble"), "LayerShowTable",
783                  helptext = "Show the selected layer's table",                  helptext = _("Show the selected layer's table"),
784                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
785    _method_command("layer_classifier", _("Classify"), "Classify",
786                    sensitive = _has_selected_layer)
787    _method_command("show_legend", _("Show Legend"), "ShowLegend",
788                    sensitive = _has_legend_shown)
789    
790  # the menu structure  # the menu structure
791  main_menu = Menu("<main>", "<main>",  main_menu = Menu("<main>", "<main>",
792                   [Menu("file", "&File",                   [Menu("file", _("&File"),
793                         ["new_session", "open_session", None,                         ["new_session", "open_session", None,
794                          "save_session", "save_session_as", None,                          "save_session", "save_session_as", None,
795                          "show_session_tree", None,                          "show_session_tree", None,
796                            "show_legend", None,
797                          "exit"]),                          "exit"]),
798                    Menu("map", "&Map",                    Menu("map", _("&Map"),
799                         ["layer_add", "layer_remove",                         ["layer_add", "layer_remove",
800                          None,                          None,
801                          "map_projection",                          "map_projection",
# Line 676  main_menu = Menu("<main>", "<main>", Line 806  main_menu = Menu("<main>", "<main>",
806                          "map_full_extent",                          "map_full_extent",
807                          None,                          None,
808                          "map_print"]),                          "map_print"]),
809                    Menu("layer", "&Layer",                    Menu("layer", _("&Layer"),
810                         ["layer_fill_color", "layer_transparent_fill",                         ["layer_fill_color", "layer_transparent_fill",
811                          "layer_outline_color", "layer_no_outline",                          "layer_outline_color", "layer_no_outline",
812                          None,                          None,
# Line 684  main_menu = Menu("<main>", "<main>", Line 814  main_menu = Menu("<main>", "<main>",
814                          None,                          None,
815                          "layer_show", "layer_hide",                          "layer_show", "layer_hide",
816                          None,                          None,
817                          "layer_show_table"]),                          "layer_show_table",
818                    Menu("help", "&Help",                          None,
819                            "layer_classifier"]),
820                      Menu("help", _("&Help"),
821                         ["help_about"])])                         ["help_about"])])
822    
823  # the main toolbar  # the main toolbar

Legend:
Removed from v.351  
changed lines
  Added in v.573

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26