193 |
self.RegisterDataType(wxGRID_VALUE_FLOAT, |
self.RegisterDataType(wxGRID_VALUE_FLOAT, |
194 |
NullRenderer(wxGridCellFloatRenderer()), None) |
NullRenderer(wxGridCellFloatRenderer()), None) |
195 |
|
|
196 |
|
EVT_WINDOW_DESTROY(self, self.OnDestroy) |
197 |
|
|
198 |
|
def OnDestroy(self, event): |
199 |
|
Publisher.Destroy(self) |
200 |
|
|
201 |
def SetTableObject(self, table): |
def SetTableObject(self, table): |
202 |
self.table.SetTable(table) |
self.table.SetTable(table) |
203 |
|
|
315 |
self.session = self.app.Session() |
self.session = self.app.Session() |
316 |
self.session.Subscribe(TABLE_REMOVED, self.close_on_table_removed) |
self.session.Subscribe(TABLE_REMOVED, self.close_on_table_removed) |
317 |
|
|
318 |
|
def OnDestroy(self, event): |
319 |
|
"""Extend inherited method to unsubscribe messages""" |
320 |
|
self.app.Unsubscribe(SESSION_REPLACED, self.close_on_session_replaced) |
321 |
|
self.session.Unsubscribe(TABLE_REMOVED, self.close_on_table_removed) |
322 |
|
ThubanFrame.OnDestroy(self, event) |
323 |
|
|
324 |
def make_grid(self, table): |
def make_grid(self, table): |
325 |
"""Return the table grid to use in the frame. |
"""Return the table grid to use in the frame. |
329 |
""" |
""" |
330 |
return TableGrid(self, table) |
return TableGrid(self, table) |
331 |
|
|
|
def OnClose(self, event): |
|
|
self.app.Unsubscribe(SESSION_REPLACED, self.close_on_session_replaced) |
|
|
self.session.Unsubscribe(TABLE_REMOVED, self.close_on_table_removed) |
|
|
ThubanFrame.OnClose(self, event) |
|
|
|
|
332 |
def close_on_session_replaced(self, *args): |
def close_on_session_replaced(self, *args): |
333 |
"""Subscriber for the SESSION_REPLACED messages. |
"""Subscriber for the SESSION_REPLACED messages. |
334 |
|
|
408 |
sizer.Add(self.combo_value, 1, wxEXPAND|wxALL, 4) |
sizer.Add(self.combo_value, 1, wxEXPAND|wxALL, 4) |
409 |
sizer.Add(self.choice_action, 0, wxALL, 4) |
sizer.Add(self.choice_action, 0, wxALL, 4) |
410 |
sizer.Add(button_query, 0, wxALL | wxALIGN_CENTER_VERTICAL, 4) |
sizer.Add(button_query, 0, wxALL | wxALIGN_CENTER_VERTICAL, 4) |
411 |
sizer.Add(40, 20, 0, wxALL, 4) |
sizer.Add( (40, 20), 0, wxALL, 4) |
412 |
|
|
413 |
topBox.Add(sizer, 0, wxEXPAND|wxALL, 4) |
topBox.Add(sizer, 0, wxEXPAND|wxALL, 4) |
414 |
topBox.Add(self.grid, 1, wxEXPAND|wxALL, 0) |
topBox.Add(self.grid, 1, wxEXPAND|wxALL, 0) |
416 |
sizer = wxBoxSizer(wxHORIZONTAL) |
sizer = wxBoxSizer(wxHORIZONTAL) |
417 |
sizer.Add(button_export, 0, wxALL, 4) |
sizer.Add(button_export, 0, wxALL, 4) |
418 |
sizer.Add(button_exportSel, 0, wxALL, 4) |
sizer.Add(button_exportSel, 0, wxALL, 4) |
419 |
sizer.Add(60, 20, 1, wxALL|wxEXPAND, 4) |
sizer.Add( (60, 20), 1, wxALL|wxEXPAND, 4) |
420 |
sizer.Add(button_close, 0, wxALL|wxALIGN_RIGHT, 4) |
sizer.Add(button_close, 0, wxALL|wxALIGN_RIGHT, 4) |
421 |
topBox.Add(sizer, 0, wxALL | wxEXPAND, 4) |
topBox.Add(sizer, 0, wxALL | wxEXPAND, 4) |
422 |
|
|
589 |
for i in sel: |
for i in sel: |
590 |
self.grid.SelectRowById(i, True) |
self.grid.SelectRowById(i, True) |
591 |
|
|
592 |
|
def OnDestroy(self, event): |
593 |
|
"""Extend inherited method to unsubscribe messages""" |
594 |
|
# There's no need to unsubscribe from self.grid's messages |
595 |
|
# because it will get a DESTROY event too (since destroying the |
596 |
|
# frame basically means that all child windows are also |
597 |
|
# destroyed) and this it will clear all subscriptions |
598 |
|
# automatically. It may even have been destroyed already (this |
599 |
|
# does happen on w2000 for instance) so calling any of its |
600 |
|
# methods here would be an error. |
601 |
|
self.parent.Unsubscribe(SHAPES_SELECTED, self.select_shapes) |
602 |
|
self.map.Unsubscribe(MAP_LAYERS_REMOVED, self.map_layers_removed) |
603 |
|
QueryTableFrame.OnDestroy(self, event) |
604 |
|
|
605 |
def make_grid(self, table): |
def make_grid(self, table): |
606 |
"""Override the derived method to return a LayerTableGrid. |
"""Override the derived method to return a LayerTableGrid. |
607 |
""" |
""" |
613 |
""" |
""" |
614 |
return dict([(i, 0) for i in self.parent.SelectedShapes()]) |
return dict([(i, 0) for i in self.parent.SelectedShapes()]) |
615 |
|
|
|
def OnClose(self, event): |
|
|
"""Override the derived method to first unsubscribed.""" |
|
|
self.parent.Unsubscribe(SHAPES_SELECTED, self.select_shapes) |
|
|
self.grid.Unsubscribe(ROW_SELECTED, self.rows_selected) |
|
|
self.map.Unsubscribe(MAP_LAYERS_REMOVED, self.map_layers_removed) |
|
|
QueryTableFrame.OnClose(self, event) |
|
|
|
|
616 |
def select_shapes(self, layer, shapes): |
def select_shapes(self, layer, shapes): |
617 |
"""Subscribed to the SHAPES_SELECTED message. |
"""Subscribed to the SHAPES_SELECTED message. |
618 |
|
|