mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
When switching libraries update news scheduler since custom recipes are stored in the db
This commit is contained in:
parent
161a61f6fd
commit
828f47995b
@ -235,6 +235,7 @@ class Scheduler(QObject):
|
|||||||
self.oldest = gconf['oldest_news']
|
self.oldest = gconf['oldest_news']
|
||||||
self.oldest_timer.start(int(60 * 60000))
|
self.oldest_timer.start(int(60 * 60000))
|
||||||
self.oldest_check()
|
self.oldest_check()
|
||||||
|
self.database_changed = self.recipe_model.database_changed
|
||||||
|
|
||||||
def oldest_check(self):
|
def oldest_check(self):
|
||||||
if self.oldest > 0:
|
if self.oldest > 0:
|
||||||
|
@ -394,6 +394,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, # {{{
|
|||||||
self.search.clear_to_help()
|
self.search.clear_to_help()
|
||||||
self.book_details.reset_info()
|
self.book_details.reset_info()
|
||||||
self.library_view.model().count_changed()
|
self.library_view.model().count_changed()
|
||||||
|
self.scheduler.database_changed(db)
|
||||||
prefs['library_path'] = self.library_path
|
prefs['library_path'] = self.library_path
|
||||||
|
|
||||||
def show_book_info(self, *args):
|
def show_book_info(self, *args):
|
||||||
|
@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
import os, copy
|
import os, copy
|
||||||
|
|
||||||
from PyQt4.Qt import QAbstractItemModel, QVariant, Qt, QColor, QFont, QIcon, \
|
from PyQt4.Qt import QAbstractItemModel, QVariant, Qt, QColor, QFont, QIcon, \
|
||||||
QModelIndex, SIGNAL
|
QModelIndex, SIGNAL, QMetaObject, pyqtSlot
|
||||||
|
|
||||||
from calibre.utils.search_query_parser import SearchQueryParser
|
from calibre.utils.search_query_parser import SearchQueryParser
|
||||||
from calibre.gui2 import NONE
|
from calibre.gui2 import NONE
|
||||||
@ -131,6 +131,16 @@ class RecipeModel(QAbstractItemModel, SearchQueryParser):
|
|||||||
self.scheduler_config = SchedulerConfig()
|
self.scheduler_config = SchedulerConfig()
|
||||||
self.do_refresh()
|
self.do_refresh()
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def do_database_change(self):
|
||||||
|
self.db = self.newdb
|
||||||
|
self.newdb = None
|
||||||
|
self.do_refresh()
|
||||||
|
|
||||||
|
def database_changed(self, db):
|
||||||
|
self.newdb = db
|
||||||
|
QMetaObject.invokeMethod(self, 'do_database_change', Qt.QueuedConnection)
|
||||||
|
|
||||||
def get_builtin_recipe(self, urn, download=True):
|
def get_builtin_recipe(self, urn, download=True):
|
||||||
if download:
|
if download:
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user