MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / _pluginLoaderWorker

Method _pluginLoaderWorker

src/astroprint/plugin/__init__.py:500–527  ·  view source on GitHub ↗
(self, userPluginsDir)

Source from the content-addressed store, hash-verified

498 return self._plugins.get(pluginId)
499
500 def _pluginLoaderWorker(self, userPluginsDir):
501 #System Plugins
502 systemPluginsDir = os.path.realpath(os.path.join(os.path.dirname(__file__),'..','..','plugins'))
503 dirs = self._getDirectories(systemPluginsDir)
504 if dirs:
505 for d in dirs:
506 p = self._loadPlugin(d, 'plugins.')
507 if p is not None:
508 p.systemPlugin = True
509
510 else:
511 self._logger.warn("System Plugins Folder [%s] is empty" % systemPluginsDir)
512
513 # User Plugins
514 if os.path.isdir(userPluginsDir):
515 dirs = self._getDirectories(userPluginsDir)
516 if dirs:
517 for d in dirs:
518 self._loadPlugin(d)
519
520 else:
521 self._logger.warn("User Plugins Folder [%s] is empty" % userPluginsDir)
522
523 else:
524 self._logger.error("User Plugins Folder [%s] not found" % userPluginsDir)
525
526 self._pluginsLoaded.set() # Signal that plugin loading is done
527 self._fireEvent('ON_ALL_PLUGINS_LOADED')
528
529 def _getDirectories(self, path):
530 #don't return hidden dirs

Callers

nothing calls this directly

Calls 6

_getDirectoriesMethod · 0.95
_loadPluginMethod · 0.95
_fireEventMethod · 0.95
joinMethod · 0.80
errorMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected