~gdesklets-desklet-team/gdesklets/0.36

« back to all changes in this revision

Viewing changes to shell/PluginWrapper.py

  • Committer: Robert Pastierovic
  • Date: 2007-10-07 10:08:42 UTC
  • Revision ID: pastierovic@gmail.com-20071007100842-fdvp2vzmqgh1j87k
merged 0.3x branch and basic documentation and some other changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
class PluginWrapper(object):
 
2
 
 
3
    def __init__(self, plugin, methods):
 
4
 
 
5
        self.__methods = methods
 
6
        self.__plugin = plugin
 
7
            
 
8
 
 
9
 
 
10
    def __getattr__(self, key):
 
11
 
 
12
        methods = self.__methods
 
13
        plugin = self.__plugin
 
14
        if (key in methods):
 
15
            return getattr(plugin, key)
 
16
        else:
 
17
            raise KeyError("No such method: %s" % (key))