vorta icon indicating copy to clipboard operation
vorta copied to clipboard

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

Open mycir opened this issue 1 year ago • 5 comments

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

  • [x] 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:

  • [x] 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.

mycir avatar Nov 18 '24 16:11 mycir

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: https://github.com/borgbase/vorta/blob/64586dff07e407ee005a10054dd2569ebce5ea37/src/vorta/utils.py#L34

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

m3nu avatar Nov 18 '24 17:11 m3nu

@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 avatar Nov 18 '24 18:11 mycir

@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 avatar Nov 21 '24 13:11 mycir

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

mycir avatar Nov 22 '24 21:11 mycir

Apologies for rogue conflict markers.

mycir avatar Dec 16 '24 17:12 mycir