diff --git a/borg_qt/config.py b/borg_qt/config.py index 86328cd..9226f4d 100644 --- a/borg_qt/config.py +++ b/borg_qt/config.py @@ -122,6 +122,10 @@ class Config(QDialog): def schedule_predefined_name(self): return self._return_single_option('schedule_predefined_name') + @property + def hide_help(self): + return util.strtobool(self._return_single_option('hide_help')) + def _return_single_option(self, option): """Gets the provided option from the configparser object.""" if option in self.config['borgqt']: diff --git a/borg_qt/help.py b/borg_qt/help.py new file mode 100644 index 0000000..4e39c48 --- /dev/null +++ b/borg_qt/help.py @@ -0,0 +1,19 @@ +import os + +from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import QDialog +from PyQt5 import uic +from PyQt5.QtGui import QIcon, QPixmap + + +class Help(QDialog): + """A class to display the help dialog.""" + + def __init__(self): + super(QDialog, self).__init__() + # Load the UI file to get the dialogs layout. + dir_path = os.path.dirname(os.path.realpath(__file__)) + ui_path = os.path.join(dir_path + '/static/UI/Help.ui') + uic.loadUi(ui_path, self) + + self.button_box.accepted.connect(self.accept) diff --git a/borg_qt/main_window.py b/borg_qt/main_window.py index 026aabb..26091ba 100644 --- a/borg_qt/main_window.py +++ b/borg_qt/main_window.py @@ -9,6 +9,7 @@ from PyQt5.QtWidgets import (QMainWindow, QFileSystemModel, QFileDialog, from config import Config from helper import (BorgException, show_error, convert_size, open_path, create_path, remove_path, check_path) +from help import Help import borg_interface as borg from progress import ProgressDialog @@ -56,6 +57,7 @@ class MainWindow(QMainWindow): self.action_restore.triggered.connect(self.restore_backup) self.action_delete.triggered.connect(self.delete_backup) self.action_mount.triggered.connect(self.mount_backup) + self.action_help.triggered.connect(self.show_help) def start(self): """This method is intendet to be used only once at the application @@ -63,6 +65,11 @@ class MainWindow(QMainWindow): environment variables.""" try: self.config.read() + # show the help window if needed and save it's answer + if not self.config.hide_help: + self.config.config['borgqt']['hide_help'] = ( + str(self.show_help())) + self.config.write() self.config._set_environment_variables() self._update_archives() self._update_repository_stats() @@ -136,6 +143,13 @@ class MainWindow(QMainWindow): self, "Select Directory", os.getenv('HOME'))) return folder_name + def show_help(self): + """Diplays the help dialog with some informations about the + application.""" + help_window = Help() + help_window.exec_() + return help_window.check_hide_enabled.isChecked() + @property def selected_archive(self): return self.list_archive.currentItem().text() diff --git a/borg_qt/static/UI/Help.ui b/borg_qt/static/UI/Help.ui new file mode 100644 index 0000000..deaceb8 --- /dev/null +++ b/borg_qt/static/UI/Help.ui @@ -0,0 +1,454 @@ + + + Dialog + + + + 0 + 0 + 1088 + 809 + + + + Dialog + + + + + 350 + 770 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + true + + + + + + 20 + 770 + 211 + 21 + + + + Don't show this window again. + + + + + + 273 + 10 + 802 + 738 + + + + + + + main_window.png + + + + + + 10 + 10 + 251 + 741 + + + + + QLayout::SetMaximumSize + + + + + + 230 + 20 + + + + + 75 + true + + + + 1. Filetree + + + + + + + + 230 + 650 + + + + false + + + The file tree displays your current files on your computer. It doesn't show the content of the selected archive. + + + true + + + + + + + + 230 + 20 + + + + + 75 + true + + + + 2. Backup Button + + + + + + + + 230 + 650 + + + + After you selected a file or folder in the file tree you can create a backup from it by clicking on the "Backup" button. + + + true + + + + + + + + 230 + 20 + + + + + 75 + true + + + + 3. Archive List + + + + + + + + 230 + 65 + + + + Once an action like "Backup" or "Delete" completes the archive list gets updated. + + + true + + + + + + + + 230 + 20 + + + + + 75 + true + + + + 4. Repository Details + + + + + + + + 230 + 65 + + + + In addition the repository details will update and display the current statistic about the repository's size. + + + true + + + + + + + + 230 + 20 + + + + + 75 + true + + + + 5. Restore/Delete Button + + + + + + + + 230 + 65 + + + + Select an archive from the list (3) and click on "Restore" to restore it to a location of your choice or click on "Delete" to remove it. + + + true + + + + + + + + 230 + 20 + + + + + 75 + true + + + + 6. Mount Button + + + + + + + + 230 + 65 + + + + The "Mount" button let's you mount the selected archive as read only directory. This is a great way to restore a few files by hand. + + + true + + + + + + + + 230 + 20 + + + + + 75 + true + + + + 7. Settings Button + + + + + + + + 230 + 65 + + + + Let's you customise the settings of Borg-Qt like which files to backup or exclude or a schedule for automatic backups. + + + true + + + + + + + + 230 + 20 + + + + + 75 + true + + + + 8. Help Button + + + + + + + + 230 + 65 + + + + Diplays this window again. + + + true + + + + + + + + + 5 + 10 + 260 + 738 + + + + + 260 + 738 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 273 + 10 + 802 + 738 + + + + + 802 + 738 + + + + + 802 + 738 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + frame_text + button_box + check_hide_enabled + label_image + verticalLayoutWidget + frame_image + + + + + button_box + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + button_box + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/borg_qt/static/UI/main_window.png b/borg_qt/static/UI/main_window.png new file mode 100644 index 0000000..766736d Binary files /dev/null and b/borg_qt/static/UI/main_window.png differ diff --git a/docs/help_main_window.svg b/docs/help_main_window.svg new file mode 100644 index 0000000..47c4a1a --- /dev/null +++ b/docs/help_main_window.svg @@ -0,0 +1,1763 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + 1 + + + 3 + + 2 + + 5 + + 6 + + 5 + + 7 + + 8 + + 4 + +