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 deregisterInstance1(self, scheme, plugin): print('ContentProviderProxy.deregisterInstance()') provider = self.getContentProvider().deregisterInstance(scheme, plugin) msg = "ContentProviderProxy.deregisterInstance(): %s - %s ... Done" % ( scheme, plugin) logMessage(self.ctx, INFO, msg, 'ContentProviderProxy', 'deregisterInstance()') return provider
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 createContentProvider(self, service): #print('ContentProviderProxy.createContentProvider()') 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 registerInstance1(self, scheme, plugin, replace): #print('ContentProviderProxy.registerInstance()') msg = "Register Scheme/Plugin/Replace: %s/%s/%s ..." % (scheme, plugin, replace) if ContentProviderProxy._IsRegistred and not replace: #print('ContentProviderProxy.registerInstance() ***** None') return None ContentProviderProxy._IsRegistred = True self.scheme = scheme self.plugin = plugin self.replace = replace msg += " Done" logMessage(self.ctx, INFO, msg, 'ContentProviderProxy', 'registerInstance()') #print('ContentProviderProxy.registerInstance() OK') return self
def getContentProvider(self): #print('ContentProviderProxy.getContentProvider()') level = INFO msg = "Need to get UCP: %s ..." % g_identifier if not self.IsLoaded: provider = self.createContentProvider(g_identifier) 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