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

Enabling drag and drop between application lists #373

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions qubesmanager/appmenu_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def __init__(self, name, ident, tooltip=None, parent=None):
tooltip += "\n" + additional_description
self.setToolTip(tooltip)
self.ident = ident
# Using identity as tooltip which also enables drag-and-drop
self.setWhatsThis(ident)

@classmethod
def from_line(cls, line):
Expand Down
16 changes: 16 additions & 0 deletions qubesmanager/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,22 @@ def __init__(self, vm, init_page="basic", qapp=None, qubesapp=None,
self.refresh_apps_button.clicked.connect(
self.refresh_apps_button_pressed)

# Enable Drag & Drop between between two panels
# ToDo: Disable D&D between multiple instances of qubes-vm-settings
# - by overriding QListWidget.dragMoveEvent event
self.app_list.available_list.setDragEnabled(True)
self.app_list.available_list.setAcceptDrops(True)
self.app_list.available_list.setDragDropMode(
QtWidgets.QListWidget.DragDrop)
self.app_list.available_list.setDefaultDropAction(
QtCore.Qt.MoveAction)
self.app_list.selected_list.setDragEnabled(True)
self.app_list.selected_list.setAcceptDrops(True)
self.app_list.selected_list.setDragDropMode(
QtWidgets.QListWidget.DragDrop)
self.app_list.selected_list.setDefaultDropAction(
QtCore.Qt.MoveAction)

# template change
if self.template_name.isEnabled():
self.template_name.currentIndexChanged.connect(
Expand Down