Skip to content

Commit

Permalink
Enabling drag and drop between application lists
Browse files Browse the repository at this point in the history
  • Loading branch information
alimirjamali committed Jul 20, 2024
1 parent 4011bc6 commit eed5fe9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
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

0 comments on commit eed5fe9

Please sign in to comment.