1 |
# 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 dialogs import NonModalDialog |
15 |
from controls import RecordListCtrl |
16 |
from messages import SELECTED_SHAPE |
17 |
|
18 |
class IdentifyListCtrl(RecordListCtrl): |
19 |
|
20 |
def selected_shape(self, layer, shape): |
21 |
if layer is not None: |
22 |
table = layer.shapetable |
23 |
else: |
24 |
table = None |
25 |
self.fill_list(table, shape) |
26 |
|
27 |
|
28 |
class IdentifyView(NonModalDialog): |
29 |
|
30 |
def __init__(self, parent, interactor, name): |
31 |
NonModalDialog.__init__(self, parent, interactor, name, |
32 |
"Identify Shape") |
33 |
self.interactor.Subscribe(SELECTED_SHAPE, self.selected_shape) |
34 |
|
35 |
panel = wxPanel(self, -1, style = wxWANTS_CHARS) |
36 |
self.list = IdentifyListCtrl(panel, -1) |
37 |
|
38 |
sizer = wxBoxSizer(wxVERTICAL) |
39 |
sizer.Add(self.list, 1, wx.wxEXPAND| wx.wxALL, 0) |
40 |
|
41 |
panel.SetAutoLayout(true) |
42 |
panel.SetSizer(sizer) |
43 |
sizer.Fit(panel) |
44 |
|
45 |
def OnClose(self, event): |
46 |
self.interactor.Unsubscribe(SELECTED_SHAPE, self.selected_shape) |
47 |
NonModalDialog.OnClose(self, event) |
48 |
|
49 |
def selected_shape(self, layer, shape): |
50 |
self.list.selected_shape(layer, shape) |