Make the factory uglier, but better able to handle not running from inside the library, and make the plugins import from the library. These changes make it possible to run epicrefactor from outside itself, which is necessary to make the top level terminator script work with it
This commit is contained in:
parent
df9abd4523
commit
42e022a938
|
@ -29,7 +29,15 @@ class Factory(Borg):
|
||||||
'Container': 'container',
|
'Container': 'container',
|
||||||
'Window': 'window'}
|
'Window': 'window'}
|
||||||
if classtype in types.keys():
|
if classtype in types.keys():
|
||||||
module = __import__(types[classtype], None, None, [''])
|
# This is quite ugly, but we're importing from the current
|
||||||
|
# directory if that makes sense, otherwise falling back to
|
||||||
|
# terminatorlib. Someone with real Python skills should fix
|
||||||
|
# this to be less insane.
|
||||||
|
try:
|
||||||
|
module = __import__(types[classtype], None, None, [''])
|
||||||
|
except ImportError, ex:
|
||||||
|
module = __import__('terminatorlib.%s' % types[classtype],
|
||||||
|
None, None, [''])
|
||||||
return(isinstance(product, getattr(module, classtype)))
|
return(isinstance(product, getattr(module, classtype)))
|
||||||
else:
|
else:
|
||||||
err('Factory::isinstance: unknown class type: %s' % classtype)
|
err('Factory::isinstance: unknown class type: %s' % classtype)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# GPL v2 only
|
# GPL v2 only
|
||||||
"""terminal_menu.py - Default plugins for the terminal menu"""
|
"""terminal_menu.py - Default plugins for the terminal menu"""
|
||||||
import gtk
|
import gtk
|
||||||
import plugin
|
import terminatorlib.plugin as plugin
|
||||||
|
|
||||||
# Every plugin you want Terminator to load *must* be listed in 'available'
|
# Every plugin you want Terminator to load *must* be listed in 'available'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import plugin
|
import terminatorlib.plugin as plugin
|
||||||
|
|
||||||
# available must contain a list of all the classes that you want exposed
|
# available must contain a list of all the classes that you want exposed
|
||||||
available = ['TestPlugin']
|
available = ['TestPlugin']
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# GPL v2 only
|
# GPL v2 only
|
||||||
"""url_handlers.py - Default plugins for URL handling"""
|
"""url_handlers.py - Default plugins for URL handling"""
|
||||||
import re
|
import re
|
||||||
import plugin
|
import terminatorlib.plugin as plugin
|
||||||
|
|
||||||
# Every plugin you want Terminator to load *must* be listed in 'available'
|
# Every plugin you want Terminator to load *must* be listed in 'available'
|
||||||
available = ['LaunchpadBugURLHandler', 'LaunchpadCodeURLHandler', 'APTURLHandler']
|
available = ['LaunchpadBugURLHandler', 'LaunchpadCodeURLHandler', 'APTURLHandler']
|
||||||
|
|
Loading…
Reference in New Issue