def _formatHeader(self, text): """Format current directory for show it in the list of completions """ return '<font style="background-color: %s; color: %s">%s</font>' % \ (qApp.palette().color(QPalette.Window).name(), qApp.palette().color(QPalette.WindowText).name(), htmlEscape(text))
def __init__(self, project = None, variables = None, parent_widget = None): ''' @param parent_widget parent widget for the model @param variables_dict dictionary of initial variable data ''' QAbstractTableModel.__init__(self, parent_widget) self.project = project self.all_variables = variables self.variables = self.all_variables or [] self.headers = ["Name", "Dataset", "Use", "Type", "Definition"] # mapping of columns -> keys (index of the key is the index of the column) self.keys = ('name', 'dataset', 'use', 'source', 'definition') self.parent_widget = parent_widget self.sorted_by_column = 1 self.sorting_order = Qt.AscendingOrder self.dirty = False self.palette = qApp.palette() # for system-coherent selection colors self.filtered_variable_set = None self.emit(SIGNAL('layoutChanged()'))