|
@@ -67,6 +67,15 @@ class TaskManagerWidget(PandaObject):
|
|
|
items = [],
|
|
items = [],
|
|
|
selectioncommand = self.setCurrentTask)
|
|
selectioncommand = self.setCurrentTask)
|
|
|
self.taskListBox.pack(expand = 1, fill = BOTH)
|
|
self.taskListBox.pack(expand = 1, fill = BOTH)
|
|
|
|
|
+
|
|
|
|
|
+ self._popupMenu = Menu(self.taskListBox.component('listbox'),
|
|
|
|
|
+ tearoff = 0)
|
|
|
|
|
+ self._popupMenu.add_command(
|
|
|
|
|
+ label = 'Remove Task',
|
|
|
|
|
+ command = self.removeCurrentTask)
|
|
|
|
|
+ self._popupMenu.add_command(
|
|
|
|
|
+ label = 'Remove Matching Tasks',
|
|
|
|
|
+ command = self.removeMatchingTasks)
|
|
|
|
|
|
|
|
# Controls Frame
|
|
# Controls Frame
|
|
|
controlsFrame = Frame(parent)
|
|
controlsFrame = Frame(parent)
|
|
@@ -109,11 +118,25 @@ class TaskManagerWidget(PandaObject):
|
|
|
# Bind updates to arrow buttons
|
|
# Bind updates to arrow buttons
|
|
|
listbox.bind('<KeyRelease-Up>', self.setCurrentTask)
|
|
listbox.bind('<KeyRelease-Up>', self.setCurrentTask)
|
|
|
listbox.bind('<KeyRelease-Down>', self.setCurrentTask)
|
|
listbox.bind('<KeyRelease-Down>', self.setCurrentTask)
|
|
|
|
|
+ listbox.bind('<ButtonPress-3>', self.popupMenu)
|
|
|
# And grab focus (to allow keyboard navigation)
|
|
# And grab focus (to allow keyboard navigation)
|
|
|
listbox.focus_set()
|
|
listbox.focus_set()
|
|
|
# Update listbox values
|
|
# Update listbox values
|
|
|
self.updateTaskListBox()
|
|
self.updateTaskListBox()
|
|
|
|
|
|
|
|
|
|
+ def popupMenu(self, event):
|
|
|
|
|
+ """
|
|
|
|
|
+ listbox = self.taskListBox.component('listbox')
|
|
|
|
|
+ index = listbox.nearest(event.y)
|
|
|
|
|
+ listbox.selection_clear(0)
|
|
|
|
|
+ listbox.activate(index)
|
|
|
|
|
+ self.taskListBox.select_set(index)
|
|
|
|
|
+ self.setCurrentTask()
|
|
|
|
|
+ """
|
|
|
|
|
+ self._popupMenu.post(event.widget.winfo_pointerx(),
|
|
|
|
|
+ event.widget.winfo_pointery())
|
|
|
|
|
+ return "break"
|
|
|
|
|
+
|
|
|
def setCurrentTask(self, event = None):
|
|
def setCurrentTask(self, event = None):
|
|
|
index = int(self.taskListBox.curselection()[0])
|
|
index = int(self.taskListBox.curselection()[0])
|
|
|
self.currentTask = self.__taskDict[index]
|
|
self.currentTask = self.__taskDict[index]
|