def apply_matches(self, match_tuple): matched_refs, matched_paths, dirs = match_tuple QStandardItem = QtGui.QStandardItem dir_icon = icons.directory() git_icon = icons.cola() items = [] for ref in matched_refs: item = QStandardItem() item.setText(ref) item.setIcon(git_icon) items.append(item) from_filename = icons.from_filename for match in matched_paths: item = QStandardItem() item.setText(match) if match in dirs: item.setIcon(dir_icon) else: item.setIcon(from_filename(match)) items.append(item) self.clear() self.invisibleRootItem().appendRows(items) self.emit(SIGNAL('updated()'))
def __init__(self, path, is_dir): QtGui.QStandardItem.__init__(self) self.is_dir = is_dir self.path = path self.setEditable(False) self.setDragEnabled(False) self.setText(utils.basename(path)) if is_dir: icon = icons.directory() else: icon = icons.file_text() self.setIcon(icon)
def __init__(self, parent): QtGui.QStandardItemModel.__init__(self, parent) self.entries = {} self._interesting_paths = set() self._interesting_files = set() self._known_paths = set() self._dir_entries= {} self._dir_rows = collections.defaultdict(int) self.connect(self, SIGNAL('updated()'), self.refresh, Qt.QueuedConnection) model = main.model() model.add_observer(model.message_updated, self._model_updated) self.file_icon = icons.file_text() self.dir_icon = icons.directory()
def __init__(self, parent): QtGui.QStandardItemModel.__init__(self, parent) self.entries = {} self._interesting_paths = set() self._interesting_files = set() self._known_paths = set() self._dir_entries = {} self._dir_rows = collections.defaultdict(int) self.connect(self, SIGNAL('updated()'), self.refresh, Qt.QueuedConnection) model = main.model() model.add_observer(model.message_updated, self._model_updated) self.file_icon = icons.file_text() self.dir_icon = icons.directory()