-
Notifications
You must be signed in to change notification settings - Fork 136
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
Bound archive buttons enable/disable to context menu actions #1793
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
db86da4
bonded archive button toggles to context menu actions
bigtedde eec77ac
reorganized archive actions + consistent with context menu
bigtedde d9f638d
fixed xml formating
bigtedde 8b7dc0f
top allign the archive action buttons
bigtedde 0bdb543
Merge branch 'master' into delete
m3nu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
from PyQt6 import QtCore, uic | ||
from PyQt6.QtCore import QItemSelectionModel, QMimeData, QPoint, Qt, pyqtSlot | ||
from PyQt6.QtGui import QAction, QDesktopServices, QKeySequence, QShortcut | ||
from PyQt6.QtGui import QDesktopServices, QKeySequence, QShortcut | ||
from PyQt6.QtWidgets import ( | ||
QAbstractItemView, | ||
QApplication, | ||
|
@@ -154,7 +154,7 @@ def __init__(self, parent=None, app=None): | |
self.app.paletteChanged.connect(lambda p: self.set_icons()) | ||
|
||
def set_icons(self): | ||
"Used when changing between light- and dark mode" | ||
"""Used when changing between light- and dark mode""" | ||
self.bCheck.setIcon(get_colored_icon('check-circle')) | ||
self.bDiff.setIcon(get_colored_icon('stream-solid')) | ||
self.bPrune.setIcon(get_colored_icon('cut')) | ||
|
@@ -183,46 +183,22 @@ def archiveitem_contextmenu(self, pos: QPoint): | |
return # popup only for selected items | ||
|
||
menu = QMenu(self.archiveTable) | ||
menu.addAction( | ||
get_colored_icon('copy'), | ||
self.tr("Copy"), | ||
lambda: self.archive_copy(index=index), | ||
) | ||
menu.addAction(get_colored_icon('copy'), self.tr("Copy"), lambda: self.archive_copy(index=index)) | ||
menu.addSeparator() | ||
|
||
# archive actions | ||
archive_actions = [] | ||
archive_actions.append( | ||
menu.addAction( | ||
self.bRefreshArchive.icon(), | ||
self.bRefreshArchive.text(), | ||
self.refresh_archive_info, | ||
) | ||
) | ||
archive_actions.append( | ||
menu.addAction( | ||
self.bMountArchive.icon(), | ||
self.bMountArchive.text(), | ||
self.bmountarchive_clicked, | ||
) | ||
) | ||
archive_actions.append(menu.addAction(self.bExtract.icon(), self.bExtract.text(), self.extract_action)) | ||
archive_actions.append(menu.addAction(self.bRename.icon(), self.bRename.text(), self.cell_double_clicked)) | ||
# deletion possible with one but also multiple archives | ||
menu.addAction(self.bDelete.icon(), self.bDelete.text(), self.delete_action) | ||
|
||
if not (self.repoactions_enabled and len(selected_rows) <= 1): | ||
for action in archive_actions: | ||
action.setEnabled(False) | ||
|
||
# diff action | ||
menu.addSeparator() | ||
diff_action = QAction(self.bDiff.icon(), self.bDiff.text(), menu) | ||
diff_action.triggered.connect(self.diff_action) | ||
menu.addAction(diff_action) | ||
|
||
selected_rows = self.archiveTable.selectionModel().selectedRows(index.column()) | ||
diff_action.setEnabled(self.repoactions_enabled and len(selected_rows) == 2) | ||
button_connection_pairs = [ | ||
(self.bRefreshArchive, self.refresh_archive_info), | ||
(self.bDiff, self.diff_action), | ||
(self.bMountArchive, self.bmountarchive_clicked), | ||
(self.bExtract, self.extract_action), | ||
(self.bRename, self.cell_double_clicked), | ||
(self.bDelete, self.delete_action), | ||
] | ||
|
||
for button, connection in button_connection_pairs: | ||
action = menu.addAction(button.icon(), button.text(), connection) | ||
action.setEnabled(button.isEnabled()) | ||
Comment on lines
+190
to
+201
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clever rewrite! |
||
|
||
menu.popup(self.archiveTable.viewport().mapToGlobal(pos)) | ||
|
||
|
@@ -406,7 +382,8 @@ def on_selection_change(self, selected=None, deselected=None): | |
|
||
for index in range(layout.count()): | ||
widget = layout.itemAt(index).widget() | ||
widget.setToolTip(self.tooltip_dict.get(widget, "")) | ||
if widget is not None: | ||
widget.setToolTip(self.tooltip_dict.get(widget, "")) | ||
|
||
# refresh bMountArchive for the selected archive | ||
self.bmountarchive_refresh() | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, ideally, we would have the action menu mimic the layout of the button menu, with a separator before 'diff' and moving 'delete' to the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would make sense although we should review the current button layout. I initialls designed it so that it distinguishes between single and multi archive options. But maybe there is a better button order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's run with that idea. Maybe list them by number of archives required for the action?
Separators between each of these sections, maybe?
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Categorizing by impact would also be possible.
Those only extract data of vorta.
Those do not alter the repo but modify the filesystem
This is reversible.
This deletes data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can wrap these changes into this PR. Would we like separators between those categories, or just ordered in a list as you outlined?
Same list order for the context menu as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which of these two options do you prefer?
I feel like separators or increased spacing would clutter the ui too much.
Recognisable patterns repeated throughout the application usually improve the UX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Categorizing by impact as you suggest makes logical sense, and I like 'delete' being the last option as that is intuitive.
I will remove the serparators and match the ordering for both button and context menu 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, the requested changes have been made. The only difference now between the context menu and the buttons is the 'copy' context menu action. Would you like there to be a 'copy' button as well, or leave it as it is?