/[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 227 by bh, Thu Jul 18 16:27:11 2002 UTC revision 550 by jonathan, Thu Mar 20 09:45:19 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
40    
41    
42  # the directory where the toolbar icons are stored  # the directory where the toolbar icons are stored
# Line 40  bitmapext = ".xpm" Line 46  bitmapext = ".xpm"
46    
47  class MainWindow(wxFrame):  class MainWindow(wxFrame):
48    
49      def __init__(self, parent, ID, application, interactor):      # Some messages that can be subscribed/unsubscribed directly through
50          wxFrame.__init__(self, parent, ID, 'Thuban',      # the MapCanvas come in fact from other objects. This is a map to
51                           wxDefaultPosition, wxSize(400, 300))      # map those messages to the names of the instance variables they
52        # actually come from. This delegation is implemented in the
53        # Subscribe and unsubscribed methods
54        delegated_messages = {LAYER_SELECTED: "canvas",
55                              SHAPES_SELECTED: "canvas"}
56    
57        # Methods delegated to some instance variables. The delegation is
58        # implemented in the __getattr__ method.
59        delegated_methods = {"SelectLayer": "canvas",
60                             "SelectShapes": "canvas",
61                             }
62    
63        def __init__(self, parent, ID, title, application, interactor,
64                     initial_message = None, size = wxSize(-1, -1)):
65            wxFrame.__init__(self, parent, ID, title, wxDefaultPosition, size)
66    
67          self.application = application          self.application = application
         self.interactor = interactor  
68    
69          self.CreateStatusBar()          self.CreateStatusBar()
70          self.SetStatusText("This is the wxPython-based "          if initial_message:
71                        "Graphical User Interface for exploring geographic data")              self.SetStatusText(initial_message)
72    
73          self.identify_view = None          self.identify_view = None
74    
# Line 64  class MainWindow(wxFrame): Line 83  class MainWindow(wxFrame):
83          toolbar.Realize()          toolbar.Realize()
84    
85          # Create the map canvas          # Create the map canvas
86          canvas = view.MapCanvas(self, -1, interactor)          canvas = view.MapCanvas(self, -1)
87          canvas.Subscribe(VIEW_POSITION, self.view_position_changed)          canvas.Subscribe(VIEW_POSITION, self.view_position_changed)
88            canvas.Subscribe(SHAPES_SELECTED, self.identify_view_on_demand)
89          self.canvas = canvas          self.canvas = canvas
90    
91          self.init_dialogs()          self.init_dialogs()
92    
         interactor.Subscribe(SELECTED_SHAPE, self.identify_view_on_demand)  
   
93          EVT_CLOSE(self, self.OnClose)          EVT_CLOSE(self, self.OnClose)
94    
95        def Subscribe(self, channel, *args):
96            """Subscribe a function to a message channel.
97    
98            If channel is one of the delegated messages call the appropriate
99            object's Subscribe method. Otherwise do nothing.
100            """
101            if channel in self.delegated_messages:
102                object = getattr(self, self.delegated_messages[channel])
103                object.Subscribe(channel, *args)
104            else:
105                print "Trying to subscribe to unsupported channel %s" % channel
106    
107        def Unsubscribe(self, channel, *args):
108            """Unsubscribe a function from a message channel.
109    
110            If channel is one of the delegated messages call the appropriate
111            object's Unsubscribe method. Otherwise do nothing.
112            """
113            if channel in self.delegated_messages:
114                object = getattr(self, self.delegated_messages[channel])
115                object.Unsubscribe(channel, *args)
116    
117        def __getattr__(self, attr):
118            """If attr is one of the delegated methods return that method
119    
120            Otherwise raise AttributeError.
121            """
122            if attr in self.delegated_methods:
123                return getattr(getattr(self, self.delegated_methods[attr]), attr)
124            raise AttributeError(attr)
125    
126      def init_ids(self):      def init_ids(self):
127          """Initialize the ids"""          """Initialize the ids"""
128          self.current_id = 6000          self.current_id = 6000
# Line 112  class MainWindow(wxFrame): Line 161  class MainWindow(wxFrame):
161          return menu_bar          return menu_bar
162    
163      def build_menu(self, menudesc):      def build_menu(self, menudesc):
164          """Build and return a wxMenu from a menudescription"""          """Return a wxMenu built from the menu description menudesc"""
165          wxmenu = wxMenu()          wxmenu = wxMenu()
166          last = None          last = None
167          for item in menudesc.items:          for item in menudesc.items:
             # here the items must all be Menu instances themselves  
168              if item is None:              if item is None:
169                  # a separator. Only add one if the last item was not a                  # a separator. Only add one if the last item was not a
170                  # separator                  # separator
# Line 169  class MainWindow(wxFrame): Line 217  class MainWindow(wxFrame):
217                              command.IsCheckCommand())                              command.IsCheckCommand())
218                  self.bind_command_events(command, ID)                  self.bind_command_events(command, ID)
219              else:              else:
220                  print "Unknown command %s" % name                  print _("Unknown command %s") % name
221    
222      def add_toolbar_command(self, toolbar, name):      def add_toolbar_command(self, toolbar, name):
223          """Add the command with name name to the toolbar toolbar.          """Add the command with name name to the toolbar toolbar.
# Line 191  class MainWindow(wxFrame): Line 239  class MainWindow(wxFrame):
239                                  isToggle = command.IsCheckCommand())                                  isToggle = command.IsCheckCommand())
240                  self.bind_command_events(command, ID)                  self.bind_command_events(command, ID)
241              else:              else:
242                  print "Unknown command %s" % name                  print _("Unknown command %s") % name
243    
244        def Context(self):
245            """Return the context object for a command invoked from this window
246            """
247            return Context(self.application, self.application.Session(), self)
248    
249      def invoke_command(self, event):      def invoke_command(self, event):
250          name = self.id_to_name.get(event.GetId())          name = self.id_to_name.get(event.GetId())
251          if name is not None:          if name is not None:
252              command = registry.Command(name)              command = registry.Command(name)
253              context = Context(self.application, self.application.Session(),              command.Execute(self.Context())
                               self)  
             command.Execute(context)  
254          else:          else:
255              print "Unknown command ID %d" % event.GetId()              print _("Unknown command ID %d") % event.GetId()
256    
257      def update_command_ui(self, event):      def update_command_ui(self, event):
258          #print "update_command_ui", self.id_to_name[event.GetId()]          #print "update_command_ui", self.id_to_name[event.GetId()]
259          context = Context(self.application, self.application.Session(), self)          context = self.Context()
260          command = registry.Command(self.id_to_name[event.GetId()])          command = registry.Command(self.id_to_name[event.GetId()])
261          if command is not None:          if command is not None:
262              event.Enable(command.Sensitive(context))              sensitive = command.Sensitive(context)
263                event.Enable(sensitive)
264                if command.IsTool() and not sensitive and command.Checked(context):
265                    # When a checked tool command is disabled deselect all
266                    # tools. Otherwise the tool would remain active but it
267                    # might lead to errors if the tools stays active. This
268                    # problem occurred in GREAT-ER and this fixes it, but
269                    # it's not clear to me whether this is really the best
270                    # way to do it (BH, 20021206).
271                    self.canvas.SelectTool(None)
272              event.SetText(command.DynText(context))              event.SetText(command.DynText(context))
273              if command.IsCheckCommand():              if command.IsCheckCommand():
274                  event.Check(command.Checked(context))                      event.Check(command.Checked(context))
275    
276      def RunMessageBox(self, title, text, flags = wxOK | wxICON_INFORMATION):      def RunMessageBox(self, title, text, flags = wxOK | wxICON_INFORMATION):
277          """Run a modal message box with the given text, title and flags          """Run a modal message box with the given text, title and flags
278          and return the result"""          and return the result"""
279          dlg = wxMessageDialog(self, text, title, flags)          dlg = wxMessageDialog(self, text, title, flags)
280            dlg.CenterOnParent()
281          result = dlg.ShowModal()          result = dlg.ShowModal()
282          dlg.Destroy()          dlg.Destroy()
283          return result          return result
# Line 230  class MainWindow(wxFrame): Line 291  class MainWindow(wxFrame):
291    
292      def add_dialog(self, name, dialog):      def add_dialog(self, name, dialog):
293          if self.dialogs.has_key(name):          if self.dialogs.has_key(name):
294              raise RuntimeError("The Dialog named %s is already open" % name)              raise RuntimeError(_("The Dialog named %s is already open") % name)
295          self.dialogs[name] = dialog          self.dialogs[name] = dialog
296    
297      def dialog_open(self, name):      def dialog_open(self, name):
# Line 248  class MainWindow(wxFrame): Line 309  class MainWindow(wxFrame):
309              text = "(%10.10g, %10.10g)" % pos              text = "(%10.10g, %10.10g)" % pos
310          else:          else:
311              text = ""              text = ""
312            self.set_position_text(text)
313    
314        def set_position_text(self, text):
315            """Set the statusbar text showing the current position.
316    
317            By default the text is shown in field 0 of the status bar.
318            Override this method in derived classes to put it into a
319            different field of the statusbar.
320            """
321          self.SetStatusText(text)          self.SetStatusText(text)
322    
323      def save_modified_session(self, can_veto = 1):      def save_modified_session(self, can_veto = 1):
# Line 263  class MainWindow(wxFrame): Line 333  class MainWindow(wxFrame):
333              flags = wxYES_NO | wxICON_QUESTION              flags = wxYES_NO | wxICON_QUESTION
334              if can_veto:              if can_veto:
335                  flags = flags | wxCANCEL                  flags = flags | wxCANCEL
336              result = self.RunMessageBox("Exit",              result = self.RunMessageBox(_("Exit"),
337                                          ("The session has been modified."                                          _("The session has been modified."
338                                           " Do you want to save it?"),                                           " Do you want to save it?"),
339                                          flags)                                          flags)
340              if result == wxID_YES:              if result == wxID_YES:
# Line 273  class MainWindow(wxFrame): Line 343  class MainWindow(wxFrame):
343              result = wxID_NO              result = wxID_NO
344          return result          return result
345    
346        def prepare_new_session(self):
347            for d in self.dialogs.values():
348                if not isinstance(d, tree.SessionTreeView):
349                    d.Close()
350    
351      def NewSession(self):      def NewSession(self):
352          self.save_modified_session()          self.save_modified_session()
353            self.prepare_new_session()
354          self.application.SetSession(create_empty_session())          self.application.SetSession(create_empty_session())
355    
356      def OpenSession(self):      def OpenSession(self):
357          self.save_modified_session()          self.save_modified_session()
358          dlg = wxFileDialog(self, "Select a session file", ".", "",          dlg = wxFileDialog(self, _("Open Session"), ".", "", "*.thuban", wxOPEN)
                            "*.thuban", wxOPEN)  
359          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
360                self.prepare_new_session()
361              self.application.OpenSession(dlg.GetPath())              self.application.OpenSession(dlg.GetPath())
362          dlg.Destroy()          dlg.Destroy()
363    
364      def SaveSession(self):      def SaveSession(self):
365          if self.application.session.filename == None:          if self.application.session.filename == None:
366              self.SaveSessionAs()              self.SaveSessionAs()
367          self.application.SaveSession()          else:
368                self.application.SaveSession()
369    
370      def SaveSessionAs(self):      def SaveSessionAs(self):
371          dlg = wxFileDialog(self, "Enter a filename for session", ".", "",          dlg = wxFileDialog(self, _("Save Session As"), ".", "",
372                             "*.thuban", wxOPEN)                             "*.thuban", wxOPEN)
373          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
374              self.application.session.SetFilename(dlg.GetPath())              self.application.session.SetFilename(dlg.GetPath())
# Line 306  class MainWindow(wxFrame): Line 383  class MainWindow(wxFrame):
383          if result == wxID_CANCEL:          if result == wxID_CANCEL:
384              event.Veto()              event.Veto()
385          else:          else:
386                # FIXME: it would be better to tie the unsubscription to
387                # wx's destroy event, but that isn't implemented for wxGTK
388                # yet.
389                self.canvas.Unsubscribe(VIEW_POSITION, self.view_position_changed)
390              self.Destroy()              self.Destroy()
391    
392      def SetMap(self, map):      def SetMap(self, map):
393          self.canvas.SetMap(map)          self.canvas.SetMap(map)
394    
395        def Map(self):
396            """Return the map displayed by this mainwindow"""
397            return self.canvas.Map()
398    
399      def ShowSessionTree(self):      def ShowSessionTree(self):
400          name = "session_tree"          name = "session_tree"
401          dialog = self.get_open_dialog(name)          dialog = self.get_open_dialog(name)
402          if dialog is None:          if dialog is None:
403              dialog = tree.SessionTreeView(self, self.application, name)              dialog = tree.SessionTreeView(self, self.application, name)
404              self.add_dialog(name, dialog)              self.add_dialog(name, dialog)
405              dialog.Show(true)              dialog.Show(True)
406          else:          else:
407              # FIXME: bring dialog to front here              # FIXME: bring dialog to front here
408              pass              pass
409    
410    
411      def About(self):      def About(self):
412          self.RunMessageBox("About",          self.RunMessageBox(_("About"),
413                             ("Thuban is a program for\n"                             _("Thuban v%s\n"
414                                #"Build Date: %s\n"
415                                "\n"
416                                "Thuban is a program for\n"
417                              "exploring geographic data.\n"                              "exploring geographic data.\n"
418                              "Copyright (C) 2001 Intevation GmbH.\n"                              "Copyright (C) 2001-2003 Intevation GmbH.\n"
419                              "Thuban is licensed under the GPL"),                              "Thuban is licensed under the GNU GPL"
420                               % __ThubanVersion__), #__BuildDate__)),
421                             wxOK | wxICON_INFORMATION)                             wxOK | wxICON_INFORMATION)
422    
423      def AddLayer(self):      def AddLayer(self):
424          dlg = wxFileDialog(self, "Select a data file", ".", "", "*.*",          dlg = wxFileDialog(self, _("Select a data file"), ".", "", "*.*",
425                             wxOPEN)                             wxOPEN)
426          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
427              filename = dlg.GetPath()              filename = dlg.GetPath()
# Line 343  class MainWindow(wxFrame): Line 433  class MainWindow(wxFrame):
433                  map.AddLayer(layer)                  map.AddLayer(layer)
434              except IOError:              except IOError:
435                  # the layer couldn't be opened                  # the layer couldn't be opened
436                  self.RunMessageBox("Add Layer",                  self.RunMessageBox(_("Add Layer"),
437                                     "Can't open the file '%s'." % filename)                                     _("Can't open the file '%s'.") % filename)
438              else:              else:
439                  if not has_layers:                  if not has_layers:
440                      # if we're adding a layer to an empty map, for the                      # if we're adding a layer to an empty map, fit the
441                      # new map to the window                      # new map to the window
442                      self.canvas.FitMapToWindow()                      self.canvas.FitMapToWindow()
443          dlg.Destroy()          dlg.Destroy()
# Line 357  class MainWindow(wxFrame): Line 447  class MainWindow(wxFrame):
447          if layer is not None:          if layer is not None:
448              self.canvas.Map().RemoveLayer(layer)              self.canvas.Map().RemoveLayer(layer)
449    
450        def CanRemoveLayer(self):
451            """Return true if the currently selected layer can be deleted.
452    
453            If no layer is selected return false.
454    
455            The return value of this method determines whether the remove
456            layer command is sensitive in menu.
457            """
458            layer = self.current_layer()
459            if layer is not None:
460                return self.canvas.Map().CanRemoveLayer(layer)
461            return 0
462    
463      def RaiseLayer(self):      def RaiseLayer(self):
464          layer = self.current_layer()          layer = self.current_layer()
465          if layer is not None:          if layer is not None:
# Line 372  class MainWindow(wxFrame): Line 475  class MainWindow(wxFrame):
475    
476          If no layer is selected, return None          If no layer is selected, return None
477          """          """
478          return self.interactor.SelectedLayer()          return self.canvas.SelectedLayer()
479    
480      def has_selected_layer(self):      def has_selected_layer(self):
481          """Return true if a layer is currently selected"""          """Return true if a layer is currently selected"""
482          return self.interactor.HasSelectedLayer()          return self.canvas.HasSelectedLayer()
483    
484      def choose_color(self):      def choose_color(self):
485          """Run the color selection dialog and return the selected color.          """Run the color selection dialog and return the selected color.
# Line 399  class MainWindow(wxFrame): Line 502  class MainWindow(wxFrame):
502          if layer is not None:          if layer is not None:
503              color = self.choose_color()              color = self.choose_color()
504              if color is not None:              if color is not None:
505                  layer.SetFill(color)                  layer.GetClassification().SetDefaultFill(color)
506    
507      def LayerTransparentFill(self):      def LayerTransparentFill(self):
508          layer = self.current_layer()          layer = self.current_layer()
509          if layer is not None:          if layer is not None:
510              layer.SetFill(None)              layer.GetClassification().SetDefaultFill(Color.None)
511    
512      def LayerOutlineColor(self):      def LayerOutlineColor(self):
513          layer = self.current_layer()          layer = self.current_layer()
514          if layer is not None:          if layer is not None:
515              color = self.choose_color()              color = self.choose_color()
516              if color is not None:              if color is not None:
517                  layer.SetStroke(color)                  layer.GetClassification().SetDefaultLineColor(color)
518    
519      def LayerNoOutline(self):      def LayerNoOutline(self):
520          layer = self.current_layer()          layer = self.current_layer()
521          if layer is not None:          if layer is not None:
522              layer.SetStroke(None)              layer.GetClassification().SetDefaultLineColor(Color.None)
523    
524      def HideLayer(self):      def HideLayer(self):
525          layer = self.current_layer()          layer = self.current_layer()
# Line 435  class MainWindow(wxFrame): Line 538  class MainWindow(wxFrame):
538              name = "table_view" + str(id(table))              name = "table_view" + str(id(table))
539              dialog = self.get_open_dialog(name)              dialog = self.get_open_dialog(name)
540              if dialog is None:              if dialog is None:
541                  dialog = tableview.TableFrame(self, self.interactor, name,                  dialog = tableview.LayerTableFrame(self, name,
542                                                "Table: %s" % layer.Title(),                                                 _("Table: %s") % layer.Title(),
543                                                layer, table)                                                     layer, table)
544                  self.add_dialog(name, dialog)                  self.add_dialog(name, dialog)
545                  dialog.Show(true)                  dialog.Show(true)
546              else:              else:
# Line 461  class MainWindow(wxFrame): Line 564  class MainWindow(wxFrame):
564              map.SetProjection(proj)              map.SetProjection(proj)
565          proj4Dlg.Destroy()          proj4Dlg.Destroy()
566    
567        def Classify(self):
568    
569            #
570            # the menu option for this should only be available if there
571            # is a current layer, so we don't need to check if the
572            # current layer is None
573            #
574    
575            layer = self.current_layer()
576            self.OpenClassifier(layer)
577    
578        def OpenClassifier(self, layer):
579            name = "classifier" + str(id(layer))
580            dialog = self.get_open_dialog(name)
581    
582            if dialog is None:
583                dialog = classifier.Classifier(self, name, layer)
584                self.add_dialog(name, dialog)
585                dialog.Show()
586    
587    
588        def ShowLegend(self):
589            name = "legend"
590            dialog = self.get_open_dialog(name)
591    
592            if dialog is None:
593                dialog = legend.Legend(self, name, self.Map())
594                self.add_dialog(name, dialog)
595                dialog.Show()
596    
597      def ZoomInTool(self):      def ZoomInTool(self):
598          self.canvas.ZoomInTool()          self.canvas.ZoomInTool()
599    
# Line 483  class MainWindow(wxFrame): Line 616  class MainWindow(wxFrame):
616      def PrintMap(self):      def PrintMap(self):
617          self.canvas.Print()          self.canvas.Print()
618    
619      def identify_view_on_demand(self, layer, shape):      def identify_view_on_demand(self, layer, shapes):
620          name = "identify_view"          name = "identify_view"
621          if self.canvas.CurrentTool() == "IdentifyTool":          if self.canvas.CurrentTool() == "IdentifyTool":
622              if not self.dialog_open(name):              if not self.dialog_open(name):
623                  dialog = identifyview.IdentifyView(self, self.interactor, name)                  dialog = identifyview.IdentifyView(self, name)
624                  self.add_dialog(name, dialog)                  self.add_dialog(name, dialog)
625                  dialog.Show(true)                  dialog.Show(true)
626              else:              else:
# Line 511  def _method_command(name, title, method, Line 644  def _method_command(name, title, method,
644                           helptext = helptext, icon = icon,                           helptext = helptext, icon = icon,
645                           sensitive = sensitive))                           sensitive = sensitive))
646    
647  def _tool_command(name, title, method, toolname, helptext = "",  def make_check_current_tool(toolname):
648                    icon = ""):      """Return a function that tests if the currently active tool is toolname
649      """Add a tool command"""  
650        The returned function can be called with the context and returns
651        true iff the currently active tool's name is toolname. It's directly
652        usable as the 'checked' callback of a command.
653        """
654      def check_current_tool(context, name=toolname):      def check_current_tool(context, name=toolname):
655          return context.mainwindow.canvas.CurrentTool() == name          return context.mainwindow.canvas.CurrentTool() == name
656      registry.Add(Command(name, title, call_method, args=(method,),      return check_current_tool
657                           helptext = helptext, icon = icon,  
658                           checked = check_current_tool))  def _tool_command(name, title, method, toolname, helptext = "",
659                      icon = "", sensitive = None):
660        """Add a tool command"""
661        registry.Add(ToolCommand(name, title, call_method, args=(method,),
662                                 helptext = helptext, icon = icon,
663                                 checked = make_check_current_tool(toolname),
664                                 sensitive = sensitive))
665    
666  def _has_selected_layer(context):  def _has_selected_layer(context):
667      """Return true if a layer is selected in the context"""      """Return true if a layer is selected in the context"""
668      return context.mainwindow.has_selected_layer()      return context.mainwindow.has_selected_layer()
669    
670    def _can_remove_layer(context):
671        return context.mainwindow.CanRemoveLayer()
672    
673    def _has_tree_window_shown(context):
674        """Return true if the tree window is shown"""
675        return context.mainwindow.get_open_dialog("session_tree") is None
676    
677    def _has_visible_map(context):
678        """Return true iff theres a visible map in the mainwindow.
679    
680        A visible map is a map with at least one visible layer."""
681        map = context.mainwindow.Map()
682        if map is not None:
683            for layer in map.Layers():
684                if layer.Visible():
685                    return 1
686        return 0
687    
688    def _has_legend_shown(context):
689        """Return true if the legend window is shown"""
690        return context.mainwindow.get_open_dialog("legend") is None
691    
692    
693  # File menu  # File menu
694  _method_command("new_session", "&New Session", "NewSession")  _method_command("new_session", _("&New Session"), "NewSession")
695  _method_command("open_session", "&Open Session", "OpenSession")  _method_command("open_session", _("&Open Session"), "OpenSession")
696  _method_command("save_session", "&Save Session", "SaveSession")  _method_command("save_session", _("&Save Session"), "SaveSession")
697  _method_command("save_session_as", "Save Session &As", "SaveSessionAs")  _method_command("save_session_as", _("Save Session &As"), "SaveSessionAs")
698  _method_command("show_session_tree", "Show Session &Tree", "ShowSessionTree")  _method_command("show_session_tree", _("Show Session &Tree"), "ShowSessionTree",
699  _method_command("exit", "&Exit", "Exit")                  sensitive = _has_tree_window_shown)
700    _method_command("exit", _("E&xit"), "Exit")
701    
702  # Help menu  # Help menu
703  _method_command("help_about", "&About", "About")  _method_command("help_about", _("&About"), "About")
704    
705    
706  # Map menu  # Map menu
707  _method_command("map_projection", "Pro&jection", "Projection")  _method_command("map_projection", _("Pro&jection"), "Projection")
708    
709  _tool_command("map_zoom_in_tool", "&Zoom in", "ZoomInTool", "ZoomInTool",  _tool_command("map_zoom_in_tool", _("&Zoom in"), "ZoomInTool", "ZoomInTool",
710                helptext = "Switch to map-mode 'zoom-in'", icon = "zoom_in")                helptext = _("Switch to map-mode 'zoom-in'"), icon = "zoom_in",
711  _tool_command("map_zoom_out_tool", "Zoom &out", "ZoomOutTool", "ZoomOutTool",                sensitive = _has_visible_map)
712                helptext = "Switch to map-mode 'zoom-out'", icon = "zoom_out")  _tool_command("map_zoom_out_tool", _("Zoom &out"), "ZoomOutTool", "ZoomOutTool",
713  _tool_command("map_pan_tool", "&Pan", "PanTool", "PanTool",                helptext = _("Switch to map-mode 'zoom-out'"), icon = "zoom_out",
714                helptext = "Switch to map-mode 'pan'", icon = "pan")                sensitive = _has_visible_map)
715  _tool_command("map_identify_tool", "&Identify", "IdentifyTool", "IdentifyTool",  _tool_command("map_pan_tool", _("&Pan"), "PanTool", "PanTool",
716                helptext = "Switch to map-mode 'identify'", icon = "identify")                helptext = _("Switch to map-mode 'pan'"), icon = "pan",
717  _tool_command("map_label_tool", "&Label", "LabelTool", "LabelTool",                sensitive = _has_visible_map)
718                helptext = "Add/Remove labels", icon = "label")  _tool_command("map_identify_tool", _("&Identify"), "IdentifyTool",
719  _method_command("map_full_extent", "&Full extent", "FullExtent",                "IdentifyTool",
720                 helptext = "Full Extent", icon = "fullextent")                helptext = _("Switch to map-mode 'identify'"), icon = "identify",
721  _method_command("map_print", "Prin&t", "PrintMap", helptext = "Print the map")                sensitive = _has_visible_map)
722    _tool_command("map_label_tool", _("&Label"), "LabelTool", "LabelTool",
723                  helptext = _("Add/Remove labels"), icon = "label",
724                  sensitive = _has_visible_map)
725    _method_command("map_full_extent", _("&Full extent"), "FullExtent",
726                   helptext = _("Full Extent"), icon = "fullextent",
727                  sensitive = _has_visible_map)
728    _method_command("map_print", _("Prin&t"), "PrintMap",
729                    helptext = _("Print the map"))
730    
731  # Layer menu  # Layer menu
732  _method_command("layer_add", "&Add Layer", "AddLayer",  _method_command("layer_add", _("&Add Layer"), "AddLayer",
733                  helptext = "Add a new layer to active map")                  helptext = _("Add a new layer to active map"))
734  _method_command("layer_remove", "&Remove Layer", "RemoveLayer",  _method_command("layer_remove", _("&Remove Layer"), "RemoveLayer",
735                  helptext = "Remove selected layer(s)",                  helptext = _("Remove selected layer(s)"),
736                  sensitive = _has_selected_layer)                  sensitive = _can_remove_layer)
737  _method_command("layer_fill_color", "&Fill Color", "LayerFillColor",  _method_command("layer_fill_color", _("&Fill Color"), "LayerFillColor",
738                  helptext = "Set the fill color of selected layer(s)",                  helptext = _("Set the fill color of selected layer(s)"),
739                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
740  _method_command("layer_transparent_fill", "&Transparent Fill",  _method_command("layer_transparent_fill", _("&Transparent Fill"),
741                  "LayerTransparentFill",                  "LayerTransparentFill",
742                  helptext = "Do not fill the selected layer(s)",                  helptext = _("Do not fill the selected layer(s)"),
743                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
744  _method_command("layer_outline_color", "&Outline Color", "LayerOutlineColor",  _method_command("layer_outline_color", _("&Outline Color"), "LayerOutlineColor",
745                  helptext = "Set the outline color of selected layer(s)",                  helptext = _("Set the outline color of selected layer(s)"),
746                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
747  _method_command("layer_no_outline", "&No Outline", "LayerNoOutline",  _method_command("layer_no_outline", _("&No Outline"), "LayerNoOutline",
748                  helptext = "Do not draw the outline of the selected layer(s)",                  helptext= _("Do not draw the outline of the selected layer(s)"),
749                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
750  _method_command("layer_raise", "&Raise", "RaiseLayer",  _method_command("layer_raise", _("&Raise"), "RaiseLayer",
751                  helptext = "Raise selected layer(s)",                  helptext = _("Raise selected layer(s)"),
752                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
753  _method_command("layer_lower", "&Lower", "LowerLayer",  _method_command("layer_lower", _("&Lower"), "LowerLayer",
754                  helptext = "Lower selected layer(s)",                  helptext = _("Lower selected layer(s)"),
755                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
756  _method_command("layer_show", "&Show", "ShowLayer",  _method_command("layer_show", _("&Show"), "ShowLayer",
757                  helptext = "Make selected layer(s) visible",                  helptext = _("Make selected layer(s) visible"),
758                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
759  _method_command("layer_hide", "&Hide", "HideLayer",  _method_command("layer_hide", _("&Hide"), "HideLayer",
760                  helptext = "Make selected layer(s) unvisible",                  helptext = _("Make selected layer(s) unvisible"),
761                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
762  _method_command("layer_show_table", "Show Ta&ble", "LayerShowTable",  _method_command("layer_show_table", _("Show Ta&ble"), "LayerShowTable",
763                  helptext = "Show the selected layer's table",                  helptext = _("Show the selected layer's table"),
764                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
765    _method_command("layer_classifier", _("Classify"), "Classify",
766                    sensitive = _has_selected_layer)
767    _method_command("show_legend", _("Legend"), "ShowLegend",
768                    sensitive = _has_legend_shown)
769    
770  # the menu structure  # the menu structure
771  main_menu = Menu("<main>", "<main>",  main_menu = Menu("<main>", "<main>",
772                   [Menu("file", "&File",                   [Menu("file", _("&File"),
773                         ["new_session", "open_session", None,                         ["new_session", "open_session", None,
774                          "save_session", "save_session_as", None,                          "save_session", "save_session_as", None,
775                          "show_session_tree", None,                          "show_session_tree", None,
776                            "show_legend", None,
777                          "exit"]),                          "exit"]),
778                    Menu("map", "&Map",                    Menu("map", _("&Map"),
779                         ["layer_add", "layer_remove",                         ["layer_add", "layer_remove",
780                          None,                          None,
781                          "map_projection",                          "map_projection",
# Line 607  main_menu = Menu("<main>", "<main>", Line 786  main_menu = Menu("<main>", "<main>",
786                          "map_full_extent",                          "map_full_extent",
787                          None,                          None,
788                          "map_print"]),                          "map_print"]),
789                    Menu("layer", "&Layer",                    Menu("layer", _("&Layer"),
790                         ["layer_fill_color", "layer_transparent_fill",                         ["layer_fill_color", "layer_transparent_fill",
791                          "layer_outline_color", "layer_no_outline",                          "layer_outline_color", "layer_no_outline",
792                          None,                          None,
# Line 615  main_menu = Menu("<main>", "<main>", Line 794  main_menu = Menu("<main>", "<main>",
794                          None,                          None,
795                          "layer_show", "layer_hide",                          "layer_show", "layer_hide",
796                          None,                          None,
797                          "layer_show_table"]),                          "layer_show_table",
798                    Menu("help", "&Help",                          None,
799                            "layer_classifier"]),
800                      Menu("help", _("&Help"),
801                         ["help_about"])])                         ["help_about"])])
802    
803  # the main toolbar  # the main toolbar
804    
805  main_toolbar = Menu("<toolbar>", "<toolbar>",  main_toolbar = Menu("<toolbar>", "<toolbar>",
806                      ["map_zoom_in_tool", "map_zoom_out_tool", "map_pan_tool",                      ["map_zoom_in_tool", "map_zoom_out_tool", "map_pan_tool",
807                       "map_identify_tool", "map_label_tool", "map_full_extent"])                       "map_full_extent", None,
808                         "map_identify_tool", "map_label_tool"])

Legend:
Removed from v.227  
changed lines
  Added in v.550

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26