/[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 2364 by joey, Fri Oct 1 18:18:49 2004 UTC revision 2531 by bernhard, Thu Jan 20 18:47:26 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 333  class MainWindow(DockFrame): Line 335  class MainWindow(DockFrame):
335          return self.dialogs.get(name)          return self.dialogs.get(name)
336    
337      def view_position_changed(self):      def view_position_changed(self):
338            """Put current position in status bar after a mouse move."""
339          pos = self.canvas.CurrentPosition()          pos = self.canvas.CurrentPosition()
340          if pos is not None:          if pos is not None:
341              text = "(%10.10g, %10.10g)" % pos              text = "(%10.10g, %10.10g)" % pos
342          else:          else:
343              text = ""              text = ""
344                # XXX This is a hack until we find a better place for this code.
345                # (BER 20050120)
346                # BH wrote (20050120):
347                # this branch is only executed when the mouse
348                # leaves the canvas window, so it's not that often [..]
349                # [Here] not the right place to put this code.  
350                # I don't have a better solution at hand,
351                # but the view_position_changed is only there to update
352                # the current position.  If other information is to
353                # be shown in the status bar it should
354                # be handled in a different way and
355                # by other methods.
356                #
357                # The status bar widget supports some kind of stack of texts.
358                # maybe that can be used to distinguis
359                # between short-lived information such as the mouse position
360                # and more permanent information such as the hint
361                # about the projections.
362                map = self.canvas.Map()
363                for layer in map.layers:
364                    bbox = layer.LatLongBoundingBox()
365                    if bbox:
366                        left, bottom, right, top = bbox
367                        if not (-180 <= left <= 180 and
368                            -180 <= right <= 180 and
369                            -90 <= top <= 90 and
370                            -90 <= bottom <= 90):
371                            text = ("Select '"+layer.title+"' and pick a " +
372                                "projection using Layer/Projection...")
373                            break
374    
375          self.set_position_text(text)          self.set_position_text(text)
376    
377      def set_position_text(self, text):      def set_position_text(self, text):
# Line 651  class MainWindow(DockFrame): Line 685  class MainWindow(DockFrame):
685                                layer.ShapeStore(),                                layer.ShapeStore(),
686                                projection = layer.GetProjection())                                projection = layer.GetProjection())
687              new_classification = copy.deepcopy(layer.GetClassification())              new_classification = copy.deepcopy(layer.GetClassification())
688                new_layer.SetClassificationColumn(
689                        layer.GetClassificationColumn())
690              new_layer.SetClassification(new_classification)              new_layer.SetClassification(new_classification)
691              self.Map().AddLayer(new_layer)              self.Map().AddLayer(new_layer)
692    
# Line 729  class MainWindow(DockFrame): Line 765  class MainWindow(DockFrame):
765          currently selected layer if one is defined for this layer          currently selected layer if one is defined for this layer
766          type.          type.
767          """          """
768          name = "layer_properties" + str(id(layer))          dialog_class = layer_properties_dialogs.get(layer)
769          self.OpenOrRaiseDialog(name, Classifier, layer, group = group)  
770                    if dialog_class is not None:
771                name = "layer_properties" + str(id(layer))
772                self.OpenOrRaiseDialog(name, dialog_class, layer, group = group)
773    
774      def LayerJoinTable(self):      def LayerJoinTable(self):
775          layer = self.canvas.SelectedLayer()          layer = self.canvas.SelectedLayer()
776          if layer is not None:          if layer is not None:

Legend:
Removed from v.2364  
changed lines
  Added in v.2531

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26