mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
task: Get rid of unnecessary __makeTaskList
We can directly convert AsyncTaskCollection objects to a list (though even that is of questionable value since task collections behave list-like enough)
This commit is contained in:
parent
b8c301164a
commit
73a27fa281
@ -274,33 +274,27 @@ class TaskManager:
|
|||||||
def getTasksNamed(self, taskName):
|
def getTasksNamed(self, taskName):
|
||||||
"""Returns a list of all tasks, active or sleeping, with the
|
"""Returns a list of all tasks, active or sleeping, with the
|
||||||
indicated name. """
|
indicated name. """
|
||||||
return self.__makeTaskList(self.mgr.findTasks(taskName))
|
return list(self.mgr.findTasks(taskName))
|
||||||
|
|
||||||
def getTasksMatching(self, taskPattern):
|
def getTasksMatching(self, taskPattern):
|
||||||
"""Returns a list of all tasks, active or sleeping, with a
|
"""Returns a list of all tasks, active or sleeping, with a
|
||||||
name that matches the pattern, which can include standard
|
name that matches the pattern, which can include standard
|
||||||
shell globbing characters like \\*, ?, and []. """
|
shell globbing characters like \\*, ?, and []. """
|
||||||
|
|
||||||
return self.__makeTaskList(self.mgr.findTasksMatching(GlobPattern(taskPattern)))
|
return list(self.mgr.findTasksMatching(GlobPattern(taskPattern)))
|
||||||
|
|
||||||
def getAllTasks(self):
|
def getAllTasks(self):
|
||||||
"""Returns list of all tasks, active and sleeping, in
|
"""Returns list of all tasks, active and sleeping, in
|
||||||
arbitrary order. """
|
arbitrary order. """
|
||||||
return self.__makeTaskList(self.mgr.getTasks())
|
return list(self.mgr.getTasks())
|
||||||
|
|
||||||
def getTasks(self):
|
def getTasks(self):
|
||||||
"""Returns list of all active tasks in arbitrary order. """
|
"""Returns list of all active tasks in arbitrary order. """
|
||||||
return self.__makeTaskList(self.mgr.getActiveTasks())
|
return list(self.mgr.getActiveTasks())
|
||||||
|
|
||||||
def getDoLaters(self):
|
def getDoLaters(self):
|
||||||
"""Returns list of all sleeping tasks in arbitrary order. """
|
"""Returns list of all sleeping tasks in arbitrary order. """
|
||||||
return self.__makeTaskList(self.mgr.getSleepingTasks())
|
return list(self.mgr.getSleepingTasks())
|
||||||
|
|
||||||
def __makeTaskList(self, taskCollection):
|
|
||||||
l = []
|
|
||||||
for i in range(taskCollection.getNumTasks()):
|
|
||||||
l.append(taskCollection.getTask(i))
|
|
||||||
return l
|
|
||||||
|
|
||||||
def doMethodLater(self, delayTime, funcOrTask, name, extraArgs = None,
|
def doMethodLater(self, delayTime, funcOrTask, name, extraArgs = None,
|
||||||
sort = None, priority = None, taskChain = None,
|
sort = None, priority = None, taskChain = None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user