When switching libraries update news scheduler since custom recipes are stored in the db

This commit is contained in:
Kovid Goyal 2010-07-17 11:40:11 -06:00
parent 161a61f6fd
commit 828f47995b
3 changed files with 13 additions and 1 deletions

View File

@ -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:

View File

@ -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):

View File

@ -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: