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

Sort profiles in the Backup Now tray menu #1899

Merged
merged 3 commits into from
Apr 1, 2024

Conversation

Parnassius
Copy link
Contributor

Description

This sorts the profile names alphabetically in the Backup Now item of the tray menu.

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

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.

@real-yfprojects
Copy link
Collaborator

Thank you for the work! Why should the profiles be sorted differently from the profile list within Vorta?

@Parnassius
Copy link
Contributor Author

They indeed shouldn't, the list in the main window is already sorted alphabetically, see here:

# Add items to the QListWidget
for profile in BackupProfileModel.select().order_by(BackupProfileModel.name):
item = QListWidgetItem(profile.name)
item.setData(Qt.ItemDataRole.UserRole, profile.id)
self.profileSelector.addItem(item)

This PR applies the same ordering logic to the list in the tray menu as well

@real-yfprojects
Copy link
Collaborator

They indeed shouldn't, the list in the main window is already sorted alphabetically, see here:

Thanks, I wasn't aware of that. When testing it wasn't sorted, now I noticed that it actually is, but only after a restart. Additionally the default profile always appears on top.

@Parnassius
Copy link
Contributor Author

Parnassius commented Apr 1, 2024

Thanks, I wasn't aware of that.

Yeah, I should have specified that in the original message, sorry about the confusion.

but only after a restart.

It seems that newly created profiles are indeed always added at the bottom of the list, I could try to tackle that in another PR in the next few days.

Additionally the default profile always appears on top.

It does that for you? I'm unable to test this branch right now, but for me on the latest release (0.9.1) it is sorted like any other profile. Note that the sorting is case-sensitive, could it be that your other profiles start with lower case letters?

@real-yfprojects
Copy link
Collaborator

Note that the sorting is case-sensitive, could it be that your other profiles start with lower case letters?

I see, that is indeed the reason. Despite coding for many years I wasn't aware that "D" < "a" is true.

@real-yfprojects real-yfprojects merged commit 9b8dbce into borgbase:master Apr 1, 2024
11 checks passed
shivansh02 pushed a commit to TheLazron/vorta that referenced this pull request Jun 7, 2024
The profile list in the main window is already sorted by name (alphabetically, case-sensitive). However the profile list in the *Backup Now* action found in the tray menu wasn't. This commit constructs the sql query to return the profiles in order.

* src/vorta/tray_menu.py
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