MCPcopy
hub / github.com/evilsocket/opensnitch / __init__

Method __init__

ui/opensnitch/plugins/__init__.py:146–164  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

144 return PluginsManager.__instance
145
146 def __init__(self):
147 path = os.path.abspath(__file__)
148 # TODO: allow to load plugins from a different location
149 self._plugins_loaded = weakref.WeakValueDictionary()
150 self._plugins_path = os.path.dirname(path)
151
152 self._cfg = Config.get()
153 self.enabled_plugins = self._cfg.getSettings(Config.PLUGINS)
154 # FIXME: don't hardcode this plugin here.
155 # For now, load Highlight plugin by default.
156 if self.enabled_plugins == None:
157 self.enabled_plugins = ['highlight']
158 # if there's only 1 plugin enabled, the type will be str instead of
159 # list
160 if type(self.enabled_plugins) == str:
161 self.enabled_plugins = [self.enabled_plugins]
162 if 'highlight' not in self.enabled_plugins:
163 self.enabled_plugins.append('highlight')
164 #print("enabled plugins >>", self.enabled_plugins)
165
166 def load_plugins(self):
167 #print("PluginsManager.load_plugins()", self._plugins_path)

Callers

nothing calls this directly

Calls 2

getSettingsMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected