11 |
from wxPython.grid import * |
from wxPython.grid import * |
12 |
|
|
13 |
import view |
import view |
14 |
|
from dialogs import NonModalDialog |
15 |
from messages import SELECTED_SHAPE |
from messages import SELECTED_SHAPE |
16 |
|
|
17 |
class IdentifyListCtrl(wxListCtrl): |
class IdentifyListCtrl(wxListCtrl): |
18 |
|
|
19 |
def __init__(self, parent, id, interactor): |
def __init__(self, parent, id): |
20 |
wxListCtrl.__init__(self, parent, id, style = wxLC_REPORT) |
wxListCtrl.__init__(self, parent, id, style = wxLC_REPORT) |
|
self.interactor = interactor |
|
|
self.interactor.Subscribe(SELECTED_SHAPE, self.selected_shape) |
|
21 |
|
|
22 |
self.InsertColumn(0, "Field") |
self.InsertColumn(0, "Field") |
23 |
self.SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER) |
self.SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER) |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
class IdentifyView(wxFrame): |
class IdentifyView(NonModalDialog): |
52 |
|
|
53 |
def __init__(self, parent, app): |
def __init__(self, parent, interactor, name): |
54 |
# assume parent is Thuban's main window python object |
NonModalDialog.__init__(self, parent, interactor, name, |
55 |
wxFrame.__init__(self, parent, -1, "Identify Shape") |
"Identify Shape") |
56 |
|
self.interactor.Subscribe(SELECTED_SHAPE, self.selected_shape) |
57 |
|
|
58 |
panel = wxPanel(self, -1, style = wxWANTS_CHARS) |
panel = wxPanel(self, -1, style = wxWANTS_CHARS) |
59 |
self.list = IdentifyListCtrl(panel, -1, app.interactor) |
self.list = IdentifyListCtrl(panel, -1) |
60 |
|
|
61 |
sizer = wxBoxSizer(wxVERTICAL) |
sizer = wxBoxSizer(wxVERTICAL) |
62 |
sizer.Add(self.list, 1, wx.wxEXPAND| wx.wxALL, 0) |
sizer.Add(self.list, 1, wx.wxEXPAND| wx.wxALL, 0) |
64 |
panel.SetAutoLayout(true) |
panel.SetAutoLayout(true) |
65 |
panel.SetSizer(sizer) |
panel.SetSizer(sizer) |
66 |
sizer.Fit(panel) |
sizer.Fit(panel) |
67 |
|
|
68 |
|
def OnClose(self, event): |
69 |
|
self.interactor.Unsubscribe(SELECTED_SHAPE, self.selected_shape) |
70 |
|
NonModalDialog.OnClose(self, event) |
71 |
|
|
72 |
|
def selected_shape(self, layer, shape): |
73 |
|
self.list.selected_shape(layer, shape) |