diff options
author | mkaay <mkaay@mkaay.de> | 2010-11-05 18:29:42 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-11-05 18:29:42 +0100 |
commit | 7fababff0fb3e4251cf7ac60f7a945a9e8f13bde (patch) | |
tree | b688b51493e5ac4418305b034676ab1c20e6c2f7 /module/AccountManager.py | |
parent | sj fix (diff) | |
download | pyload-7fababff0fb3e4251cf7ac60f7a945a9e8f13bde.tar.xz |
scheduler optimization, SJOrg fix, better crypter limit
Diffstat (limited to 'module/AccountManager.py')
-rw-r--r-- | module/AccountManager.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/module/AccountManager.py b/module/AccountManager.py index 6f2d9c186..202032052 100644 --- a/module/AccountManager.py +++ b/module/AccountManager.py @@ -38,6 +38,9 @@ class AccountManager(): self.plugins = {} self.initAccountPlugins() + + self.accountInfoCache = [] + self.loadAccounts() self.saveAccounts() # save to add categories to conf @@ -155,18 +158,27 @@ class AccountManager(): self.saveAccounts() p.getAllAccounts(force=True) - def getAccountInfos(self, force=False): + def getAccountInfos(self, force=False, cache=False): data = {} + if not force: + return self.accountInfoCache + elif not cache: + self.core.scheduler.addJob(0, self.core.accountManager.cacheAccountInfos) #prevent gui from blocking + return self.accountInfoCache + for p in self.accounts.keys(): if self.accounts[p]: p = self.getAccountPlugin(p) data[p.__name__] = p.getAllAccounts(force) else: data[p] = [] + self.accountInfoCache = data + e = AccountUpdateEvent() + self.core.pullManager.addEvent(e) return data def cacheAccountInfos(self): - self.getAccountInfos() + self.getAccountInfos(True, True) def sendChange(self): e = AccountUpdateEvent() |