mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
...
This commit is contained in:
parent
0b24aeb77f
commit
36bae4bc7b
@ -73,6 +73,11 @@ class Emailer(Thread): # {{{
|
||||
self.jobs = Queue()
|
||||
self.job_manager = job_manager
|
||||
self._run = True
|
||||
self.calculate_rate_limit()
|
||||
|
||||
self.last_send_time = time.time() - self.rate_limit
|
||||
|
||||
def calculate_rate_limit(self):
|
||||
self.rate_limit = 1
|
||||
opts = email_config().parse()
|
||||
rh = opts.relay_host
|
||||
@ -80,8 +85,6 @@ class Emailer(Thread): # {{{
|
||||
'gmail.com' in rh or 'live.com' in rh):
|
||||
self.rate_limit = 301
|
||||
|
||||
self.last_send_time = time.time() - self.rate_limit
|
||||
|
||||
def stop(self):
|
||||
self._run = False
|
||||
self.jobs.put(None)
|
||||
|
@ -170,6 +170,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
if not self.send_email_widget.set_email_settings(to_set):
|
||||
raise AbortCommit('abort')
|
||||
self.proxy['accounts'] = self._email_accounts.accounts
|
||||
|
||||
return ConfigWidgetBase.commit(self)
|
||||
|
||||
def make_default(self, *args):
|
||||
@ -188,6 +189,9 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
self._email_accounts.remove(idx)
|
||||
self.changed_signal.emit()
|
||||
|
||||
def refresh_gui(self, gui):
|
||||
gui.emailer.calculate_rate_limit()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from PyQt4.Qt import QApplication
|
||||
|
Loading…
x
Reference in New Issue
Block a user