/usr/lib/gdesklets/shell/PluginRegistry.py is in gdesklets 0.36.1-5+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | from plugin.PluginRegistry import PluginRegistry
from main import HOME, USERHOME
import os
#
# Registry for shell plugins.
#
class _PluginRegistry:
def __init__(self):
# prevent from recursion
self.__cache = {}
# table: query -> result
self.__query_cache = {}
path = os.path.dirname(__file__)
self.__registry = PluginRegistry(os.path.join(path, "plugins"))
def get_plugins_by_pattern(self, key, pattern):
query = "(MATCH '%s' '%s')" % (key, pattern)
if (not query in self.__query_cache):
result = self.__registry.get_plugins(query)
self.__query_cache[query] = result[:]
else:
result = self.__query_cache[query]
ret = []
for c in result:
if c not in self.__cache:
self.__cache[c] = c()
self.__cache[c].init()
ret.append( self.__cache[c] )
return ret
#
# Returns a control providing the given interfaces.
#
def get_plugin(self, name, *interfaces):
result = self.get_plugins_by_pattern("name", name)
if (result):
return result[0]
# singleton object
registry = _PluginRegistry()
|