class _ControlFactory: def __init__(self): self.__after_rebuilding = False self.__registry = ControlRegistry(CONTROLPATHS) # # Returns a control providing the given interface. # def get_control(self, iface): ctrl = self.__registry.get_control(iface) if (ctrl and os.path.isdir(ctrl)): cwd = os.getcwd() os.chdir(os.path.dirname(ctrl)) m = __import__(os.path.basename(ctrl)) obj = m.get_class()() os.chdir(cwd) return obj else: return None
def __init__(self): self.__after_rebuilding = False self.__registry = ControlRegistry(CONTROLPATHS)