Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tools.py
diff options
context:
space:
mode:
authorBrian <brian@laptop.org>2008-07-16 19:08:20 (GMT)
committer Brian <brian@laptop.org>2008-07-16 19:08:20 (GMT)
commit4289189381d3f9e59cf656e89f395d58fc8ab53a (patch)
tree4e6812fa65b9f9e0f2f3e1f07442d1d9d58180b2 /tools.py
parent37c51a205706d38ee52f916951da964e2bb36c16 (diff)
parent6279e36ec3ffa5415287c79f3ba6a45aaf70f76c (diff)
Merge branch 'master' of git+ssh://bjordan@dev.laptop.org/git/activities/physics
Diffstat (limited to 'tools.py')
-rw-r--r--tools.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools.py b/tools.py
index 6df93c7..38b3cd6 100644
--- a/tools.py
+++ b/tools.py
@@ -6,6 +6,7 @@
import pygame
from pygame.locals import *
from helpers import *
+from inspect import getmro
# tools that can be used superlcass
class Tool(object):
name = "Tool"
@@ -394,9 +395,13 @@ class JoystickTool(Tool):
self.vertices = None
-def list_local_classes():
+def getAllTools():
this_mod = __import__(__name__)
- return [val for val in this_mod.__dict__.values()
- if isinstance(val, type)]
+ all = [val for val in this_mod.__dict__.values() if isinstance(val, type)]
+ allTools = []
+ for a in all:
+ if getmro(a).__contains__(Tool) and a!= Tool: allTools.append(a)
+ return allTools
+
-local_classes = list_local_classes()
+allTools = getAllTools()