def __init__(self, manager, pluginID, plugin): QObject.__init__(self) self.manager = manager self.pluginID = pluginID self.plugin = plugin self.thread = None # VCSPluginThread self.indicators = {} # ID -> VCSIndicator self.__getPluginIndicators() self.thread = VCSPluginThread(plugin) self.thread.start() self.connect(self.thread, SIGNAL("VCSStatus"), self.__onStatus) return
class VCSPluginDescriptor(QObject): " Holds information about a single active plugin " def __init__(self, manager, pluginID, plugin): QObject.__init__(self) self.manager = manager self.pluginID = pluginID self.plugin = plugin self.thread = None # VCSPluginThread self.indicators = {} # ID -> VCSIndicator self.__getPluginIndicators() self.thread = VCSPluginThread(plugin) self.thread.start() self.connect(self.thread, SIGNAL("VCSStatus"), self.__onStatus) return def stopThread(self): " Stops the plugin thread synchronously " self.thread.stop() # Sends request self.thread.wait() # Joins the thread return def requestStatus(self, path, flag, urgent=False): " Requests the item status asynchronously " self.thread.addRequest(path, flag, urgent) return def clearRequestQueue(self): " Clears the thread request queue " self.thread.clearRequestQueue() return def getPluginName(self): " Safe plugin name " try: return self.plugin.getName() except: return "Unknown (could not retrieve)" def __getPluginIndicators(self): " Retrieves indicators from the plugin " try: for indicatorDesc in self.plugin.getObject().getCustomIndicators(): try: indicator = VCSIndicator(indicatorDesc) if indicator.identifier < 0: logging.error("Custom VCS plugin '" + self.getPluginName() + "' indicator identifier " + str(indicator.identifier) + " is invalid. It must be >= 0. " "Ignore and continue.") else: self.indicators[indicator.identifier] = indicator except Exception, exc: logging.error("Error getting custom VCS plugin '" + self.getPluginName() + "' indicator: " + str(exc)) except Exception, exc: logging.error("Error getting custom indicators for a VCS plugin " + self.getPluginName() + ". Exception: " + str(exc)) return
class VCSPluginDescriptor(QObject): " Holds information about a single active plugin " def __init__(self, manager, pluginID, plugin): QObject.__init__(self) self.manager = manager self.pluginID = pluginID self.plugin = plugin self.thread = None # VCSPluginThread self.indicators = {} # ID -> VCSIndicator self.__getPluginIndicators() self.thread = VCSPluginThread(plugin) self.thread.start() self.connect(self.thread, SIGNAL("VCSStatus"), self.__onStatus) return def stopThread(self): " Stops the plugin thread synchronously " self.thread.stop() # Sends request self.thread.wait() # Joins the thread return def requestStatus(self, path, flag, urgent=False): " Requests the item status asynchronously " self.thread.addRequest(path, flag, urgent) return def clearRequestQueue(self): " Clears the thread request queue " self.thread.clearRequestQueue() return def getPluginName(self): " Safe plugin name " try: return self.plugin.getName() except: return "Unknown (could not retrieve)" def __getPluginIndicators(self): " Retrieves indicators from the plugin " try: for indicatorDesc in self.plugin.getObject().getCustomIndicators(): try: indicator = VCSIndicator(indicatorDesc) if indicator.identifier < 0: logging.error( "Custom VCS plugin '" + self.getPluginName() + "' indicator identifier " + str(indicator.identifier) + " is invalid. It must be >= 0. " "Ignore and continue." ) else: self.indicators[indicator.identifier] = indicator except Exception, exc: logging.error( "Error getting custom VCS plugin '" + self.getPluginName() + "' indicator: " + str(exc) ) except Exception, exc: logging.error( "Error getting custom indicators for a VCS plugin " + self.getPluginName() + ". Exception: " + str(exc) ) return