/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/tableview.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/tableview.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1199 by jonathan, Fri Jun 13 15:04:28 2003 UTC revision 1276 by jonathan, Fri Jun 20 17:46:34 2003 UTC
# Line 22  from dialogs import ThubanFrame Line 22  from dialogs import ThubanFrame
22    
23  from messages import SHAPES_SELECTED, SESSION_REPLACED  from messages import SHAPES_SELECTED, SESSION_REPLACED
24  from Thuban.Model.messages import TABLE_REMOVED, MAP_LAYERS_REMOVED  from Thuban.Model.messages import TABLE_REMOVED, MAP_LAYERS_REMOVED
25    from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor
26    
27  wx_value_type_map = {FIELDTYPE_INT: wxGRID_VALUE_NUMBER,  wx_value_type_map = {FIELDTYPE_INT: wxGRID_VALUE_NUMBER,
28                       FIELDTYPE_DOUBLE: wxGRID_VALUE_FLOAT,                       FIELDTYPE_DOUBLE: wxGRID_VALUE_FLOAT,
# Line 256  class LayerTableGrid(TableGrid): Line 257  class LayerTableGrid(TableGrid):
257          nothing. If shape or layer is None also do nothing.          nothing. If shape or layer is None also do nothing.
258          """          """
259          if layer is not None \          if layer is not None \
260              and layer.table is self.table.table:              and layer.ShapeStore().Table() is self.table.table:
261    
262              self.disallow_messages()              self.disallow_messages()
263              try:              try:
# Line 285  class TableFrame(ThubanFrame): Line 286  class TableFrame(ThubanFrame):
286    
287      def __init__(self, parent, name, title, table):      def __init__(self, parent, name, title, table):
288          ThubanFrame.__init__(self, parent, name, title)          ThubanFrame.__init__(self, parent, name, title)
289            self.panel = wxPanel(self, -1)
290    
291          self.table = table          self.table = table
292          self.grid = self.make_grid(self.table)          self.grid = self.make_grid(self.table)
293          self.app = self.parent.application          self.app = self.parent.application
# Line 292  class TableFrame(ThubanFrame): Line 295  class TableFrame(ThubanFrame):
295          self.session = self.app.Session()          self.session = self.app.Session()
296          self.session.Subscribe(TABLE_REMOVED, self.close_on_table_removed)          self.session.Subscribe(TABLE_REMOVED, self.close_on_table_removed)
297    
298    
299      def make_grid(self, table):      def make_grid(self, table):
300          """Return the table grid to use in the frame.          """Return the table grid to use in the frame.
301    
# Line 339  class QueryTableFrame(TableFrame): Line 343  class QueryTableFrame(TableFrame):
343      def __init__(self, parent, name, title, table):      def __init__(self, parent, name, title, table):
344          TableFrame.__init__(self, parent, name, title, table)          TableFrame.__init__(self, parent, name, title, table)
345    
346          self.combo_fields = wxComboBox(self, -1, style=wxCB_READONLY)          self.combo_fields = wxComboBox(self.panel, -1, style=wxCB_READONLY)
347          self.choice_comp = wxChoice(self, -1,          self.choice_comp = wxChoice(self.panel, -1,
348                                choices=["<", "<=", "==", "!=", ">=", ">"])                                choices=["<", "<=", "==", "!=", ">=", ">"])
349          self.combo_value = wxComboBox(self, ID_COMBOVALUE)          self.combo_value = wxComboBox(self.panel, ID_COMBOVALUE)
350          self.choice_action = wxChoice(self, -1,          self.choice_action = wxChoice(self.panel, -1,
351                                  choices=[_("Replace Selection"),                                  choices=[_("Replace Selection"),
352                                          _("Refine Selection"),                                          _("Refine Selection"),
353                                          _("Add to Selection")])                                          _("Add to Selection")])
354    
355          button_query = wxButton(self, ID_QUERY, _("Query"))          button_query = wxButton(self.panel, ID_QUERY, _("Query"))
356          button_saveas = wxButton(self, ID_EXPORT, _("Export"))          button_saveas = wxButton(self.panel, ID_EXPORT, _("Export"))
357    
358          self.CreateStatusBar()          self.CreateStatusBar()
         self.SetStatusText(_("0 rows (0 selected), 0 columns"))  
359    
360          self.grid.SetSize((400, 200))          self.grid.SetSize((400, 200))
361    
# Line 368  class QueryTableFrame(TableFrame): Line 371  class QueryTableFrame(TableFrame):
371          self.choice_action.SetSelection(0)          self.choice_action.SetSelection(0)
372          self.choice_comp.SetSelection(0)          self.choice_comp.SetSelection(0)
373    
374            self.grid.Reparent(self.panel)
375    
376            self.UpdateStatusText()
377    
378          topBox = wxBoxSizer(wxVERTICAL)          topBox = wxBoxSizer(wxVERTICAL)
379    
380          sizer = wxStaticBoxSizer(wxStaticBox(self, -1,          sizer = wxStaticBoxSizer(wxStaticBox(self.panel, -1,
381                                    _("Selection")),                                    _("Selection")),
382                                    wxHORIZONTAL)                                    wxHORIZONTAL)
383          sizer.Add(self.combo_fields, 1, wxEXPAND|wxALL, 4)          sizer.Add(self.combo_fields, 1, wxEXPAND|wxALL, 4)
# Line 384  class QueryTableFrame(TableFrame): Line 391  class QueryTableFrame(TableFrame):
391          topBox.Add(sizer, 0, wxEXPAND|wxALL, 4)          topBox.Add(sizer, 0, wxEXPAND|wxALL, 4)
392          topBox.Add(self.grid, 1, wxEXPAND|wxALL, 0)          topBox.Add(self.grid, 1, wxEXPAND|wxALL, 0)
393    
394            self.panel.SetAutoLayout(True)
395            self.panel.SetSizer(topBox)
396            topBox.Fit(self.panel)
397            topBox.SetSizeHints(self.panel)
398    
399            panelSizer = wxBoxSizer(wxVERTICAL)
400            panelSizer.Add(self.panel, 1, wxEXPAND, 0)
401          self.SetAutoLayout(True)          self.SetAutoLayout(True)
402          self.SetSizer(topBox)          self.SetSizer(panelSizer)
403          topBox.Fit(self)          panelSizer.Fit(self)
404          topBox.SetSizeHints(self)          panelSizer.SetSizeHints(self)
405    
406          self.grid.SetFocus()          self.grid.SetFocus()
407    
408          EVT_BUTTON(self, ID_QUERY, self.OnQuery)          EVT_BUTTON(self, ID_QUERY, self.OnQuery)
409          EVT_BUTTON(self, ID_EXPORT, self.OnSaveAs)          EVT_BUTTON(self, ID_EXPORT, self.OnSaveAs)
410          EVT_KEY_DOWN(self.grid, self.OnKeyDown)          EVT_KEY_DOWN(self.grid, self.OnKeyDown)
# Line 419  class QueryTableFrame(TableFrame): Line 434  class QueryTableFrame(TableFrame):
434              event.Skip()              event.Skip()
435    
436      def OnQuery(self, event):      def OnQuery(self, event):
437          wxBeginBusyCursor()          ThubanBeginBusyCursor()
438          try:          try:
439    
440              text = self.combo_value.GetValue()              text = self.combo_value.GetValue()
# Line 481  class QueryTableFrame(TableFrame): Line 496  class QueryTableFrame(TableFrame):
496                  self.grid.SelectRow(ids[0], True)                  self.grid.SelectRow(ids[0], True)
497    
498          finally:          finally:
499              wxEndBusyCursor()              ThubanEndBusyCursor()
500                    
501      def OnSaveAs(self, event):      def OnSaveAs(self, event):
502          dlg = wxFileDialog(self, _("Export Table To"), ".", "",          dlg = wxFileDialog(self, _("Export Table To"), ".", "",

Legend:
Removed from v.1199  
changed lines
  Added in v.1276

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26