1 |
bh |
80 |
# Copyright (c) 2001, 2002 by Intevation GmbH |
2 |
bh |
6 |
# 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 |
jan |
374 |
from Thuban import _ |
14 |
|
|
|
15 |
bh |
6 |
import view |
16 |
bh |
29 |
from dialogs import NonModalDialog |
17 |
bh |
80 |
from controls import RecordListCtrl, RecordGridCtrl |
18 |
bh |
6 |
from messages import SELECTED_SHAPE |
19 |
|
|
|
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 |
|
|
table = layer.shapetable |
25 |
|
|
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 |
|
|
table = layer.shapetable |
34 |
|
|
else: |
35 |
|
|
table = None |
36 |
|
|
self.SetTableRecord(table, shape) |
37 |
|
|
|
38 |
bh |
29 |
class IdentifyView(NonModalDialog): |
39 |
bh |
6 |
|
40 |
bh |
29 |
def __init__(self, parent, interactor, name): |
41 |
|
|
NonModalDialog.__init__(self, parent, interactor, name, |
42 |
jan |
374 |
_("Identify Shape")) |
43 |
bh |
29 |
self.interactor.Subscribe(SELECTED_SHAPE, self.selected_shape) |
44 |
|
|
|
45 |
bh |
6 |
panel = wxPanel(self, -1, style = wxWANTS_CHARS) |
46 |
bh |
80 |
#self.list = IdentifyListCtrl(panel, -1) |
47 |
|
|
self.list = IdentifyGridCtrl(panel) |
48 |
bh |
6 |
|
49 |
|
|
sizer = wxBoxSizer(wxVERTICAL) |
50 |
|
|
sizer.Add(self.list, 1, wx.wxEXPAND| wx.wxALL, 0) |
51 |
frank |
422 |
|
52 |
|
|
self.SetSize(wxSize(300,200)) |
53 |
bh |
6 |
panel.SetAutoLayout(true) |
54 |
|
|
panel.SetSizer(sizer) |
55 |
|
|
sizer.Fit(panel) |
56 |
bh |
29 |
|
57 |
|
|
def OnClose(self, event): |
58 |
|
|
self.interactor.Unsubscribe(SELECTED_SHAPE, self.selected_shape) |
59 |
|
|
NonModalDialog.OnClose(self, event) |
60 |
|
|
|
61 |
|
|
def selected_shape(self, layer, shape): |
62 |
|
|
self.list.selected_shape(layer, shape) |