Our `DiffResultDialog` and `ExtractDialog` show a context menu for items of the list/tree view. The collapse action in this menu only makes sense for the tree mode of the view. This commit therefore enables the option only for this view mode.
* src/vorta/views/extract_dialog.py
* src/vorta/views/diff_result.py
* tests/unit/test_diff.py : Add tests for the new behaviour.
* tests/unit/test_extract.py
* Add dependency for pyobjc-CoreWLAN on darwin
* Rename existing implementation with Android
The current implementation was tested with Android, but does not work
with iOS.
Move the existing implementation and include android in the name to make
room for adding a new iOS metered connection detection strategy.
* get_current_wifi works with objc
Switch from using command line tools to using the Objective-C Cocoa API
to get the Wi-Fi status information.
Cocoa has an API to specifically check whether a Wi-Fi connection is
using a Personal Hotspot on iOS.
I'm using a private method to get the Wi-Fi interface object in Cocoa.
The reason for this is that cleaning up mocks on PyObjC/ObjC objects is
much harder than mocking out methods on objects in our control. Using
test doubles also let's me check for different states the Wi-Fi network
could be in.
* get_known_wifis works on darwin
Use the networksetup command on macOS to get the list of the user's
Wi-Fi networks.
networksetup -listpreferredwirelessnetworks bsd_device
It looks like this command and option has existed on macOS since at
least 2013.
Also add some type annotations around the PyObjC return values to help
the reader know what they're dealing with at each step.
* Add test for get_current_wifi when wifi is off
The user might have Wi-Fi turned off. Account for that use case.
* Add iOS Personal Hotspot support to is_network_metered
The DarwinNetworkManager can now determine if the user is connected to
a Personal Hotspot Wi-Fi network from iOS.
Account for whether the user has Wi-Fi turned on and off.
* Refactor to avoid deprecated API in Cocoa
According to Apple's developer documentation, creating CWInterface
objects directly are discouraged. Instead, they prefer to use
CWInterface objects created by CWWiFiClient.
This also happens to be more compliant with Apple's application sandbox.
Creating CWInterface objects directly accesses raw BSD sockets which is
not allowed in the sandbox.
More details here:
https://developer.apple.com/documentation/corewlan/cwinterface
* Add test case for blank Wi-Fi network name
I have one of these in my list of networks in Vorta. And this also
covers a missing branch in get_known_wifis.
* Move private method below public methods
This is to provide a little more clarity. Especially since this class is
subclassing another one.
* Account for when there is no wifi interface
When a Mac does not have a Wi-Fi interface, CWWiFiClient.interface() can
return None.
Update the type annotation to mark it as Optional, and account for the
null condition in the other methods.
* Fix type annotation error
The CI tests failed on python 3.8.
I used the wrong type annotation to describe a list of SystemWifiInfo's.
The tests now pass for me when I run 'make test-unit' using a python 3.8
interpreter.
* Fix linter issue with imports
* fix PEP8 E721
do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
* remove redundant parentheses
* fix SiteWorker.run for empty job queue
local variable job is not assigned if queue was empty
when calling .run(), but it is used in exception handler.
* remove unreachable code in parse_diff_lines
* bug fix for unreachable code in is_worker_running
the code intended to check if *any* worker is running for
any site was *unreachable*.
this caused false negative results for site=None.
* check_failed_response: remove outdated part of docstring
* pull request template: fix relative path to LICENSE.txt
* fix typos
* use logger.warning, .warn is deprecated
Move existing tests into subfolder `tests/unit`. Write integration tests that actually run the installed borg executable. Those tests can be found in `tests/integration`. Those pytest fixtures that are the same for both kinds of tests remain in `tests/conftest.py`. The others can be found in `tests/integration/conftest.py` or `tests/unit/conftest.py`. This adds nox to the project and configures it to run the tests with different borg versions. This also updates the ci workflow to run the integration tests using nox.
* noxfile.py : Run pytest with a matrix of borg versions OR a specific borg version
* Makefile : Run using nox. Add phonies `test-unit` and `test-integration`.
* tests/conftest.py : Move some fixtures/functions to `tests/unit/conftest.py`.
* tests/test_*.py --> tests/unit/ : Move unittests and assets into subfolder
* tests/integration/ : Write integration tests.
* requirements.d/dev.txt: Add `nox` and `pkgconfig`. The latter is needed for installing new borg versions.
* .github/actions/setup/action.yml : Update to install pre-commit and nox when needed. The action now no longer installs Vorta.
* .github/actions/install-dependencies/action.yml : Install system deps of borg with this new composite action.
* .github/workflows/test.yml : Rename `test` ci to `test-unit` and update it for the new test setup.
Implement `test-integration` ci.
Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
Move existing code for password input widgets into common classes to increase maintainability and reusability alongside reducing redundancy. This implements a `PasswordLineEdit` that can show a red border when an invalid password is entered. It also features a button for showing/hiding the password entered. When combining two of these entries for setting a new password `PasswordInput` can be used from now on. It combines a form for entering and confirming a password with a label to show a message when there is an issue with the password. It also checks the entered password against some rules regarding its length. This PR replaces existing widgets for entering passwords with these two new widgets.
* src/vorta/views/partials/password_input.py : Implement common input widgets/classes
* src/vorta/views/repo_add_dialog.py : Use new widgets.
* src/vorta/assets/UI/repoadd.ui : ^^^
This puts Vorta on PyQt6 and starts a new main branch 0.9.
---------
Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com>
Co-authored-by: Manu <3916435+m3nu@users.noreply.github.com>
Co-authored-by: yfprojects <62463991+real-yfprojects@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>
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>
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>
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 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`.
* 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/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]`.