Пример #1
0
 def init_extensions(self):
     self.setEnabled(False)
     AbstractSourceManager.init()
     # --choosing default layout--
     index = self._layoutMode.findText("Default Layout")
     if index >= 0:
         self._layoutMode.setCurrentIndex(index)
     self.__extInitialised = True
     self.setEnabled(True)
Пример #2
0
    def gather_items(self):
        if not self.is_valid():
            return None #TODO : raise something dude
        if self.__entry_point__ is None:
            return None #TODO : raise something dude

        self.items = {}
        for ep in self.pkg_resources.iter_entry_points(self.__entry_point__):
            try:
                AbstractSourceManager.post_status_message(self.__class__.__name__ + \
                                                          " loading  " + ep.name)
                it = ep.load()
                it = it()
            except Exception, e:
                mod_logger.error(self.name + " couldn't load " + str(ep) + ":" + str(e) )
                traceback.print_exc()
                continue
            else:
                key = getattr(it, self.__key__)
                self.items[key] = it
Пример #3
0
 def gather_items(self, refresh=False):
     items = AbstractSourceManager.gather_items(self, refresh)
     if refresh:
         self.__mimeMap.clear()
         for appFac in items.itervalues():
             if appFac is None:
                 continue
             if not appFac.started:
                 appFac._start_0()
             fmts = appFac.get_mimetypes()
             for fmt in fmts:
                 self.__mimeMap.setdefault(fmt, set()).add(appFac)
     return items
Пример #4
0
 def __init__(self):
     AbstractSourceManager.__init__(self)
     self.__mimeMap = {}