/[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 1096 by jan, Thu May 29 10:03:07 2003 UTC revision 1104 by jonathan, Fri May 30 06:29:54 2003 UTC
# Line 393  class QueryTableFrame(TableFrame): Line 393  class QueryTableFrame(TableFrame):
393    
394      def OnQuery(self, event):      def OnQuery(self, event):
395          wxBeginBusyCursor()          wxBeginBusyCursor()
396            try:
397    
398          if self.combo_value.GetSelection() < 1:              if self.combo_value.GetSelection() < 1:
399              value = self.combo_value.GetValue()                  value = self.combo_value.GetValue()
         else:  
             value = self.table.Column(self.combo_value.GetValue())  
   
         ids = self.table.SimpleQuery(  
                 self.table.Column(self.combo_fields.GetStringSelection()),  
                 self.choice_comp.GetStringSelection(),  
                 value)  
   
         choice = self.choice_action.GetSelection()  
               
         #  
         # what used to be nice code got became a bit ugly because  
         # each time we select a row a message is sent to the grid  
         # which we are listening for and then we send further  
         # messages.  
         #  
         # now, we disable those listeners select everything but  
         # the first item, reenable the listeners, and select  
         # the first element, which causes everything to be  
         # updated properly.  
         #  
         self.grid.ToggleEventListeners(False)  
   
         if choice == 0:  
             # Replace Selection  
             self.grid.ClearSelection()  
         elif choice == 1:  
             # Refine Selection  
             sel = self.get_selected()  
             self.grid.ClearSelection()  
             ids = filter(sel.has_key, ids)  
         elif choice == 2:  
             # Add to Selection  
             pass  
   
         #  
         # select the rows (all but the first)  
         #  
         firsttime = True  
         for id in ids:  
             if firsttime:  
                 firsttime = False  
400              else:              else:
401                  self.grid.SelectRow(id, True)                  value = self.table.Column(self.combo_value.GetValue())
402    
403          self.grid.ToggleEventListeners(True)              ids = self.table.SimpleQuery(
404                        self.table.Column(self.combo_fields.GetStringSelection()),
405                        self.choice_comp.GetStringSelection(),
406                        value)
407    
408          #              choice = self.choice_action.GetSelection()
409          # select the first row              
410          #              #
411          if ids:              # what used to be nice code got became a bit ugly because
412              self.grid.SelectRow(ids[0], True)              # each time we select a row a message is sent to the grid
413                # which we are listening for and then we send further
414          wxEndBusyCursor()              # messages.
415                #
416                # now, we disable those listeners select everything but
417                # the first item, reenable the listeners, and select
418                # the first element, which causes everything to be
419                # updated properly.
420                #
421                self.grid.ToggleEventListeners(False)
422    
423                if choice == 0:
424                    # Replace Selection
425                    self.grid.ClearSelection()
426                elif choice == 1:
427                    # Refine Selection
428                    sel = self.get_selected()
429                    self.grid.ClearSelection()
430                    ids = filter(sel.has_key, ids)
431                elif choice == 2:
432                    # Add to Selection
433                    pass
434    
435                #
436                # select the rows (all but the first)
437                #
438                firsttime = True
439                for id in ids:
440                    if firsttime:
441                        firsttime = False
442                    else:
443                        self.grid.SelectRow(id, True)
444    
445                self.grid.ToggleEventListeners(True)
446    
447                #
448                # select the first row
449                #
450                if ids:
451                    self.grid.SelectRow(ids[0], True)
452            finally:
453                wxEndBusyCursor()
454                    
455      def OnSaveAs(self, event):      def OnSaveAs(self, event):
456          dlg = wxFileDialog(self, _("Export Table To"), ".", "",          dlg = wxFileDialog(self, _("Export Table To"), ".", "",

Legend:
Removed from v.1096  
changed lines
  Added in v.1104

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26