/[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 6 by bh, Tue Aug 28 15:41:52 2001 UTC revision 30 by bh, Thu Sep 6 13:31:57 2001 UTC
# Line 13  from wxPython.grid import * Line 13  from wxPython.grid import *
13  from Thuban.Model.table import FIELDTYPE_INT, FIELDTYPE_DOUBLE, \  from Thuban.Model.table import FIELDTYPE_INT, FIELDTYPE_DOUBLE, \
14       FIELDTYPE_STRING       FIELDTYPE_STRING
15  import view  import view
16    from dialogs import NonModalDialog
17  from messages import SELECTED_SHAPE  from messages import SELECTED_SHAPE
18    
19  wx_value_type_map = {FIELDTYPE_INT: wxGRID_VALUE_NUMBER,  wx_value_type_map = {FIELDTYPE_INT: wxGRID_VALUE_NUMBER,
# Line 95  class DataTable(wxPyGridTableBase): Line 96  class DataTable(wxPyGridTableBase):
96          return interactor.SelectShape(self.table, row)          return interactor.SelectShape(self.table, row)
97    
98    
   
   
   
99  class TableGrid(wxGrid):  class TableGrid(wxGrid):
100    
101      def __init__(self, parent, table = None):      def __init__(self, parent, table = None):
# Line 118  class TableGrid(wxGrid): Line 116  class TableGrid(wxGrid):
116                    
117          EVT_GRID_RANGE_SELECT(self, self.OnRangeSelect)          EVT_GRID_RANGE_SELECT(self, self.OnRangeSelect)
118          EVT_GRID_SELECT_CELL(self, self.OnSelectCell)          EVT_GRID_SELECT_CELL(self, self.OnSelectCell)
         import main  
         main.app.interactor.Subscribe(SELECTED_SHAPE, self.select_shape)  
119    
120      def SetTableObject(self, table):      def SetTableObject(self, table):
121          self.table.SetTable(table)          self.table.SetTable(table)
# Line 134  class TableGrid(wxGrid): Line 130  class TableGrid(wxGrid):
130              event.Skip()              event.Skip()
131    
132      def select_shape(self, layer, shape):      def select_shape(self, layer, shape):
133          if layer is not None and layer.table is self.table.table:          if layer is not None and layer.table is self.table.table \
134               and shape is not None:
135              self.SelectRow(shape)              self.SelectRow(shape)
136              self.SetGridCursor(shape, 0)              self.SetGridCursor(shape, 0)
137              self.MakeCellVisible(shape, 0)              self.MakeCellVisible(shape, 0)
138    
139    
140  class TableFrame(wxFrame):  class TableFrame(NonModalDialog):
141    
142      def __init__(self, parent, table = None):      def __init__(self, parent, interactor, name, title, table = None):
143          wxFrame.__init__(self, parent, -1, "Thuban Table")          NonModalDialog.__init__(self, parent, interactor, name, title)
144          grid = TableGrid(self, table)          self.grid = TableGrid(self, table)
145            self.interactor.Subscribe(SELECTED_SHAPE, self.select_shape)
146    
147        def OnClose(self, event):
148            self.interactor.Unsubscribe(SELECTED_SHAPE, self.select_shape)
149            NonModalDialog.OnClose(self, event)
150    
151        def select_shape(self, layer, shape):
152            self.grid.select_shape(layer, shape)

Legend:
Removed from v.6  
changed lines
  Added in v.30

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26