/[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 6 - (hide annotations)
Tue Aug 28 15:41:52 2001 UTC (23 years, 6 months ago) by bh
Original Path: trunk/thuban/Thuban/UI/identifyview.py
File MIME type: text/x-python
File size: 2014 byte(s)
import all the source files

1 bh 6 # Copyright (c) 2001 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     import view
14     from messages import SELECTED_SHAPE
15    
16     class IdentifyListCtrl(wxListCtrl):
17    
18     def __init__(self, parent, id, interactor):
19     wxListCtrl.__init__(self, parent, id, style = wxLC_REPORT)
20     self.interactor = interactor
21     self.interactor.Subscribe(SELECTED_SHAPE, self.selected_shape)
22    
23     self.InsertColumn(0, "Field")
24     self.SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER)
25     self.InsertColumn(1, "Value")
26     self.SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER)
27    
28     def fill_list(self, layer, shape):
29     self.DeleteAllItems()
30    
31     if shape is not None:
32     table = layer.shapetable
33     num_cols = table.field_count()
34     num_rows = table.record_count()
35    
36     names = []
37     for i in range(num_cols):
38     type, name, length, decc = table.field_info(i)
39     names.append(name)
40     record = table.read_record(shape)
41     i = 0
42     for name in names:
43     value = record[name]
44     i = self.InsertStringItem(i, name)
45     self.SetStringItem(i, 1, str(value))
46    
47     def selected_shape(self, layer, shape):
48     self.fill_list(layer, shape)
49    
50    
51    
52     class IdentifyView(wxFrame):
53    
54     def __init__(self, parent, app):
55     # assume parent is Thuban's main window python object
56     wxFrame.__init__(self, parent, -1, "Identify Shape")
57     panel = wxPanel(self, -1, style = wxWANTS_CHARS)
58     self.list = IdentifyListCtrl(panel, -1, app.interactor)
59    
60     sizer = wxBoxSizer(wxVERTICAL)
61     sizer.Add(self.list, 1, wx.wxEXPAND| wx.wxALL, 0)
62    
63     panel.SetAutoLayout(true)
64     panel.SetSizer(sizer)
65     sizer.Fit(panel)

Properties

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26