Changeset 1188

Show
Ignore:
Timestamp:
03/13/10 16:53:14 (5 months ago)
Author:
erikj
Message:

only load expanded search control when needed

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/camelot/view/controls/tableview.py

    r1187 r1188  
    129129            self.number_of_rows = None 
    130130        layout.addLayout( widget_layout ) 
     131        self._expanded_filters_created = False 
    131132        self._expanded_search = QtGui.QWidget() 
    132133        self._expanded_search.hide() 
     
    135136        self.setSizePolicy( QSizePolicy.Minimum, QSizePolicy.Fixed ) 
    136137        self.setNumberOfRows( 0 ) 
    137         post( admin.get_columns, self._fill_expanded_search_options ) 
     138         
    138139     
    139140    def _fill_expanded_search_options(self, columns): 
     
    147148        layout.addStretch() 
    148149        self._expanded_search.setLayout( layout ) 
     150        self._expanded_filters_created = True 
    149151         
    150152    def _filter_changed(self): 
     
    160162    def expand_search_options(self): 
    161163        if self._expanded_search.isHidden(): 
     164            if not self._expanded_filters_created: 
     165                post( self._admin.get_columns, self._fill_expanded_search_options ) 
    162166            self._expanded_search.show() 
    163167        else: 
     
    259263        shortcut = QtGui.QShortcut(QtGui.QKeySequence(QtGui.QKeySequence.Find), self) 
    260264        self.connect( shortcut, QtCore.SIGNAL( 'activated()' ), self.activate_search ) 
    261         self.connect( self.header, QtCore.SIGNAL('filters_changed'),  self.rebuildQuery ) 
     265        if self.header_widget: 
     266            self.connect( self.header, QtCore.SIGNAL('filters_changed'),  self.rebuildQuery ) 
    262267        # give the table widget focus to prevent the header and its search control to 
    263268        # receive default focus, as this would prevent the displaying of 'Search...' in the