285 |
|
|
286 |
def __init__(self, parent, name, title, table): |
def __init__(self, parent, name, title, table): |
287 |
ThubanFrame.__init__(self, parent, name, title) |
ThubanFrame.__init__(self, parent, name, title) |
288 |
|
self.panel = wxPanel(self, -1) |
289 |
|
|
290 |
self.table = table |
self.table = table |
291 |
self.grid = self.make_grid(self.table) |
self.grid = self.make_grid(self.table) |
292 |
self.app = self.parent.application |
self.app = self.parent.application |
294 |
self.session = self.app.Session() |
self.session = self.app.Session() |
295 |
self.session.Subscribe(TABLE_REMOVED, self.close_on_table_removed) |
self.session.Subscribe(TABLE_REMOVED, self.close_on_table_removed) |
296 |
|
|
297 |
|
|
298 |
def make_grid(self, table): |
def make_grid(self, table): |
299 |
"""Return the table grid to use in the frame. |
"""Return the table grid to use in the frame. |
300 |
|
|
342 |
def __init__(self, parent, name, title, table): |
def __init__(self, parent, name, title, table): |
343 |
TableFrame.__init__(self, parent, name, title, table) |
TableFrame.__init__(self, parent, name, title, table) |
344 |
|
|
345 |
self.combo_fields = wxComboBox(self, -1, style=wxCB_READONLY) |
self.combo_fields = wxComboBox(self.panel, -1, style=wxCB_READONLY) |
346 |
self.choice_comp = wxChoice(self, -1, |
self.choice_comp = wxChoice(self.panel, -1, |
347 |
choices=["<", "<=", "==", "!=", ">=", ">"]) |
choices=["<", "<=", "==", "!=", ">=", ">"]) |
348 |
self.combo_value = wxComboBox(self, ID_COMBOVALUE) |
self.combo_value = wxComboBox(self.panel, ID_COMBOVALUE) |
349 |
self.choice_action = wxChoice(self, -1, |
self.choice_action = wxChoice(self.panel, -1, |
350 |
choices=[_("Replace Selection"), |
choices=[_("Replace Selection"), |
351 |
_("Refine Selection"), |
_("Refine Selection"), |
352 |
_("Add to Selection")]) |
_("Add to Selection")]) |
353 |
|
|
354 |
button_query = wxButton(self, ID_QUERY, _("Query")) |
button_query = wxButton(self.panel, ID_QUERY, _("Query")) |
355 |
button_saveas = wxButton(self, ID_EXPORT, _("Export")) |
button_saveas = wxButton(self.panel, ID_EXPORT, _("Export")) |
356 |
|
|
357 |
self.CreateStatusBar() |
self.CreateStatusBar() |
|
self.SetStatusText(_("0 rows (0 selected), 0 columns")) |
|
358 |
|
|
359 |
self.grid.SetSize((400, 200)) |
self.grid.SetSize((400, 200)) |
360 |
|
|
370 |
self.choice_action.SetSelection(0) |
self.choice_action.SetSelection(0) |
371 |
self.choice_comp.SetSelection(0) |
self.choice_comp.SetSelection(0) |
372 |
|
|
373 |
|
self.grid.Reparent(self.panel) |
374 |
|
|
375 |
|
self.UpdateStatusText() |
376 |
|
|
377 |
topBox = wxBoxSizer(wxVERTICAL) |
topBox = wxBoxSizer(wxVERTICAL) |
378 |
|
|
379 |
sizer = wxStaticBoxSizer(wxStaticBox(self, -1, |
sizer = wxStaticBoxSizer(wxStaticBox(self.panel, -1, |
380 |
_("Selection")), |
_("Selection")), |
381 |
wxHORIZONTAL) |
wxHORIZONTAL) |
382 |
sizer.Add(self.combo_fields, 1, wxEXPAND|wxALL, 4) |
sizer.Add(self.combo_fields, 1, wxEXPAND|wxALL, 4) |
390 |
topBox.Add(sizer, 0, wxEXPAND|wxALL, 4) |
topBox.Add(sizer, 0, wxEXPAND|wxALL, 4) |
391 |
topBox.Add(self.grid, 1, wxEXPAND|wxALL, 0) |
topBox.Add(self.grid, 1, wxEXPAND|wxALL, 0) |
392 |
|
|
393 |
|
self.panel.SetAutoLayout(True) |
394 |
|
self.panel.SetSizer(topBox) |
395 |
|
topBox.Fit(self.panel) |
396 |
|
topBox.SetSizeHints(self.panel) |
397 |
|
|
398 |
|
panelSizer = wxBoxSizer(wxVERTICAL) |
399 |
|
panelSizer.Add(self.panel, 1, wxEXPAND, 0) |
400 |
self.SetAutoLayout(True) |
self.SetAutoLayout(True) |
401 |
self.SetSizer(topBox) |
self.SetSizer(panelSizer) |
402 |
topBox.Fit(self) |
panelSizer.Fit(self) |
403 |
topBox.SetSizeHints(self) |
panelSizer.SetSizeHints(self) |
404 |
|
|
405 |
self.grid.SetFocus() |
self.grid.SetFocus() |
406 |
|
|
407 |
EVT_BUTTON(self, ID_QUERY, self.OnQuery) |
EVT_BUTTON(self, ID_QUERY, self.OnQuery) |
408 |
EVT_BUTTON(self, ID_EXPORT, self.OnSaveAs) |
EVT_BUTTON(self, ID_EXPORT, self.OnSaveAs) |
409 |
EVT_KEY_DOWN(self.grid, self.OnKeyDown) |
EVT_KEY_DOWN(self.grid, self.OnKeyDown) |