Exemple #1
0
    def on_toggle_archive(self, action: Gio.SimpleAction, name: str = None):
        show_archived = self.header.archived_button.get_active()
        self.document_grid.show_archived = show_archived
        self.document_grid.reload_items()

        self.toggle_welcome(
            not show_archived
            and storage.count(with_archived=show_archived) == 0)
Exemple #2
0
    def check_documents_count(self) -> None:
        """Check for documents count in storage and switch between screens
        whether there is at least one document or not.

        """
        if storage.count() > 0:
            self.screens.set_visible_child_name('document-grid')

            last_doc_id = self.settings.get_int('last-document-id')
            if last_doc_id and last_doc_id != -1:
                self.screens.set_visible_child_name('editor-grid')
                self.editor.load_document(last_doc_id)
                self.header.toggle_document_mode()
                self.header.update_title(title=self.editor.document.title)
        else:
            self.toggle_welcome(True)