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

FR: Setting for the new number format used in the size column of the archive tab #1713

Closed
real-yfprojects opened this issue May 19, 2023 · 12 comments · Fixed by #1719
Closed
Assignees
Labels
good first issue Simple change to start learning code base type:enhancement Improvement of an existing function

Comments

@real-yfprojects
Copy link
Collaborator

The problem

#1595 complained about the sizes being hard to compare because they have different units. So we changed that in #1598.

Now people complained in #1692 (comment) that the size figures get too big because it selects a too small unit.

Requested Solution

It seems like there are people preferring the old way of displaying the size while there are also people liking the new way. So I suggest keeping both ways and adding a setting that allows toggling between them. The setting should be disabled by default. When it's enabled vorta should use the new mode.

Implementation Recipe

  1. Add a setting that enables the new size format in get_misc_settings
  2. Implement behaviour of the setting in ArchiveTab.populate_from_profile
  3. Test the change
@real-yfprojects real-yfprojects added type:enhancement Improvement of an existing function good first issue Simple change to start learning code base labels May 19, 2023
@bigtedde
Copy link
Collaborator

@real-yfprojects I can work on implementing this setting

@bigtedde
Copy link
Collaborator

@real-yfprojects Quick question about implementation: Do we want the setting, when toggled, to immediately update the archive tab to show the new units? Or should the archive tab only check the setting at launch (requiring a restart for a change in setting to show)?

Thanks

@real-yfprojects
Copy link
Collaborator Author

real-yfprojects commented May 21, 2023

Do we want the setting, when toggled, to immediately update the archive tab to show the new units?

That would be good.

@bigtedde
Copy link
Collaborator

Do we want the setting, when toggled, to immediately update the archive tab to show the new units?

That would be good.

I added the setting in get_misc_settings, and implementing the behavior in ArchiveTab.populate_from_profile. The setting works as intended, but changes only take effect after Vorta restarts.

However, I'm having trouble connecting a change in setting to an immediate refresh of the archive tab. Can you offer any insight on how to connect these actions?

One option I was considering would be to place the option in the Archive tab instead of Misc. Something like a dropdown box for "fixed number format" or "dynamic number format"

@real-yfprojects
Copy link
Collaborator Author

real-yfprojects commented May 22, 2023

One option I was considering would be to place the option in the Archive tab instead of Misc. Something like a dropdown box for "fixed number format" or "dynamic number format\

That shouldn't be needed. Iirc we used peewee hooks/signals in other places to update the GUI whenever a specific setting changed.

@bigtedde
Copy link
Collaborator

Hmm, I'm having trouble finding an example of updating the GUI with a peewee hook/signal to go off of. I found this post_save signal in connection.py, but when I try to use this post_save signal in the ArchiveTab class to update update the archive table when the setting gets changed, it does not work.

I believe post_save signals are typically used outside of class methods, and I am a bit stumped on how to update the GUI outside of the ArchiveTab class.

@bigtedde
Copy link
Collaborator

Ignore previous post, I got it working using pyqt signals and will submit a work in progress PR shortly :)

@real-yfprojects
Copy link
Collaborator Author

That shouldn't be needed. Iirc we used peewee hooks/signals in other places to update the GUI whenever a specific setting changed.

Found it: https://github.com/borgbase/vorta/pull/1620/files#diff-13e68b4724d1e48d9df1729b09c466f9b3dac5044a2ba95a3d4d83c7fdad501b

@bigtedde
Copy link
Collaborator

Thanks for linking me to that example. Are there benefits to using peewee hooks/signals over pyqt signals in this situation?

@real-yfprojects
Copy link
Collaborator Author

Thanks for linking me to that example. Are there benefits to using peewee hooks/signals over pyqt signals in this situation?

Qt signals are easier to use and more powerful. However directly connecting to the database provides the benefit, that you can change the setting anywhere in the program and the GUI will update itself without requiring that the developer adds extra code to emit the qt signal.

@bigtedde
Copy link
Collaborator

Ah, that makes a lot of sense. I see that PR you linked has not been merged yet - would you prefer I use PtQt signals for now or go ahead and implement the peewee hook in a similar fashion to what daffy did in that PR?

@real-yfprojects
Copy link
Collaborator Author

The Qt signal is fine. When needed one can change it at anytime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Simple change to start learning code base type:enhancement Improvement of an existing function
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants