/[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 1072 by bh, Tue May 27 16:47:48 2003 UTC revision 1080 by bh, Wed May 28 09:12:21 2003 UTC
# Line 64  class MainWindow(DockFrame): Line 64  class MainWindow(DockFrame):
64      # implemented in the __getattr__ method.      # implemented in the __getattr__ method.
65      delegated_methods = {"SelectLayer": "canvas",      delegated_methods = {"SelectLayer": "canvas",
66                           "SelectShapes": "canvas",                           "SelectShapes": "canvas",
67                             "SelectedLayer": "canvas",
68                           "SelectedShapes": "canvas",                           "SelectedShapes": "canvas",
69                           }                           }
70    
# Line 627  class MainWindow(DockFrame): Line 628  class MainWindow(DockFrame):
628              dlg.ShowModal()              dlg.ShowModal()
629    
630      def LayerUnjoinTable(self):      def LayerUnjoinTable(self):
631          print "LayerUnjoinTable: Not implemented."          layer = self.canvas.SelectedLayer()
632            if layer is not None:
633                orig_store = layer.ShapeStore().OrigShapeStore()
634                if orig_store:
635                    layer.SetShapeStore(orig_store)
636    
637      def ShowLegend(self):      def ShowLegend(self):
638          if not self.LegendShown():          if not self.LegendShown():
# Line 693  class MainWindow(DockFrame): Line 698  class MainWindow(DockFrame):
698          dlg = wxMultipleChoiceDialog(self, _("Pick the table to show:"),          dlg = wxMultipleChoiceDialog(self, _("Pick the table to show:"),
699                                       _("Show Table"),                                       _("Show Table"),
700                                       [t.Title() for t in tables],                                       [t.Title() for t in tables],
701                                       size = (400,300), style = wxRESIZE_BORDER)                                       size = (400,300),
702                                         style = wxDEFAULT_DIALOG_STYLE |
703                                                 wxRESIZE_BORDER)
704          if (dlg.ShowModal() == wxID_OK):          if (dlg.ShowModal() == wxID_OK):
705              for i in dlg.GetValue():              for i in dlg.GetValue():
706                  # XXX: if the table belongs to a layer, open a                  # XXX: if the table belongs to a layer, open a
# Line 931  _method_command("layer_properties", _("& Line 938  _method_command("layer_properties", _("&
938                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
939  _method_command("layer_jointable", _("&Join Table..."), "LayerJoinTable",  _method_command("layer_jointable", _("&Join Table..."), "LayerJoinTable",
940                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
941    
942    def _can_unjoin(context):
943        """Return whether the Layer/Unjoin command can be executed.
944    
945        This is the case if a layer is selected and that layer has a
946        shapestore that has an original shapestore.
947        """
948        layer = context.mainwindow.SelectedLayer()
949        if layer is None:
950            return 0
951        getstore = getattr(layer, "ShapeStore", None)
952        if getstore is not None:
953            return getstore().OrigShapeStore() is not None
954        else:
955            return 0
956  _method_command("layer_unjointable", _("&Unjoin Table..."), "LayerUnjoinTable",  _method_command("layer_unjointable", _("&Unjoin Table..."), "LayerUnjoinTable",
957                  sensitive = _has_selected_layer)                  sensitive = _can_unjoin)
958    
959  # Table menu  # Table menu
960  _method_command("table_open", _("&Open..."), "TableOpen")  _method_command("table_open", _("&Open..."), "TableOpen")

Legend:
Removed from v.1072  
changed lines
  Added in v.1080

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26