* feat: add a setting for files list views
* separate logic from data class
* make mode optional
* rename display mode methods
* refactor
* move code above connect signals comment
* reorder code
---------
Co-authored-by: yfprojects <62463991+real-yfprojects@users.noreply.github.com>
Co-authored-by: Manu <3916435+m3nu@users.noreply.github.com>
Borg v1.2.4 added new change types called `mtime` and `ctime` for the modification and the creation time of a file.
Our diff json parser doesn't support these changes yet.
The plain text parser doesn't need to be updated since it is only used for earlier versions of borg.
This also extends the tooltip in the diff view to show changes in `ctime` or `mtime` in a localised manner.
* src/vorta/views/diff_result.py (ChangeType): Add `CTIME` and `MTIME` linking to `MODIFIED`.
* src/vorta/views/diff_result.py (DiffData): Add fields `ctime_change` and `mtime_change`.
* src/vorta/views/diff_result.py (parse_diff_json): Parse the new change types.
* src/vorta/views/diff_result.py (DiffTree.data): Add time changes to tooltip in a human readable format.
* tests/test_diff.py : Update test data to include new change types. Add additional test cases for unittesting the new change types.
* feat: add profile name to log messages
* update tests
* add profile name to all occurences of backup progress event emit
* update tests
* merge with logs link code
---------
Co-authored-by: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com>
Paramiko is a encryption key parsing library. It was used for determining which ssh keys are available on the system. This removes that fairly heavy dependency at replaces it with a very basic heuristic to determine ssh key file by their first line containing `-----BEGIN(\s\w+)? PRIVATE KEY-----`.
* src/vorta/utils.py: Implement `is_ssh_private_key_file`.
* src/vorta/utils.py (get_private_keys): Use `is_ssh_private_key_file` instead of paramiko. Enforce `077` permissions on key files.
* src/vorta/views/ssh_dialog.py : Remove paramiko.
* src/vorta/views/repo_tab.py (RepoTab.init_ssh): Show filename only in `sshComboBox`.
* src/vorta/views/repo_add_dialog.py (AddRepoWindow.init_ssh_key): Show filename only in `sshComboBox`.
In case a borg job finishes with warning, vorta will display it and tell the user to have a look in the logs. This adds a clickable link to the log message that opens the default file explorer at the log location.
* src/vorta/application.py (VortaApp.check_failed_response): Improve wording of warning message and link logs.
* src/vorta/borg/create.py (BorgCreateJob.process_result): Link logs.
* src/vorta/borg/compact.py (BorgCompactJob.finished_event): ^^
* src/vorta/borg/check.py (BorgCheckJob.finished_event): ^^
* src/vorta/assets/UI/mainwindow.ui : Enable `openExternalLinks` for `progressText` label.
Fixes#1610. Replace deprecated `appdirs` with fork `platformdirs`. Use the new `*_path` api of set fork. This changes the type of the constants defined in `vorta.config` holding locations to `pathlib.Path`.
* setup.cfg : Replace dep `appdirs` with `platformdirs`.
* src/vorta/config.py : Migrate. Simplify code for ensuring that the directories exist.
* src/vorta/log.py
* src/vorta/autostart.py
* src/vorta/application.py
* src/vorta/__main__.py
Log `An instance of Vorta is already running. Opening main window.` and `Creating backup using existing Vorta instance.` with severity *info* instead of printing it.
* src/vorta/application.py (VortaApp.__init__)
Fixes#1463. This makes the code count the database rows for the current profile only.
Previously one could run a backup without any sources when one had sources configured in a different profile.
* src/vorta/borg/create.py (BorgCreateJob.prepare)
This adds tooltips to the settings as well as a 'info' button that shows the tooltip when hovering over it.
* Add tooltips to settings.
* src/vorta/store/models.py (SettingsModel): Add `tooltip` column.
* src/vorta/store/migrations.py (run_migrations): Create `tooltip` column.
* src/vorta/store/connection.py (init_db): Populate `tooltip` column. Increase `SCHEMA_VERSION`.
* src/vorta/views/misc_tab.py (MiscTab.populate): Set tooltip of checkbox widgets.
* src/vorta/store/settings.py : Add tooltips and update label of `override_mount_permissions`
* Add *help* button to settings.
* src/vorta/assets/icons/help-about.svg: Add info icon.
* src/vorta/views/partials/tooltip_button.py: Implement `ToolTipButton`.
* src/vorta/views/misc_tab.py: Add `ToolTipButton` for each setting with a tooltip.
Add `set_icons` and connect it to palette change.
* tests/test_misc.py (test_autostart): Update test.
---------
Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com>
Use one size unit for all archives. The unit is selected by a simple algorithm that picks the largest unit that can represent the smallest size with a given precision. Align all sizes in archive and source tab to the left.
* src/vorta/utils.py : Implement `find_best_size_formatting`. Add missing sizes to `sort_sizes`. Simplify `pretty_bytes` and add `fixed_unit` option for use with `find_best_size_formatting`. Implement `clamp` utility function. Add type hints and docstrings.
* src/vorta/views/archive_tab.py (ArchiveTab.populate_from_profile): Use `find_best_sizes_formatting`.
* src/vorta/views/source_tab.py (SizeItem.__init__): Set alignment to left.
* tests/test_utils.py : Add comprehensive tests for `pretty_bytes` and `find_best_sizes_formatting`.
Co-authored-by: yfprojects <62463991+real-yfprojects@users.noreply.github.com>
Adds different behaviour when borg version >=1.2.2 but <2.0.0: The prune pattern is supplied without a style prefix like `sh:`.
Fixes#1564.
---------
Co-authored-by: herrwusel <herrwusel@user.noreply.github.com>
Co-authored-by: yfprojects <62463991+real-yfprojects@users.noreply.github.com>
* src/vorta/views/archive_tab.py : Move all command building logic into `mount.py`.
* src/vorta/borg/mount.py (BorgMountJob.prepare): Add command building logic previously in other places.
* src/vorta/borg/mount.py (BorgMountJob.prepare): Use `-a` command line option to select a single archive.
* src/vorta/utils.py (SHELL_PATTERN_ELEMENT): A pattern that can be used to detect shell pattern syntax.
* src/vorta/utils.py (get_mount_points): Implement parsing a borg v2 cmd.
* src/vorta/borg/umount.py (BorgUmountJob.prepare): Add parameters `mount_point` and optional `archive_name`.
Handle them correctly.
* src/vorta/views/archive_tab.py : Remove code that can now be found in `umount.py`.
Translate error messages returned by `BorgUmountJob.prepare`.
Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com>
Adjust available encryptions for borg v2.
Use `-r` for all/most commands. Implement `rinfo`.
Use `ssh://` style URL as a placeholder.
Implement compatibility for `borg extract`.
Adjust for beta3, use --match-archives for deletions
Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com>
Co-authored-by: Manu <manu@snapdragon.cc>
The menu is build ones before the tray icon is clicked so that it is registered correctly.
* src/vorta/tray_menu.py (TrayMenu): Rename `on_user_click` to `build_menu`.
* src/vorta/tray_menu.py (TrayMenu.__init__): Call `build_menu`.
Fixes the paste icon so that vorta can invert the its colour. Fixes#1556.
Updates icons in main window and source tab correctly when the colour palette changes.
* src/vorta/assets/icons/paste.svg : Remove fill of `path` item.
* src/vorta/views/source_tab.py : Connect `QApplication.paletteChange` to `set_icons`.
* src/vorta/views/main_window.py
Backups will run although no sources are specified if `--paths-from-command` is supplied.
Also arguments after `--` will be appended to the end of the command after all other arguments.
Closes#1537.
* src/vorta/borg/create.py
* tests/test_create.py : Add test for using `--path-from-commands`.
Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com>
Before a float was passed to `QPoint(int, int)`. While this worked fine, on some machines it lead to an error.
Fixes#1535.
* src/vorta/views/main_window.py : cast division value to int.
Start `borg check` with option `--progress` and handle the progress messages. Now the long repo check phase won't look like a freeze in vorta because vorta will show status updates. Fixes#1497.
Co-authored-by: yfprojects <62463991+real-yfprojects@users.noreply.github.com>
Schedules get missed, if system has been in hibernation/sleep state as
described in https://github.com/borgbase/vorta/issues/1214
Although, timers should be refreshed every 15min, it seems that all timers get
deranged by sleep state and schedules is still missed in most cases. This seems
to be a general issue with the underlying QTimer implementation.
This fix doesn't distinguish host OS and has only by tested on Linux.
If 'org.freedesktop.login1.Manager' is not available, Vorta simple doesn't
get notified if system awakes again. No no impact on other OS is expected
Co-authored-by: yfprojects <62463991+real-yfprojects@users.noreply.github.com>
Fixes#1488.
Closing deletes the temp file. This will be done by `BorgJob.run` after running the command.
* src/vorta/borg/extract.py (BorgExtractJob.prepare): Remove call to `close` of temporary file.
In python `+` takes precedence over the `if-else` operator.
Therefore brackets are needed around the latter.
* src/vorta/borg/list_archive.py (BorgListArchiveJob.prepare)
First element with index 0 is always the 'unset' option with data `None`.
* src/vorta/views/repo_tab.py (RepoTab.set_repos): Add element.
* src/vorta/views/repo_tab.py (RepoTab.repo_unlink_action): Handle the first element as unset.
* src/vorta/views/repo_tab.py (RepoTab.copy_URL_action): Handle unset state.
* tests/test_repo.py (test_repo_unlink): Fix test.
Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com>
This should help debugging #1304.
Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com>
Co-authored-by: Manu <3916435+m3nu@users.noreply.github.com>
* src/vorta/assets/UI/repotab.ui : Name `frameRepoSettings` and `layoutSSHKey`.
* src/vorta/views/repo_tab.py (RepoTab.init_repo_stats): Disable `frameRepoSettings` if no repo is selected.
Disable widgets in `layoutSSHKey` in case of a local repository except from `bAddSSHKey` so the
the user can add a key for a adding a repo.
Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com>
This adds trailing lines to files,
removes trailing white space in all the other lines and unifies line endings.
Additionally it formats the test code with `black`.
Adds a contextmenu and a simplified tree view mode, a button to collapse the tree
and the option to keep folders on top of the list.
* src/vorta/assets/UI/extractdialog.ui
* src/vorta/views/extract_dialog.py
* src/vorta/views/extract_dialog.py (ExtractFileItem): Add this variable holding the type
`FileSystemItem[FileData]`.
* src/vorta/views/extract_dialog.py: Add `ParseThread`, `ExtractTree` and `parse_json_lines`.
* src/vorta/views/extract_dialog.py (ExtractTree.__init__): Adjust signature.
* src/vorta/borg/list_archive.py (BorgListArchiveJob.prepare): Adjust format to
include additional attributes.
* src/vorta/views/archive_tab.py (ArchiveTab): Parse extract data using `ParseThread` and
open `ExtractDialog` afterwards.
* tests/test_archives.py (test_archive_extract): Update tests.
* src/vorta/borg/extract.py (BorgExtractJob.prepare): Adjust signature.
Handling of the data isn't implemented yet.
* tests/test_extract.py
* src/vorta/views/archive_tab.py (ArchiveTab.list_diff_result): Start `ParseThread` that does the processing and creates the dialog.
* src/vorta/views/archive_tab.py (ArchiveTab.show_diff_result): Implement method showing `DiffResultDialog`.
* src/vorta/views/diff_result.py (ParseThread): Move processing of diff results to this thread.
* src/vorta/assets/UI/diffresult.ui : Replace `okButton` with `QDialogButtonBox`
that has a `close` button.
* src/vorta/views/diff_result.py : Connect `buttonBox` instead of `okButton` to Dialog.
* src/vorta/assets/UI/diffresult.ui : Add title to `DiffResult` dialog and simplify file name display.
* src/vorta/assets/UI/diffresult.ui : Add comboBox to change display mode of tree view.
* src/vorta/views/diff_result.py : Connect comboBox to `DiffTree`.
* src/vorta/application.py : Remove `eventFilter` setup for palette changes.
* src/vorta/tray_menu.py : Connect directly to `app.paletteChanged`.
* src/vorta/views/archive_tab.py
* src/vorta/views/repo_tab.py
* src/vorta/views/schedule_tab.py
* src/vorta/views/source_tab.py
* src/vorta/assets/UI/diffresult.ui : Add buttons to keep folders on top when sorting and
to expand and collapse all items.
* src/vorta/views/diff_result.py : Connect the added buttons.
* src/vorta/assets/icons/angle-up-solid.svg : Add icon for `bCollapseAll`.
* src/vorta/views/diff_result.py : Add context menu to `treeView` that allows expanding
and copying of an item.
* src/vorta/views/diff_result.py : Add copy shortcut to `treeView`.
Subclass `treemodel.FileTreeModel` for the purposes of the diff dialog.
Rewrite diff output parsing.
Add sorting through `QSortFilterProxyModel`.
* src/vorta/views/diff_result.py (DiffResult.__init__): Remove doubled if statement.
* src/vorta/views/diff_result.py : Rename `DiffResult` to `DiffResultDialog`.
* src/vorta/views/diff_result.py (DiffTree.__init__): Remove the use of `QVariant`.
Since python has no type enforcement `QVariant` is not needed.
* src/vorta/views/diff_result.py (DiffTree): Subclass `treemodel.FileTreeModel` and add additional info tooltip.
* src/vorta/views/diff_result.py (parse_diff_json): Some changes for use with new model.
* src/vorta/views/diff_result.py (parse_diff_lines): Full regex based line parsing and
other modifications to go with the new model.
* src/vorta/views/diff_result.py (FileType): Enum of possible file types.
* src/vorta/views/diff_result.py (ChangeType): Enum of possible change types.
Currently all are mapped to `ADDED`, `MODIFIED` and `REMOVED`.
* src/vorta/views/diff_result.py (calc_size): Rename to `size_to_byte`.
* src/vorta/assets/UI/diffresult.ui : Move `alternatingRowColours` to the .ui file.
* src/vorta/views/diff_result.py (DiffResultDialog): Move `alternatingRowColours` to the .ui file.
* tests/test_diff.py : Fix tests for diff parser.
* src/vorta/views/diff_result.py : Connect to `sorted` of `DiffSortProxyModel`
to reveal selected items in view.
* src/vorta/views/partials/treemodel.py : Add `FileTreeSortProxyModel` with abstract code.
* src/vorta/views/diff_result.py (DiffSortProxyModel): Implement `FileTreeSortProxyModel`.
* src/vorta/views/diff_result.py (DiffItem): This variable holds the type `FileSystemItem[DiffData]`.
Previously the seconds of the current time or the last backup time were be copied. Fixes#1363.
This also fixes an issue when the scheduled time was missed and the backup is scheduled
for the current day although the time of day set has already passed.
* src/vorta/scheduler.py (VortaScheduler.set_timer_for_profile)
Currently an assert statement checks whether a change type was recognized.
This assert statement won't give any information on the actual change type that
is not implemented. Now a ValueError that mentiones the unknown change type in
its message will be raised instead.
* src/vorta/views/diff_result.py (parse_diff_json_lines): Replace assert statement by
if and raise statements.
Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com>