/[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 281 by bh, Mon Aug 26 18:16:36 2002 UTC revision 307 by bh, Fri Sep 6 10:01:16 2002 UTC
# Line 309  class MainWindow(wxFrame): Line 309  class MainWindow(wxFrame):
309          if result == wxID_CANCEL:          if result == wxID_CANCEL:
310              event.Veto()              event.Veto()
311          else:          else:
312                # FIXME: it would be better to tie the unsubscription to
313                # wx's destroy event, but that isn't implemented for wxGTK
314                # yet.
315                self.canvas.Unsubscribe(VIEW_POSITION, self.view_position_changed)
316              self.Destroy()              self.Destroy()
317    
318      def SetMap(self, map):      def SetMap(self, map):
# Line 360  class MainWindow(wxFrame): Line 364  class MainWindow(wxFrame):
364          if layer is not None:          if layer is not None:
365              self.canvas.Map().RemoveLayer(layer)              self.canvas.Map().RemoveLayer(layer)
366    
367        def CanRemoveLayer(self):
368            """Return true if the currently selected layer can be deleted.
369    
370            If no layer is selected return false.
371    
372            The return value of this method determines whether the remove
373            layer command is sensitive in menu.
374            """
375            layer = self.current_layer()
376            if layer is not None:
377                return self.canvas.Map().CanRemoveLayer(layer)
378            return 0
379    
380      def RaiseLayer(self):      def RaiseLayer(self):
381          layer = self.current_layer()          layer = self.current_layer()
382          if layer is not None:          if layer is not None:
# Line 536  def _has_selected_layer(context): Line 553  def _has_selected_layer(context):
553      """Return true if a layer is selected in the context"""      """Return true if a layer is selected in the context"""
554      return context.mainwindow.has_selected_layer()      return context.mainwindow.has_selected_layer()
555    
556    def _can_remove_layer(context):
557        return context.mainwindow.CanRemoveLayer()
558    
559  def _has_tree_window_shown(context):  def _has_tree_window_shown(context):
560      """Return true if the tree window is shown"""      """Return true if the tree window is shown"""
561      return context.mainwindow.get_open_dialog("session_tree") is None      return context.mainwindow.get_open_dialog("session_tree") is None
# Line 575  _method_command("layer_add", "&Add Layer Line 595  _method_command("layer_add", "&Add Layer
595                  helptext = "Add a new layer to active map")                  helptext = "Add a new layer to active map")
596  _method_command("layer_remove", "&Remove Layer", "RemoveLayer",  _method_command("layer_remove", "&Remove Layer", "RemoveLayer",
597                  helptext = "Remove selected layer(s)",                  helptext = "Remove selected layer(s)",
598                  sensitive = _has_selected_layer)                  sensitive = _can_remove_layer)
599  _method_command("layer_fill_color", "&Fill Color", "LayerFillColor",  _method_command("layer_fill_color", "&Fill Color", "LayerFillColor",
600                  helptext = "Set the fill color of selected layer(s)",                  helptext = "Set the fill color of selected layer(s)",
601                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)

Legend:
Removed from v.281  
changed lines
  Added in v.307

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26