Beispiel #1
0
    def reload_history(self, emit_signal=True):
        self.reset_filter(emit_signal=False)
        self._raw_history = gpaste_client.get_raw_history()

        if len(self._raw_history) == 0:
            self.clear()
            return None

        new_list = []
        new_items = []

        for index, raw in enumerate(self._raw_history):
            uuid = raw[0]
            old_item = self._get_by_uuid(uuid)

            if old_item:
                new_list.append(old_item)
            else:
                new_item = HistoryItem(index, uuid)
                new_items.append(new_item)

        new_list.extend(new_items)
        self._sync_index()
        self._items = sorted(new_list, key=lambda e: e.index)
        if emit_signal: self.emit('changed')
Beispiel #2
0
    def _on_update(self, action, target, position):
        self._raw_history = gpaste_client.get_raw_history()

        if action == gpaste_client.Action.REPLACE:
            if target == gpaste_client.Target.ALL:
                self.reload_history()
            elif target == gpaste_client.Target.POSITION:
                self.reload_item(position)
            else:
                pass
        elif action == gpaste_client.Action.REMOVE:
            if target == gpaste_client.Target.ALL:
                self.clear()
            elif target == gpaste_client.Target.POSITION:
                self.remove(position)
        else:
            pass
Beispiel #3
0
    def _on_update(self, action, target, position):
        self._raw_history = gpaste_client.get_raw_history()

        if action == gpaste_client.Action.REPLACE:
            if target == gpaste_client.Target.ALL:
                self.reload_history()
            elif target == gpaste_client.Target.POSITION:
                self.reload_item(position)
            else:
                pass
        elif action == gpaste_client.Action.REMOVE:
            if target == gpaste_client.Target.ALL:
                self.clear()
            elif target == gpaste_client.Target.POSITION:
                self.remove(position)
        else:
            pass
Beispiel #4
0
    def reload_history(self, emit_signal=True):
        self.reset_filter(emit_signal=False)
        self._raw_history = gpaste_client.get_raw_history()

        if len(self._raw_history) == 0:
            self.clear()
            return None

        new_list = []
        new_items = []

        for index, raw in enumerate(self._raw_history):
            old_item = self._get_by_raw(raw)

            if old_item:
                new_list.append(old_item)
            else: 
                new_item = HistoryItem(index)
                new_items.append(new_item)

        new_list.extend(new_items)
        self._sync_index()
        self._items = sorted(new_list, key=lambda e: e.index)
        if emit_signal: self.emit('changed')