diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-05-17 20:06:11 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-05-17 20:06:11 +0200 |
commit | 2a74f88fcaf3d3baac24397de81a967c0b8c73e2 (patch) | |
tree | c80495e505432637cf69053967ea87090d69baa5 /module | |
parent | some multiuser db changes (diff) | |
download | pyload-2a74f88fcaf3d3baac24397de81a967c0b8c73e2.tar.xz |
small typo fixes and TODOs
Diffstat (limited to 'module')
-rw-r--r-- | module/AddonManager.py | 10 | ||||
-rw-r--r-- | module/plugins/Addon.py | 12 | ||||
-rw-r--r-- | module/setup.py | 14 | ||||
-rw-r--r-- | module/threads/AddonThread.py | 2 |
4 files changed, 24 insertions, 14 deletions
diff --git a/module/AddonManager.py b/module/AddonManager.py index cec650c92..ef5c52149 100644 --- a/module/AddonManager.py +++ b/module/AddonManager.py @@ -35,12 +35,12 @@ class AddonManager: self.core = core self.config = self.core.config - __builtin__.addonManager = self #needed to let addons register themself + __builtin__.addonManager = self #needed to let addons register themselves self.log = self.core.log self.plugins = {} self.methods = {} # dict of names and list of methods usable by rpc - self.events = {} # Contains event that will be registred + self.events = {} # Contains event that will be registered self.lock = RLock() self.createIndex() @@ -147,7 +147,7 @@ class AddonManager: # active the addon in new thread start_new_thread(plugin.activate, tuple()) - self.registerEvents() + self.registerEvents() # TODO: BUG: events will be destroyed and not re-registered @lock def deactivateAddon(self, plugin): @@ -230,11 +230,15 @@ class AddonManager: return info def addEventListener(self, plugin, func, event): + """ add the event to the list """ + + if plugin not in self.events: self.events[plugin] = [] self.events[plugin].append((func, event)) def registerEvents(self): + """ actually register all saved events """ for name, plugin in self.plugins.iteritems(): if name in self.events: for func, event in self.events[name]: diff --git a/module/plugins/Addon.py b/module/plugins/Addon.py index 3fc4eb467..614c68c80 100644 --- a/module/plugins/Addon.py +++ b/module/plugins/Addon.py @@ -20,7 +20,7 @@ from traceback import print_exc #from functools import wraps -from module.utils import has_method +from module.utils import has_method, to_list from Base import Base @@ -34,10 +34,14 @@ class Expose(object): return f def AddEventListener(event): - """ Used to register method for events. Arguments needs to match parameter of event """ + """ Used to register method for events. Arguments needs to match parameter of event + + :param event: Name of event or list of them. + """ class _klass(object): def __new__(cls, f, *args, **kwargs): - addonManager.addEventListener(class_name(f.__module__), f.func_name, event) + for ev in to_list(event): + addonManager.addEventListener(class_name(f.__module__), f.func_name, ev) return f return _klass @@ -74,6 +78,8 @@ def AddonInfo(desc): pass def threaded(f): + """ Decorator to run method in a thread. """ + #@wraps(f) def run(*args,**kwargs): addonManager.startThread(f, *args, **kwargs) diff --git a/module/setup.py b/module/setup.py index ff862893f..ed3829e40 100644 --- a/module/setup.py +++ b/module/setup.py @@ -113,7 +113,7 @@ class Setup(): print "" if len(avail) < 5: - print _("Featues missing: ") + print _("Features missing: ") print if not self.check_module("Crypto"): @@ -124,7 +124,7 @@ class Setup(): if not ssl: print _("no SSL available") print _("This is needed if you want to establish a secure connection to core or webinterface.") - print _("If you only want to access locally to pyLoad ssl is not usefull.") + print _("If you only want to access locally to pyLoad ssl is not useful.") print "" if not captcha: @@ -136,7 +136,7 @@ class Setup(): print _("no JavaScript engine found") print _("You will need this for some Click'N'Load links. Install Spidermonkey, ossp-js, pyv8 or rhino") - print _("You can abort the setup now and fix some dependicies if you want.") + print _("You can abort the setup now and fix some dependencies if you want.") con = self.ask(_("Continue with setup?"), self.yes, bool=True) @@ -146,7 +146,7 @@ class Setup(): print "" print _("Do you want to change the config path? Current is %s") % abspath("") print _( - "If you use pyLoad on a server or the home partition lives on an iternal flash it may be a good idea to change it.") + "If you use pyLoad on a server or the home partition lives on an internal flash it may be a good idea to change it.") path = self.ask(_("Change config path?"), self.no, bool=True) if path: self.conf_path() @@ -236,7 +236,7 @@ class Setup(): if not v.startswith("2.5") and not v.startswith("2.6"): print _("Your installed jinja2 version %s seems too old.") % jinja2.__version__ print _("You can safely continue but if the webinterface is not working,") - print _("please upgrade or deinstall it, pyLoad includes a sufficient jinja2 libary.") + print _("please upgrade or deinstall it, pyLoad includes a sufficient jinja2 library.") print jinja = False except: @@ -307,7 +307,7 @@ class Setup(): print "threaded:", _("This server offers SSL and is a good alternative to builtin.") print "fastcgi:", _( "Can be used by apache, lighttpd, requires you to configure them, which is not too easy job.") - print "lightweight:", _("Very fast alternative written in C, requires libev and linux knowlegde.") + print "lightweight:", _("Very fast alternative written in C, requires libev and linux knowledge.") print "\t", _("Get it from here: https://github.com/jonashaag/bjoern, compile it") print "\t", _("and copy bjoern.so to module/lib") @@ -391,7 +391,7 @@ class Setup(): languages=[self.config["general"]["language"], "en"], fallback=True) translation.install(True) - print _("Setting new configpath, current configuration will not be transfered!") + print _("Setting new configpath, current configuration will not be transferred!") path = self.ask(_("Configpath"), abspath("")) try: path = join(pypath, path) diff --git a/module/threads/AddonThread.py b/module/threads/AddonThread.py index 3a378ad6e..b6a552e0e 100644 --- a/module/threads/AddonThread.py +++ b/module/threads/AddonThread.py @@ -37,7 +37,7 @@ class AddonThread(BaseThread): pyfile.finishIfDone() - def run(self): + def run(self): #TODO: approach via func_code try: try: self.kwargs["thread"] = self |