mirror of
https://github.com/gmbrax/Pilgrim.git
synced 2026-11-09 17:20:17 +00:00
add the backup feature
This commit is contained in:
parent
4aca171ce3
commit
f62ecc18f7
@@ -14,6 +14,8 @@ from pilgrim.ui.screens.edit_diary_modal import EditDiaryModal
|
||||
from pilgrim.ui.screens.new_diary_modal import NewDiaryModal
|
||||
from pilgrim.ui.screens.edit_entry_screen import EditEntryScreen
|
||||
|
||||
from pilgrim.service.backup_service import BackupService
|
||||
|
||||
|
||||
class DiaryListScreen(Screen):
|
||||
TITLE = "Pilgrim - Main"
|
||||
@@ -298,3 +300,13 @@ class DiaryListScreen(Screen):
|
||||
self.notify("Invalid diary ID")
|
||||
else:
|
||||
self.notify("Select a diary to open the settings")
|
||||
|
||||
|
||||
def action_backup(self):
|
||||
session = self.app.service_manager.get_session()
|
||||
backup_service = BackupService(session)
|
||||
if session:
|
||||
result = backup_service.create_backup()
|
||||
else:
|
||||
self.notify("You must be logged in to perform this action")
|
||||
self.notify(f"Backup result: {result}")
|
||||
|
||||
@@ -37,6 +37,11 @@ class UIApp(App):
|
||||
"Open About Pilgrim",
|
||||
screen.action_about_cmd
|
||||
)
|
||||
yield SystemCommand(
|
||||
"Backup Database",
|
||||
"Backup the Database",
|
||||
screen.action_backup
|
||||
)
|
||||
|
||||
elif isinstance(screen, AboutScreen):
|
||||
yield SystemCommand(
|
||||
|
||||
Reference in New Issue
Block a user