/[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 2184 by jan, Fri Apr 16 08:21:12 2004 UTC revision 2186 by jan, Sun Apr 18 20:37:01 2004 UTC
# Line 572  class MainWindow(DockFrame): Line 572  class MainWindow(DockFrame):
572              return self.canvas.Map().CanRemoveLayer(layer)              return self.canvas.Map().CanRemoveLayer(layer)
573          return False          return False
574    
575        def LayerToTop(self):
576            layer = self.current_layer()
577            if layer is not None:
578                self.canvas.Map().MoveLayerToTop(layer)
579    
580      def RaiseLayer(self):      def RaiseLayer(self):
581          layer = self.current_layer()          layer = self.current_layer()
582          if layer is not None:          if layer is not None:
# Line 582  class MainWindow(DockFrame): Line 587  class MainWindow(DockFrame):
587          if layer is not None:          if layer is not None:
588              self.canvas.Map().LowerLayer(layer)              self.canvas.Map().LowerLayer(layer)
589    
590        def LayerToBottom(self):
591            layer = self.current_layer()
592            if layer is not None:
593                self.canvas.Map().MoveLayerToBottom(layer)
594    
595      def current_layer(self):      def current_layer(self):
596          """Return the currently selected layer.          """Return the currently selected layer.
597    
# Line 604  class MainWindow(DockFrame): Line 614  class MainWindow(DockFrame):
614      def HideLayer(self):      def HideLayer(self):
615          layer = self.current_layer()          layer = self.current_layer()
616          if layer is not None:          if layer is not None:
617              layer.SetVisible(0)              layer.SetVisible(False)
618    
619      def ShowLayer(self):      def ShowLayer(self):
620          layer = self.current_layer()          layer = self.current_layer()
621          if layer is not None:          if layer is not None:
622              layer.SetVisible(1)              layer.SetVisible(True)
623    
624        def ToggleLayerVisibility(self):
625            layer = self.current_layer()
626            layer.SetVisible(not layer.Visible())
627    
628      def DuplicateLayer(self):      def DuplicateLayer(self):
629          """Ceate a new layer above the selected layer with the same shapestore          """Ceate a new layer above the selected layer with the same shapestore
# Line 633  class MainWindow(DockFrame): Line 647  class MainWindow(DockFrame):
647          Present a TableView Window for the current layer.          Present a TableView Window for the current layer.
648          In case the window is already open, bring it to the front.          In case the window is already open, bring it to the front.
649          In case, there is no active layer, do nothing.          In case, there is no active layer, do nothing.
650          In case, the layer has not ShapeStore, raise a corresponding message dialog          In case, the layer has no ShapeStore, do nothing.
         and do nothing else.  
651          """          """
652          layer = self.current_layer()          layer = self.current_layer()
653          if layer is not None:          if layer is not None:
654              if not hasattr(layer, "ShapeStore"):              if not hasattr(layer, "ShapeStore"):
                 self.RunMessageBox(_("Show Table"),  
                                    _("The layer '%s' has no table." % layer.Title()))  
655                  return                  return
656              table = layer.ShapeStore().Table()              table = layer.ShapeStore().Table()
657              name = "table_view" + str(id(table))              name = "table_view" + str(id(table))
# Line 997  def _has_selected_layer(context): Line 1008  def _has_selected_layer(context):
1008      """Return true if a layer is selected in the context"""      """Return true if a layer is selected in the context"""
1009      return context.mainwindow.has_selected_layer()      return context.mainwindow.has_selected_layer()
1010    
1011    def _has_selected_layer_visible(context):
1012        """Return true if a layer is selected in the context which is
1013        visible."""
1014        if context.mainwindow.has_selected_layer():
1015            layer = context.mainwindow.current_layer()
1016            if layer.Visible(): return True
1017        return False
1018    
1019  def _has_selected_shape_layer(context):  def _has_selected_shape_layer(context):
1020      """Return true if a shape layer is selected in the context"""      """Return true if a shape layer is selected in the context"""
1021      return context.mainwindow.has_selected_shape_layer()      return context.mainwindow.has_selected_shape_layer()
# Line 1020  def _has_visible_map(context): Line 1039  def _has_visible_map(context):
1039      if map is not None:      if map is not None:
1040          for layer in map.Layers():          for layer in map.Layers():
1041              if layer.Visible():              if layer.Visible():
1042                  return 1                  return True
1043      return 0      return False
1044    
1045  def _has_legend_shown(context):  def _has_legend_shown(context):
1046      """Return true if the legend window is shown"""      """Return true if the legend window is shown"""
# Line 1145  _method_command("layer_jointable", _("&J Line 1164  _method_command("layer_jointable", _("&J
1164                  sensitive = _has_selected_shape_layer,                  sensitive = _has_selected_shape_layer,
1165                  helptext = _("Join and attach a table to the selected layer"))                  helptext = _("Join and attach a table to the selected layer"))
1166    
1167    # further layer methods:
1168    _method_command("layer_to_top", _("&Top"), "LayerToTop",
1169                    helptext = _("Put selected layer to the top"),
1170                    sensitive = _has_selected_layer)
1171    _method_command("layer_to_bottom", _("&Bottom"), "LayerToBottom",
1172                    helptext = _("Put selected layer to the bottom"),
1173                    sensitive = _has_selected_layer)
1174    _method_command("layer_visibility", _("&Visible"), "ToggleLayerVisibility",
1175                    checked = _has_selected_layer_visible,
1176                    helptext = _("Toggle visibility of selected layer"),
1177                    sensitive = _has_selected_layer)
1178    
1179  def _can_unjoin(context):  def _can_unjoin(context):
1180      """Return whether the Layer/Unjoin command can be executed.      """Return whether the Layer/Unjoin command can be executed.
1181    

Legend:
Removed from v.2184  
changed lines
  Added in v.2186

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26