예제 #1
0
파일: browser.py 프로젝트: RumovZ/anki
    def on_operation_did_execute(self, changes: OpChanges,
                                 handler: object | None) -> None:
        focused = current_window() == self
        self.table.op_executed(changes, handler, focused)
        self.sidebar.op_executed(changes, handler, focused)
        if changes.note_text:
            if handler is not self.editor:
                # fixme: this will leave the splitter shown, but with no current
                # note being edited
                note = self.editor.note
                if note:
                    try:
                        note.load()
                    except NotFoundError:
                        self.editor.set_note(None)
                        return
                    self.editor.set_note(note)

        if changes.browser_table and changes.card:
            self.card = self.table.get_single_selected_card()
            self.current_card = self.table.get_current_card()
            self._update_card_info()
            self._update_current_actions()

        # changes.card is required for updating flag icon
        if changes.note_text or changes.card:
            self._renderPreview()
예제 #2
0
파일: browser.py 프로젝트: mark-stone/anki
    def on_operation_did_execute(self, changes: OpChanges,
                                 handler: Optional[object]) -> None:
        focused = current_window() == self
        self.table.op_executed(changes, handler, focused)
        self.sidebar.op_executed(changes, handler, focused)
        if changes.editor:
            if handler is not self.editor:
                # fixme: this will leave the splitter shown, but with no current
                # note being edited
                note = self.editor.note
                if note:
                    try:
                        note.load()
                    except NotFoundError:
                        self.editor.set_note(None)
                        return
                    self.editor.set_note(note)

            self._renderPreview()

        if changes.browser_table and changes.card:
            self.card = self.table.get_current_card()
            self._update_context_actions()
예제 #3
0
파일: browser.py 프로젝트: RumovZ/anki
 def on_focus_change(self, new: QWidget | None,
                     old: QWidget | None) -> None:
     if current_window() == self:
         self.setUpdatesEnabled(True)
         self.table.redraw_cells()
         self.sidebar.refresh_if_needed()