/[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 939 by jonathan, Tue May 20 15:25:22 2003 UTC revision 966 by jonathan, Wed May 21 17:24:40 2003 UTC
# Line 132  class TableGrid(wxGrid, Publisher): Line 132  class TableGrid(wxGrid, Publisher):
132    
133          self.SetSelectionMode(wxGrid.wxGridSelectRows)          self.SetSelectionMode(wxGrid.wxGridSelectRows)
134    
135          EVT_GRID_RANGE_SELECT(self, self.OnRangeSelect)          #EVT_GRID_RANGE_SELECT(self, None)
136          EVT_GRID_SELECT_CELL(self, self.OnSelectCell)          #EVT_GRID_SELECT_CELL(self, None)
137            #EVT_GRID_RANGE_SELECT(self, self.OnRangeSelect)
138            #EVT_GRID_SELECT_CELL(self, self.OnSelectCell)
139    
140            self.ToggleEventListeners(True)
141    
142      def SetTableObject(self, table):      def SetTableObject(self, table):
143          self.table.SetTable(table)          self.table.SetTable(table)
# Line 156  class TableGrid(wxGrid, Publisher): Line 160  class TableGrid(wxGrid, Publisher):
160          self.issue(ROW_SELECTED, self.GetSelectedRows())          self.issue(ROW_SELECTED, self.GetSelectedRows())
161          event.Skip()          event.Skip()
162    
163        def ToggleEventListeners(self, on):
164            if on:
165                EVT_GRID_RANGE_SELECT(self, self.OnRangeSelect)
166                EVT_GRID_SELECT_CELL(self, self.OnSelectCell)
167            else:
168                EVT_GRID_RANGE_SELECT(self, None)
169                EVT_GRID_SELECT_CELL(self, None)
170                
171      def disallow_messages(self):      def disallow_messages(self):
172          """Disallow messages to be send.          """Disallow messages to be send.
173    
# Line 318  class LayerTableFrame(TableFrame): Line 330  class LayerTableFrame(TableFrame):
330    
331          choice = self.choice_action.GetSelection()          choice = self.choice_action.GetSelection()
332                            
333            #
334            # what used to be nice code got became a bit ugly because
335            # each time we select a row a message is sent to the grid
336            # which we are listening for and then we send further
337            # messages.
338            #
339            # now, we disable those listeners select everything but
340            # the first item, reenable the listeners, and select
341            # the first element, which causes everything to be
342            # updated properly.
343            #
344            self.grid.ToggleEventListeners(False)
345    
346          if choice == 0:          if choice == 0:
347              # Replace Selection              # Replace Selection
348              self.grid.ClearSelection()              self.grid.ClearSelection()
             for id in ids:  
                 self.grid.SelectRow(id, True)  
349          elif choice == 1:          elif choice == 1:
350              # Refine Selection              # Refine Selection
351              sel = dict([(i, 0) for i in self.parent.SelectedShapes()])              sel = dict([(i, 0) for i in self.parent.SelectedShapes()])
352              self.grid.ClearSelection()              self.grid.ClearSelection()
353              for id in filter(sel.has_key, ids):              ids = filter(sel.has_key, ids)
                 self.grid.SelectRow(id, True)  
354          elif choice == 2:          elif choice == 2:
355              # Add to Selection              # Add to Selection
356              for id in ids:              pass
357    
358            #
359            # select the rows (all but the first)
360            #
361            firsttime = True
362            for id in ids:
363                if firsttime:
364                    firsttime = False
365                else:
366                  self.grid.SelectRow(id, True)                  self.grid.SelectRow(id, True)
367    
368            self.grid.ToggleEventListeners(True)
369    
370            #
371            # select the first row
372            #
373            if ids:
374                self.grid.SelectRow(ids[0], True)
375    
376          wxEndBusyCursor()          wxEndBusyCursor()
377                    
378      def OnSaveAs(self, event):      def OnSaveAs(self, event):

Legend:
Removed from v.939  
changed lines
  Added in v.966

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26