71 |
Publisher.__del__() |
Publisher.__del__() |
72 |
|
|
73 |
def Destroy(self): |
def Destroy(self): |
74 |
wxListCtrl.Destroy() |
for pf in (self.system_projs, self.user_projs): |
75 |
Publisher.Destroy() |
pf.Unsubscribe(PROJECTION_ADDED, self.pf_projection_added) |
76 |
|
pf.Unsubscribe(PROJECTION_REMOVED, self.pf_projection_removed) |
77 |
|
pf.Unsubscribe(PROJECTION_REPLACED, self.pf_projection_replaced) |
78 |
|
|
79 |
|
# Call wxListCtrl's method last because afterwards self is not |
80 |
|
# an instance of ProjectionList anymore as wxPython replaces |
81 |
|
# self.__class__ with its dead object class |
82 |
|
Publisher.Destroy(self) |
83 |
|
wxListCtrl.Destroy(self) |
84 |
|
|
85 |
def update_on_idle(self): |
def update_on_idle(self): |
86 |
self.needs_update = True |
self.needs_update = True |
166 |
|
|
167 |
def SelectProjection(self, proj): |
def SelectProjection(self, proj): |
168 |
"""Select the projection and deselect all others.""" |
"""Select the projection and deselect all others.""" |
169 |
|
# Set both the wxLIST_STATE_SELECTED and wxLIST_STATE_FOCUSED |
170 |
|
# flags on the newly selected item. If only |
171 |
|
# wxLIST_STATE_SELECTED is set, some other item is focused and |
172 |
|
# the first time the focus is moved with the keyboard the |
173 |
|
# selection moves in unexpected ways. |
174 |
|
state = wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED |
175 |
for i in range(len(self.projections)): |
for i in range(len(self.projections)): |
176 |
p = self.projections[i][1] |
p = self.projections[i][1] |
177 |
self.SetItemState(i, p is proj and wxLIST_STATE_SELECTED or 0, |
self.SetItemState(i, p is proj and state or 0, state) |
|
wxLIST_STATE_SELECTED) |
|
178 |
|
|
179 |
def ClearSelection(self): |
def ClearSelection(self): |
180 |
"""Deselect all projections.""" |
"""Deselect all projections.""" |