/[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 1080 by bh, Wed May 28 09:12:21 2003 UTC revision 1094 by bh, Wed May 28 18:59:46 2003 UTC
# Line 17  __ThubanVersion__ = "0.2" #"$THUBAN_0_2$ Line 17  __ThubanVersion__ = "0.2" #"$THUBAN_0_2$
17  #__BuildDate__ = "$Date$"  #__BuildDate__ = "$Date$"
18    
19  import os  import os
20    import copy
21    
22  from wxPython.wx import *  from wxPython.wx import *
23  from wxPython.wx import __version__ as wxPython_version  from wxPython.wx import __version__ as wxPython_version
# Line 548  class MainWindow(DockFrame): Line 549  class MainWindow(DockFrame):
549          layer = self.current_layer()          layer = self.current_layer()
550          if layer is not None:          if layer is not None:
551              layer.SetVisible(0)              layer.SetVisible(0)
552            
553      def ShowLayer(self):      def ShowLayer(self):
554          layer = self.current_layer()          layer = self.current_layer()
555          if layer is not None:          if layer is not None:
556              layer.SetVisible(1)              layer.SetVisible(1)
557    
558        def DuplicateLayer(self):
559            """Ceate a new layer above the selected layer with the same shapestore
560            """
561            layer = self.current_layer()
562            if layer is not None and hasattr(layer, "ShapeStore"):
563                new_layer = Layer(_("Copy of `%s'") % layer.Title(),
564                                  layer.ShapeStore(),
565                                  projection = layer.GetProjection())
566                new_classification = copy.deepcopy(layer.GetClassification())
567                new_layer.SetClassification(new_classification)
568                self.Map().AddLayer(new_layer)
569    
570        def CanDuplicateLayer(self):
571            """Return whether the DuplicateLayer method can create a duplicate"""
572            layer = self.current_layer()
573            return layer is not None and hasattr(layer, "ShapeStore")
574    
575      def LayerShowTable(self):      def LayerShowTable(self):
576          layer = self.current_layer()          layer = self.current_layer()
577          if layer is not None:          if layer is not None:
# Line 678  class MainWindow(DockFrame): Line 696  class MainWindow(DockFrame):
696      def TableClose(self):      def TableClose(self):
697          tables = self.application.session.UnreferencedTables()          tables = self.application.session.UnreferencedTables()
698    
699            lst = [(t.Title(), t) for t in tables]
700            lst.sort()
701            titles = [i[0] for i in lst]
702          dlg = wxMultipleChoiceDialog(self, _("Pick the tables to close:"),          dlg = wxMultipleChoiceDialog(self, _("Pick the tables to close:"),
703                                       _("Close Table"),                                       _("Close Table"), titles,
704                                       [t.Title() for t in tables],                                       size = (400, 300),
705                                       size = (400, 300), style=wxRESIZE_BORDER)                                       style = wxDEFAULT_DIALOG_STYLE |
706                                                 wxRESIZE_BORDER)
707          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
708              for i in dlg.GetValue():              for i in dlg.GetValue():
709                  self.application.session.RemoveTable(tables[i])                  self.application.session.RemoveTable(lst[i][1])
710    
711    
712      def TableShow(self):      def TableShow(self):
# Line 695  class MainWindow(DockFrame): Line 717  class MainWindow(DockFrame):
717          """          """
718          tables = self.application.session.Tables()          tables = self.application.session.Tables()
719    
720            lst = [(t.Title(), t) for t in tables]
721            lst.sort()
722            titles = [i[0] for i in lst]
723          dlg = wxMultipleChoiceDialog(self, _("Pick the table to show:"),          dlg = wxMultipleChoiceDialog(self, _("Pick the table to show:"),
724                                       _("Show Table"),                                       _("Show Table"), titles,
                                      [t.Title() for t in tables],  
725                                       size = (400,300),                                       size = (400,300),
726                                       style = wxDEFAULT_DIALOG_STYLE |                                       style = wxDEFAULT_DIALOG_STYLE |
727                                               wxRESIZE_BORDER)                                               wxRESIZE_BORDER)
# Line 705  class MainWindow(DockFrame): Line 729  class MainWindow(DockFrame):
729              for i in dlg.GetValue():              for i in dlg.GetValue():
730                  # XXX: if the table belongs to a layer, open a                  # XXX: if the table belongs to a layer, open a
731                  # LayerTableFrame instead of QueryTableFrame                  # LayerTableFrame instead of QueryTableFrame
732                  self.ShowTableView(tables[i])                  self.ShowTableView(lst[i][1])
733    
734      def TableJoin(self):      def TableJoin(self):
735          dlg = JoinDialog(self, _("Join Tables"), self.application.session)          dlg = JoinDialog(self, _("Join Tables"), self.application.session)
# Line 919  _method_command("layer_remove", _("&Remo Line 943  _method_command("layer_remove", _("&Remo
943  # Layer menu  # Layer menu
944  _method_command("layer_projection", _("Pro&jection..."), "LayerProjection",  _method_command("layer_projection", _("Pro&jection..."), "LayerProjection",
945                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
946    _method_command("layer_duplicate", _("&Duplicate"), "DuplicateLayer",
947                    helptext = _("Duplicate selected layer(s)"),
948              sensitive = lambda context: context.mainwindow.CanDuplicateLayer())
949  _method_command("layer_raise", _("&Raise"), "RaiseLayer",  _method_command("layer_raise", _("&Raise"), "RaiseLayer",
950                  helptext = _("Raise selected layer(s)"),                  helptext = _("Raise selected layer(s)"),
951                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
# Line 995  main_menu = Menu("<main>", "<main>", Line 1022  main_menu = Menu("<main>", "<main>",
1022                          None,                          None,
1023                          "layer_show", "layer_hide",                          "layer_show", "layer_hide",
1024                          None,                          None,
1025                            "layer_duplicate",
1026                            None,
1027                          "layer_projection",                          "layer_projection",
1028                          None,                          None,
1029                          "layer_show_table",                          "layer_show_table",

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26