21 |
|
|
22 |
def selected_shape(self, layer, shape): |
def selected_shape(self, layer, shape): |
23 |
if layer is not None: |
if layer is not None: |
24 |
table = layer.table |
table = layer.ShapeStore().Table() |
25 |
else: |
else: |
26 |
table = None |
table = None |
27 |
self.fill_list(table, shape) |
self.fill_list(table, shape) |
30 |
|
|
31 |
def selected_shape(self, layer, shape): |
def selected_shape(self, layer, shape): |
32 |
if layer is not None: |
if layer is not None: |
33 |
table = layer.table |
table = layer.ShapeStore().Table() |
34 |
else: |
else: |
35 |
table = None |
table = None |
36 |
self.SetTableRecord(table, shape) |
self.SetTableRecord(table, shape) |
37 |
|
|
38 |
class IdentifyView(NonModalDialog): |
class IdentifyView(NonModalDialog): |
39 |
|
|
40 |
|
ID_STOP = 100 |
41 |
|
|
42 |
def __init__(self, parent, name): |
def __init__(self, parent, name): |
43 |
NonModalDialog.__init__(self, parent, name, _("Identify Shape")) |
NonModalDialog.__init__(self, parent, name, _("Identify Shape")) |
44 |
parent.Subscribe(SHAPES_SELECTED, self.selected_shape) |
parent.Subscribe(SHAPES_SELECTED, self.selected_shape) |
50 |
top_box.Add(self.list, 1, wxEXPAND|wxALL, 4) |
top_box.Add(self.list, 1, wxEXPAND|wxALL, 4) |
51 |
|
|
52 |
box = wxBoxSizer(wxHORIZONTAL) |
box = wxBoxSizer(wxHORIZONTAL) |
53 |
box.Add(wxButton(self, wxID_CLOSE, _("Close")), 0, wxALL, 4) |
box.Add(wxButton(self, wxID_CLOSE, _("Close Window")), 0, wxALL, 4) |
54 |
|
box.Add(wxButton(self, self.ID_STOP, _("Stop Identify Mode")), |
55 |
|
0, wxALL, 4) |
56 |
top_box.Add(box, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 4) |
top_box.Add(box, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 4) |
57 |
|
|
58 |
EVT_BUTTON(self, wxID_CLOSE, self.OnClose) |
EVT_BUTTON(self, wxID_CLOSE, self.OnClose) |
59 |
|
EVT_BUTTON(self, self.ID_STOP, self.OnStop) |
60 |
|
|
61 |
self.SetAutoLayout(True) |
self.SetAutoLayout(True) |
62 |
self.SetSizer(top_box) |
self.SetSizer(top_box) |
63 |
top_box.Fit(self) |
top_box.Fit(self) |
64 |
top_box.SetSizeHints(self) |
top_box.SetSizeHints(self) |
65 |
|
|
66 |
|
# Make sure to reflect the current selection. |
67 |
|
self.selected_shape(parent.SelectedLayer(), parent.SelectedShapes()) |
68 |
|
|
69 |
def OnClose(self, event): |
def OnClose(self, event): |
70 |
self.parent.Unsubscribe(SHAPES_SELECTED, self.selected_shape) |
self.parent.Unsubscribe(SHAPES_SELECTED, self.selected_shape) |
71 |
NonModalDialog.OnClose(self, event) |
NonModalDialog.OnClose(self, event) |
72 |
|
|
73 |
|
def OnStop(self, event): |
74 |
|
self.parent.Unsubscribe(SHAPES_SELECTED, self.selected_shape) |
75 |
|
self.parent.canvas.SelectTool(None) |
76 |
|
NonModalDialog.OnClose(self, event) |
77 |
|
|
78 |
def selected_shape(self, layer, shapes): |
def selected_shape(self, layer, shapes): |
79 |
"""Subscribed to the SHAPES_SELECTED messages. |
"""Subscribed to the SHAPES_SELECTED messages. |
80 |
|
|