@ -36,7 +36,12 @@ def _import_name(module):
""" Based on the name of the module, return the proper " import "
""" Based on the name of the module, return the proper " import "
statement . """
statement . """
( name , _ ) = os . path . splitext ( module )
( name , _ ) = os . path . splitext ( module )
return ' mitterlib.ui. %s ' % ( name )
if name . startswith ( ' ui_ ' ) :
mask = ' mitterlib.ui. %s '
else :
mask = ' mitterlib.ui.ui_ %s '
return mask % ( name )
class Interfaces ( object ) :
class Interfaces ( object ) :
@ -79,6 +84,7 @@ class Interfaces(object):
# [we could be mean and use random.choice(self._interfaces)]
# [we could be mean and use random.choice(self._interfaces)]
import_name = self . _interfaces [ 0 ]
import_name = self . _interfaces [ 0 ]
_log . debug ( ' Loading interface %s ' , import_name )
module_name = _import_name ( import_name )
module_name = _import_name ( import_name )
module = __import__ ( module_name , fromlist [ module_name ] )
module = __import__ ( module_name , fromlist = [ module_name ] )
return module . Interface ( connection , self . _options )
return module . Interface ( connection , self . _options )