/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/identifyview.py
ViewVC logotype

Annotation of /branches/WIP-pyshapelib-bramz/Thuban/UI/identifyview.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1219 - (hide annotations)
Mon Jun 16 17:42:54 2003 UTC (21 years, 8 months ago) by bh
Original Path: trunk/thuban/Thuban/UI/identifyview.py
File MIME type: text/x-python
File size: 2452 byte(s)
Update to the layer interface: Direct access to the table,
shapetable, shapefile and filename attributes is now actively
deprecated by issuing deprecation warnings for all places where
this happens.

* Thuban/Model/layer.py (Layer.__getattr__): New. Implement access
to the instance variables table, shapetable, shapefile and
filename via __getattr__ so that we can issue a deprecation
warning.
(Layer.SetShapeStore): Don't set the deprecated instance variables
any more
(Layer.SetShapeStore): Don't use deprecated layer instance
variables
(Layer.Destroy): No need to explicitly remove the instance
variables any more
(Layer.GetFieldType, Layer.Shape): Don't use deprecated layer
instance variables

* Thuban/UI/classgen.py (ClassGenDialog.__init__)
(GenUniformPanel._OnRetrieve, GenUniquePanel._OnRetrieve)
(GenQuantilesPanel.GetList, GenQuantilesPanel.OnRetrieve): Don't
use deprecated layer instance variables

* Thuban/UI/classifier.py (Classifier.__init__): Don't use
deprecated layer instance variables

* Thuban/UI/identifyview.py (IdentifyListCtrl.selected_shape)
(IdentifyGridCtrl.selected_shape): Don't set the deprecated layer
instance variables

* Thuban/UI/tableview.py (LayerTableGrid.select_shapes): Don't use
deprecated layer instance variables

* Thuban/UI/mainwindow.py (MainWindow.LayerShowTable): Don't use
deprecated layer instance variables

* Thuban/Model/save.py (SessionSaver.write_layer): Don't use
deprecated layer instance variables

* Thuban/UI/renderer.py (MapRenderer.draw_shape_layer)
(MapRenderer.polygon_render_param): Don't use deprecated layer instance
variables

* test/runtests.py (main): Turn Thuban's deprecation warnings into
errors so that they're cought by the tests

* test/test_load.py (TestSingleLayer.test): Don't use deprecated
layer instance variables

1 bh 535 # Copyright (c) 2001, 2002, 2003 by Intevation GmbH
2 bh 6 # Authors:
3     # Bernhard Herzog <[email protected]>
4 frank 1138 # Frank Koormann <[email protected]>
5 bh 6 #
6     # This program is free software under the GPL (>=v2)
7     # Read the file COPYING coming with Thuban for details.
8    
9     __version__ = "$Revision$"
10    
11     from wxPython.wx import *
12     from wxPython.grid import *
13    
14 jan 374 from Thuban import _
15    
16 bh 29 from dialogs import NonModalDialog
17 bh 80 from controls import RecordListCtrl, RecordGridCtrl
18 bh 535 from messages import SHAPES_SELECTED
19 bh 6
20 bh 51 class IdentifyListCtrl(RecordListCtrl):
21 bh 6
22     def selected_shape(self, layer, shape):
23 bh 66 if layer is not None:
24 bh 1219 table = layer.ShapeStore().Table()
25 bh 66 else:
26     table = None
27     self.fill_list(table, shape)
28 bh 6
29 bh 80 class IdentifyGridCtrl(RecordGridCtrl):
30 bh 6
31 bh 80 def selected_shape(self, layer, shape):
32     if layer is not None:
33 bh 1219 table = layer.ShapeStore().Table()
34 bh 80 else:
35     table = None
36     self.SetTableRecord(table, shape)
37    
38 bh 29 class IdentifyView(NonModalDialog):
39 bh 6
40 bh 535 def __init__(self, parent, name):
41     NonModalDialog.__init__(self, parent, name, _("Identify Shape"))
42     parent.Subscribe(SHAPES_SELECTED, self.selected_shape)
43    
44 frank 1138 top_box = wxBoxSizer(wxVERTICAL)
45 frank 1131 #self.list = IdentifyGridCtrl(panel)
46 frank 1138 self.list = IdentifyListCtrl(self, -1)
47     self.list.SetSize(wxSize(305,200))
48     top_box.Add(self.list, 1, wxEXPAND|wxALL, 4)
49 bh 6
50 frank 1138 box = wxBoxSizer(wxHORIZONTAL)
51     box.Add(wxButton(self, wxID_CLOSE, _("Close")), 0, wxALL, 4)
52     top_box.Add(box, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 4)
53 bh 535
54 frank 1138 EVT_BUTTON(self, wxID_CLOSE, self.OnClose)
55 bh 29
56 frank 1138 self.SetAutoLayout(True)
57     self.SetSizer(top_box)
58     top_box.Fit(self)
59     top_box.SetSizeHints(self)
60    
61 bh 1194 # Make sure to reflect the current selection.
62     self.selected_shape(parent.SelectedLayer(), parent.SelectedShapes())
63    
64 bh 29 def OnClose(self, event):
65 bh 535 self.parent.Unsubscribe(SHAPES_SELECTED, self.selected_shape)
66 bh 29 NonModalDialog.OnClose(self, event)
67    
68 bh 535 def selected_shape(self, layer, shapes):
69     """Subscribed to the SHAPES_SELECTED messages.
70    
71     If exatly one shape is selected, pass that shape id to the
72     list's selected_shape method. Otherwise pass None as the shape
73     id.
74     """
75     if len(shapes) == 1:
76     shape = shapes[0]
77     else:
78     shape = None
79 bh 29 self.list.selected_shape(layer, shape)

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26