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

Add setting to remember download columns width #8020

Merged
merged 1 commit into from
May 8, 2024

Conversation

heldersepu
Copy link
Contributor

@heldersepu heldersepu commented May 6, 2024

Are you tired of having to resize the columns in the download page all the time? me too...

This PR adds a couple of setting to set column width, for now i prefer to just have it as a "hidden" config option and in future versions we can add it in the UI, and more fancy stuff


This is how it looks like with my favorite options, I like the name to be the widest and the progress a bit wider than the default

Screenshot from 2024-05-06 13-17-44


Here is the new setting:

Screenshot from 2024-05-07 19-55-30


My goal is to make small changes as I get myself familiar with the code base, then I would be able to take on some more challenging issues

@heldersepu heldersepu requested review from a team and egbertbouman and removed request for a team May 6, 2024 17:23
Copy link

github-actions bot commented May 6, 2024

Hi @heldersepu, thank you for contributing to Tribler! 🚀

This PR was created by an outside collaborator, so some checks were not run for security reasons.
To trigger the full set of checks, any member of the Tribler team can add the label PR: safe to check to the current PR.

@heldersepu heldersepu changed the title Add settings to remember_columns width Add settings to "remember_columns" width May 6, 2024
@egbertbouman
Copy link
Member

Thanks for your PR!
Saving the column settings seems like a nice feature to have. However, I don't think these settinge belongs in the core. We normally store GUI settings in self.window().gui_settings. Could you try storing it there?

@heldersepu
Copy link
Contributor Author

heldersepu commented May 7, 2024

@egbertbouman correction applied... thanks for the tip, code looks simpler that way!
I also rebased and squashed my commits.

@egbertbouman
Copy link
Member

Thanks, looks good! I'm fine with merging this PR as-is, but I just noticed that the header also has saveState/restoreState functionality.

If you're up for it, you could save/restore the entire state of the downloads list in TriblerWindow.onClose/TriblerWindow.restore_window_geometry. We're already doing this for the position and size of the window. For instance, saving would be:

self.gui_settings.setValue("download_columns", self.downloads_list.header().saveState())

@heldersepu
Copy link
Contributor Author

Let me experiment with that self.downloads_list.header().saveState() will let you know more tomorrow

add settings to remember_columns width
@heldersepu heldersepu changed the title Add settings to "remember_columns" width Add setting to remember download columns width May 8, 2024
@heldersepu
Copy link
Contributor Author

heldersepu commented May 8, 2024

@egbertbouman I made the following changes:

  • added a new section to the settings page, screenshot provided above
  • using the header saveState/restoreState functionality as suggested, (nice bonus it also saves the sort)
  • new function on_header_change to save the state if use has it set

only disagreement with your suggestion I'm not saving onclose or restore_window_geometry instead doing it on:

  • sectionResized
  • sortIndicatorChanged

just in case if we get a crash, the state is not affected because it saved immediately after change

@egbertbouman
Copy link
Member

Nice, it's running smoothly and there's even a checkbox for it now 👍
Thanks again!

@egbertbouman egbertbouman merged commit ee87d25 into Tribler:main May 8, 2024
20 checks passed
@heldersepu
Copy link
Contributor Author

it was fun! ... thanks @egbertbouman for pushing me in the right direction
... if you can, take a look at an issue I opened a few days ago: #8007 would love more eyes on that

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

Successfully merging this pull request may close these issues.

2 participants