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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1131 - (show annotations)
Thu Jun 5 13:27:01 2003 UTC (21 years, 9 months ago) by frank
Original Path: trunk/thuban/Thuban/UI/identifyview.py
File MIME type: text/x-python
File size: 2037 byte(s)
(IdentifyView.__init__): Use ListCtrl instead of GridCtrl

1 # Copyright (c) 2001, 2002, 2003 by Intevation GmbH
2 # Authors:
3 # Bernhard Herzog <[email protected]>
4 #
5 # This program is free software under the GPL (>=v2)
6 # Read the file COPYING coming with Thuban for details.
7
8 __version__ = "$Revision$"
9
10 from wxPython.wx import *
11 from wxPython.grid import *
12
13 from Thuban import _
14
15 from dialogs import NonModalDialog
16 from controls import RecordListCtrl, RecordGridCtrl
17 from messages import SHAPES_SELECTED
18
19 class IdentifyListCtrl(RecordListCtrl):
20
21 def selected_shape(self, layer, shape):
22 if layer is not None:
23 table = layer.table
24 else:
25 table = None
26 self.fill_list(table, shape)
27
28 class IdentifyGridCtrl(RecordGridCtrl):
29
30 def selected_shape(self, layer, shape):
31 if layer is not None:
32 table = layer.table
33 else:
34 table = None
35 self.SetTableRecord(table, shape)
36
37 class IdentifyView(NonModalDialog):
38
39 def __init__(self, parent, name):
40 NonModalDialog.__init__(self, parent, name, _("Identify Shape"))
41 parent.Subscribe(SHAPES_SELECTED, self.selected_shape)
42
43 panel = wxPanel(self, -1, style = wxWANTS_CHARS)
44 self.list = IdentifyListCtrl(panel, -1)
45 #self.list = IdentifyGridCtrl(panel)
46
47 sizer = wxBoxSizer(wxVERTICAL)
48 sizer.Add(self.list, 1, wx.wxEXPAND| wx.wxALL, 0)
49
50 self.SetSize(wxSize(300,200))
51 panel.SetAutoLayout(True)
52 panel.SetSizer(sizer)
53 sizer.Fit(panel)
54
55 def OnClose(self, event):
56 self.parent.Unsubscribe(SHAPES_SELECTED, self.selected_shape)
57 NonModalDialog.OnClose(self, event)
58
59 def selected_shape(self, layer, shapes):
60 """Subscribed to the SHAPES_SELECTED messages.
61
62 If exatly one shape is selected, pass that shape id to the
63 list's selected_shape method. Otherwise pass None as the shape
64 id.
65 """
66 if len(shapes) == 1:
67 shape = shapes[0]
68 else:
69 shape = None
70 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