abstract method loading

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2011-11-08 22:32:03 -05:00
parent f9482725d7
commit 1ea5d18fa5
1 changed files with 19 additions and 8 deletions

View File

@ -156,14 +156,15 @@ class Application(object):
'method.git',
)
for name in names:
exec("import %s" % name)
mod = eval(name)
for mname in dir(mod):
if mname.startswith('_'):
continue
cls = eval("%s.%s" % (name, mname))
if hasattr(cls, '_is_method') and cls._is_method:
self.methods[cls._name()] = cls()
self.load_pmacs_methods(name)
#exec("import %s" % name)
#mod = eval(name)
#for mname in dir(mod):
# if mname.startswith('_'):
# continue
# cls = eval("%s.%s" % (name, mname))
# if hasattr(cls, '_is_method') and cls._is_method:
# self.methods[cls._name()] = cls()
# ok, now let's load all the "standard" modes
mode.install(self)
@ -262,6 +263,16 @@ class Application(object):
curses.halfdelay(1)
curses.def_prog_mode()
def load_pmacs_methods(self, name):
exec("import %s" % name)
mod = eval(name)
for mname in dir(mod):
if mname.startswith('_'):
continue
cls = eval("%s.%s" % (name, mname))
if hasattr(cls, '_is_method') and cls._is_method:
self.methods[cls._name()] = cls()
def _load_config_defaults(self):
self.config['ignore_suffix'] = ['~', '-', 'CVS', '.svn', '.git', '.hg']
self.config['error_timeout'] = -1