def __init__(self, ctx): msg = "ContentProviderProxy for plugin: %s loading ..." % g_identifier self.ctx = ctx self.scheme = '' self.plugin = '' self.replace = True msg += " Done" logMessage(self.ctx, INFO, msg, 'ContentProviderProxy', '__init__()')
def _clearLog(self, dialog): try: clearLogger() logMessage(self.ctx, INFO, "ClearingLog ... Done", 'OptionsDialog', '_doClearLog()') url = getLoggerUrl(self.ctx) self._setDialogText(dialog, url) except Exception as e: msg = "Error: %s - %s" % (e, traceback.print_exc()) logMessage(self.ctx, SEVERE, msg, "OptionsDialog", "_doClearLog()")
def registerInstance1(self, scheme, plugin, replace): msg = "Register Scheme/Plugin/Replace: %s/%s/%s ..." % (scheme, plugin, replace) self.scheme = scheme self.plugin = plugin self.replace = replace msg += " Done" logMessage(self.ctx, INFO, msg, 'ContentProviderProxy', 'registerInstance()') return self
def createContentProvider(self, service): provider = None level = INFO msg = "Service: %s loading ..." % service ucp = ContentProvider(self.ctx, service) if not ucp: level = SEVERE msg += " ERROR: requested service is not available..." else: msg += " Done" provider = ucp.registerInstance(g_scheme, g_identifier, True) logMessage(self.ctx, level, msg, 'ContentProviderProxy', 'createContentProvider()') return provider
def getContentProvider(self): level = INFO msg = "Need to get UCP: %s ..." % g_identifier if not self.IsLoaded: service = '%s.ContentProvider' % g_identifier provider = self.createContentProvider(service) if not provider: level = SEVERE msg += " ERROR: requested service is not available..." else: ContentProviderProxy._Provider = provider msg += " Done" else: msg += " Done" logMessage(self.ctx, level, msg, 'ContentProviderProxy', 'getContentProvider()') return ContentProviderProxy._Provider
def deregisterInstance1(self, scheme, plugin): self.getContentProvider().deregisterInstance(scheme, plugin) msg = "ContentProviderProxy.deregisterInstance(): %s - %s ... Done" % ( scheme, plugin) logMessage(self.ctx, INFO, msg, 'ContentProviderProxy', 'deregisterInstance()')