/[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 1125 by jonathan, Fri May 30 06:31:21 2003 UTC revision 1126 by bh, Mon Jun 2 14:15:43 2003 UTC
# Line 749  class MainWindow(DockFrame): Line 749  class MainWindow(DockFrame):
749              dialog.Show(True)              dialog.Show(True)
750          # FIXME: else bring dialog to front          # FIXME: else bring dialog to front
751    
752        def TableRename(self):
753            """Let the user rename a table"""
754    
755            # First, let the user select a table
756            tables = self.application.session.Tables()
757            lst = [(t.Title(), t) for t in tables]
758            lst.sort()
759            titles = [i[0] for i in lst]
760            dlg = wxMultipleChoiceDialog(self, _("Pick the table to rename:"),
761                                         _("Rename Table"), titles,
762                                         size = (400,300),
763                                         style = wxDEFAULT_DIALOG_STYLE |
764                                                 wxRESIZE_BORDER)
765            if (dlg.ShowModal() == wxID_OK):
766                to_rename = [lst[i][1] for i in dlg.GetValue()]
767                dlg.Destroy()
768            else:
769                to_rename = []
770    
771            # Second, let the user rename the layers
772            for table in to_rename:
773                dlg = wxTextEntryDialog(self, "Table Title: ", "Rename Table",
774                                        table.Title())
775                try:
776                    if dlg.ShowModal() == wxID_OK:
777                        title = dlg.GetValue()
778                        if title != "":
779                            table.SetTitle(title)
780    
781                            # Make sure the session is marked as modified.
782                            # FIXME: This should be handled automatically,
783                            # but that requires more changes to the tables
784                            # than I have time for currently.
785                            self.application.session.changed()
786                finally:
787                    dlg.Destroy()
788    
789    
790      def ZoomInTool(self):      def ZoomInTool(self):
791          self.canvas.ZoomInTool()          self.canvas.ZoomInTool()
792    
# Line 791  class MainWindow(DockFrame): Line 829  class MainWindow(DockFrame):
829    
830          dlg.Destroy()          dlg.Destroy()
831    
832        def RenameLayer(self):
833            """Let the user rename the currently selected layer"""
834            layer = self.current_layer()
835            if layer is not None:
836                dlg = wxTextEntryDialog(self, "Layer Title: ", "Rename Layer",
837                                        layer.Title())
838                try:
839                    if dlg.ShowModal() == wxID_OK:
840                        title = dlg.GetValue()
841                        if title != "":
842                            layer.SetTitle(title)
843                finally:
844                    dlg.Destroy()
845    
846      def identify_view_on_demand(self, layer, shapes):      def identify_view_on_demand(self, layer, shapes):
847          """Subscribed to the canvas' SHAPES_SELECTED message          """Subscribed to the canvas' SHAPES_SELECTED message
848    
# Line 948  _method_command("layer_projection", _("P Line 1000  _method_command("layer_projection", _("P
1000  _method_command("layer_duplicate", _("&Duplicate"), "DuplicateLayer",  _method_command("layer_duplicate", _("&Duplicate"), "DuplicateLayer",
1001                  helptext = _("Duplicate selected layer(s)"),                  helptext = _("Duplicate selected layer(s)"),
1002            sensitive = lambda context: context.mainwindow.CanDuplicateLayer())            sensitive = lambda context: context.mainwindow.CanDuplicateLayer())
1003    _method_command("layer_rename", _("Re&name ..."), "RenameLayer",
1004                    helptext = _("Rename selected layer"),
1005                    sensitive = _has_selected_layer)
1006  _method_command("layer_raise", _("&Raise"), "RaiseLayer",  _method_command("layer_raise", _("&Raise"), "RaiseLayer",
1007                  helptext = _("Raise selected layer(s)"),                  helptext = _("Raise selected layer(s)"),
1008                  sensitive = _has_selected_layer)                  sensitive = _has_selected_layer)
# Line 985  def _can_unjoin(context): Line 1040  def _can_unjoin(context):
1040  _method_command("layer_unjointable", _("&Unjoin Table..."), "LayerUnjoinTable",  _method_command("layer_unjointable", _("&Unjoin Table..."), "LayerUnjoinTable",
1041                  sensitive = _can_unjoin)                  sensitive = _can_unjoin)
1042    
1043    
1044    def _has_tables(context):
1045        return bool(context.session.Tables())
1046    
1047  # Table menu  # Table menu
1048  _method_command("table_open", _("&Open..."), "TableOpen")  _method_command("table_open", _("&Open..."), "TableOpen")
1049  _method_command("table_close", _("&Close"), "TableClose",  _method_command("table_close", _("&Close"), "TableClose",
1050         sensitive = lambda context: bool(context.session.UnreferencedTables()))         sensitive = lambda context: bool(context.session.UnreferencedTables()))
1051  _method_command("table_show", _("&Show"), "TableShow")  _method_command("table_rename", _("&Rename..."), "TableRename",
1052  _method_command("table_join", _("&Join..."), "TableJoin")                  sensitive = _has_tables)
1053    _method_command("table_show", _("&Show"), "TableShow",
1054                    sensitive = _has_tables)
1055    _method_command("table_join", _("&Join..."), "TableJoin",
1056                    sensitive = _has_tables)
1057    
1058  #  Export only under Windows ...  #  Export only under Windows ...
1059  map_menu = ["layer_add", "rasterlayer_add", "layer_remove", "map_rename",  map_menu = ["layer_add", "rasterlayer_add", "layer_remove", "map_rename",
# Line 1020  main_menu = Menu("<main>", "<main>", Line 1083  main_menu = Menu("<main>", "<main>",
1083                          "exit"]),                          "exit"]),
1084                    Menu("map", _("&Map"), map_menu),                    Menu("map", _("&Map"), map_menu),
1085                    Menu("layer", _("&Layer"),                    Menu("layer", _("&Layer"),
1086                          ["layer_raise", "layer_lower",                         ["layer_rename", "layer_duplicate",
1087                          None,                          None,
1088                          "layer_show", "layer_hide",                          "layer_raise", "layer_lower",
1089                          None,                          None,
1090                          "layer_duplicate",                          "layer_show", "layer_hide",
1091                          None,                          None,
1092                          "layer_projection",                          "layer_projection",
1093                          None,                          None,
# Line 1034  main_menu = Menu("<main>", "<main>", Line 1097  main_menu = Menu("<main>", "<main>",
1097                          None,                          None,
1098                          "layer_properties"]),                          "layer_properties"]),
1099                    Menu("table", _("&Table"),                    Menu("table", _("&Table"),
1100                         ["table_open", "table_close",                         ["table_open", "table_close", "table_rename",
1101                         None,                         None,
1102                         "table_show",                         "table_show",
1103                         None,                         None,

Legend:
Removed from v.1125  
changed lines
  Added in v.1126

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26