/[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 2363 by joey, Fri Oct 1 18:07:14 2004 UTC revision 2516 by frank, Sun Jan 9 12:32:17 2005 UTC
# Line 35  from Thuban.UI.multiplechoicedialog impo Line 35  from Thuban.UI.multiplechoicedialog impo
35  import view  import view
36  import tree  import tree
37  import tableview, identifyview  import tableview, identifyview
 from Thuban.UI.classifier import Classifier  
38  import legend  import legend
39  from menu import Menu  from menu import Menu
40    
# Line 53  import Thuban.Model.resource Line 52  import Thuban.Model.resource
52    
53  import projdialog  import projdialog
54    
55    from Thuban.Lib.classmapper import ClassMapper
56    
57    layer_properties_dialogs = ClassMapper()
58    
59  class MainWindow(DockFrame):  class MainWindow(DockFrame):
60    
# Line 349  class MainWindow(DockFrame): Line 351  class MainWindow(DockFrame):
351          """          """
352          self.SetStatusText(text)          self.SetStatusText(text)
353    
354        def OpenOrRaiseDialog(self, name, dialog_class, *args, **kw):
355            """
356            Open or raise a dialog.
357    
358            If a dialog with the denoted name does already exist it is
359            raised.  Otherwise a new dialog, an instance of dialog_class,
360            is created, inserted into the main list and displayed.
361            """
362            dialog = self.get_open_dialog(name)
363    
364            if dialog is None:
365                dialog = dialog_class(self, name, *args, **kw)
366                self.add_dialog(name, dialog)
367                dialog.Show(True)
368            else:
369                dialog.Raise()
370                              
371      def save_modified_session(self, can_veto = 1):      def save_modified_session(self, can_veto = 1):
372          """If the current session has been modified, ask the user          """If the current session has been modified, ask the user
373          whether to save it and do so if requested. Return the outcome of          whether to save it and do so if requested. Return the outcome of
# Line 634  class MainWindow(DockFrame): Line 653  class MainWindow(DockFrame):
653                                layer.ShapeStore(),                                layer.ShapeStore(),
654                                projection = layer.GetProjection())                                projection = layer.GetProjection())
655              new_classification = copy.deepcopy(layer.GetClassification())              new_classification = copy.deepcopy(layer.GetClassification())
656                new_layer.SetClassificationColumn(
657                                    layer.GetClassificationColumn())
658              new_layer.SetClassification(new_classification)              new_layer.SetClassification(new_classification)
659              self.Map().AddLayer(new_layer)              self.Map().AddLayer(new_layer)
660    
# Line 705  class MainWindow(DockFrame): Line 726  class MainWindow(DockFrame):
726          self.OpenLayerProperties(layer)          self.OpenLayerProperties(layer)
727    
728      def OpenLayerProperties(self, layer, group = None):      def OpenLayerProperties(self, layer, group = None):
729          name = "layer_properties" + str(id(layer))          """
730          dialog = self.get_open_dialog(name)          Open or raise the properties dialog.
731    
732          if dialog is None:          This method opens or raises the properties dialog for the
733              dialog = Classifier(self, name, layer, group)          currently selected layer if one is defined for this layer
734              self.add_dialog(name, dialog)          type.
735              dialog.Show()          """
736          dialog.Raise()          dialog_class = layer_properties_dialogs.get(layer)
737    
738            if dialog_class is not None:
739                name = "layer_properties" + str(id(layer))
740                self.OpenOrRaiseDialog(name, dialog_class, layer, group = group)
741    
742      def LayerJoinTable(self):      def LayerJoinTable(self):
743          layer = self.canvas.SelectedLayer()          layer = self.canvas.SelectedLayer()

Legend:
Removed from v.2363  
changed lines
  Added in v.2516

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26