mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-18 04:33:04 -04:00
getTasksMatching
This commit is contained in:
parent
2e7751678f
commit
907c9541a9
@ -222,6 +222,13 @@ class TaskManager:
|
|||||||
indicated name. """
|
indicated name. """
|
||||||
return self.__makeTaskList(self.mgr.findTasks(taskName))
|
return self.__makeTaskList(self.mgr.findTasks(taskName))
|
||||||
|
|
||||||
|
def getTasksMatching(self, taskPattern):
|
||||||
|
"""Returns a list of all tasks, active or sleeping, with a
|
||||||
|
name that matches the pattern, which can include standard
|
||||||
|
shell globbing characters like *, ?, and []. """
|
||||||
|
|
||||||
|
return self.__makeTaskList(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. """
|
||||||
|
@ -536,6 +536,23 @@ class TaskManager:
|
|||||||
return [task for task in self.nameDict.get(taskName, []) #grab all tasks with name
|
return [task for task in self.nameDict.get(taskName, []) #grab all tasks with name
|
||||||
if not task._removed] #filter removed tasks
|
if not task._removed] #filter removed tasks
|
||||||
|
|
||||||
|
def getTasksMatching(self, taskPattern):
|
||||||
|
"""getTasksMatching(self, string taskPattern)
|
||||||
|
|
||||||
|
Returns tasks whose names match the pattern, which can include
|
||||||
|
standard shell globbing characters like *, ?, and [].
|
||||||
|
"""
|
||||||
|
keyList = filter(
|
||||||
|
lambda key: fnmatch.fnmatchcase(key, taskPattern),
|
||||||
|
self.nameDict.keys())
|
||||||
|
|
||||||
|
result = []
|
||||||
|
for key in keyList:
|
||||||
|
for task in self.nameDict.get(key, []):
|
||||||
|
if not task._removed:
|
||||||
|
result.append(task)
|
||||||
|
return result
|
||||||
|
|
||||||
def __doLaterFilter(self):
|
def __doLaterFilter(self):
|
||||||
# Filter out all the tasks that have been removed like a mark and
|
# Filter out all the tasks that have been removed like a mark and
|
||||||
# sweep garbage collector. Returns the number of tasks that have
|
# sweep garbage collector. Returns the number of tasks that have
|
||||||
|
Loading…
x
Reference in New Issue
Block a user