Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2120 (plus changes to status info and tray icon active duration) #2142

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mycir
Copy link

@mycir mycir commented Nov 18, 2024

Description

Add pre/post backup signals and emit them in BorgCreateJob.pre_post_backup_cmd.
Use them to toggle start/cancel buttons, tray icon active/inactive and provide enhanced status info. Also run VortaApp.create_backup_action/VortaScheduler.create_backup in a new thread to prevent GUI freezing whilst running pre/post backup commands.

Related Issue

#2120

Motivation and Context

I experienced this issue when running pre/post backup commands to mount/unmount a gdrive.
It solves the problem of the backup finished signal occurring before long running post backup commands have completed, preventing the start/cancel buttons being toggled back to their resting state.

How Has This Been Tested?

By running manual and scheduled backups.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

@m3nu
Copy link
Contributor

m3nu commented Nov 18, 2024

Hi, thanks for the PR! Had a quick look and was wondering if it wouldn't be better to use QThread instead of native Python threads. Example of how those are used here:

class FilePathInfoAsync(QThread):

Old discussion here: https://www.mail-archive.com/[email protected]/msg16052.html

@mycir
Copy link
Author

mycir commented Nov 18, 2024

@m3nu, Silly me, I should have searched for QThread in all files - was thinking about it but didn't want add an import just for this.

Yes of course, I'll try and get my head around utils.py as time permits.

@mycir
Copy link
Author

mycir commented Nov 21, 2024

@m3nu, please hold. I have a working solution that wraps VortaApp.create_backup_action with an @AsyncRunner decorator which runs it in a QThread. Will try it on VortScheduler.create_backup too. Much grief until I discovered the principles of UniversalDecorator. Was beginning to think what's wrong with a native thread? until I noticed 'This method won't work correctly when called from a non-QThread' in VortaScheduler.pause .

Will commit after I've tidied things up next week - need a break and a hair transplant.

@mycir
Copy link
Author

mycir commented Nov 22, 2024

Apologies, tried to make a minor change to 84fbf14 with git commit --amend --no-edit and made a complete hash of it.

@mycir mycir reopened this Nov 22, 2024
@m3nu m3nu marked this pull request as draft December 5, 2024 14:01

def run(self):
self.decorator_instance(self.wrapped_instance, *self.args, **self.kwargs)
<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unresolved conflict.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, will action.

@mycir
Copy link
Author

mycir commented Dec 16, 2024

Apologies for rogue conflict markers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants