From 3d2b2a333fe91327cf9e92b75c38cea33e2a6db0 Mon Sep 17 00:00:00 2001 From: Gyedo Jeon Date: Thu, 5 Jul 2007 22:47:28 +0000 Subject: [PATCH] fixed not to select 1st item in the Tasks list all the time --- direct/src/tkpanels/TaskManagerPanel.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/direct/src/tkpanels/TaskManagerPanel.py b/direct/src/tkpanels/TaskManagerPanel.py index f7ca29e930..cb956d4fcc 100644 --- a/direct/src/tkpanels/TaskManagerPanel.py +++ b/direct/src/tkpanels/TaskManagerPanel.py @@ -145,8 +145,11 @@ class TaskManagerWidget(DirectObject): return "break" def setCurrentTask(self, event = None): - index = int(self.taskListBox.curselection()[0]) - self.currentTask = self.__taskDict[index] + if len(self.taskListBox.curselection()) > 0: # [gjeon] to avoid crash when nothing is selected + index = int(self.taskListBox.curselection()[0]) + self.currentTask = self.__taskDict[index] + else: + self.currentTask = None def updateTaskListBox(self): # Get a list of task names @@ -164,7 +167,7 @@ class TaskManagerWidget(DirectObject): # And set current index (so keypresses will start with index 0) self.taskListBox.component('listbox').activate(0) # Select first item - self.taskListBox.select_set(0) + #self.taskListBox.select_set(0) # [gjeon] commented out to avoid focus problem with other lists self.setCurrentTask() def toggleTaskMgrVerbose(self):