diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py
index df6ac45e5b..e699551150 100644
--- a/src/calibre/gui2/__init__.py
+++ b/src/calibre/gui2/__init__.py
@@ -269,10 +269,14 @@ def question_dialog(parent, title, msg, det_msg='', show_copy_button=True,
return d.exec_() == yes_button
-def info_dialog(parent, title, msg, det_msg='', show=False):
+def info_dialog(parent, title, msg, det_msg='', show=False,
+ show_copy_button=True):
d = MessageBox(QMessageBox.Information, title, msg, QMessageBox.Ok,
parent, det_msg)
d.setIconPixmap(QPixmap(I('dialog_information.png')))
+ if not show_copy_button:
+ d.cb.setVisible(False)
+
if show:
return d.exec_()
return d
diff --git a/src/calibre/gui2/preferences/plugins.py b/src/calibre/gui2/preferences/plugins.py
index 8b4a221f56..c53c634ab4 100644
--- a/src/calibre/gui2/preferences/plugins.py
+++ b/src/calibre/gui2/preferences/plugins.py
@@ -77,6 +77,16 @@ class PluginModel(QAbstractItemModel): # {{{
return self.index(j, 0, parent)
return QModelIndex()
+ def plugin_to_index_by_properties(self, plugin):
+ for i, category in enumerate(self.categories):
+ parent = self.index(i, 0, QModelIndex())
+ for j, p in enumerate(self._data[category]):
+ if plugin.name == p.name and plugin.type == p.type and \
+ plugin.author == p.author and plugin.version == p.version:
+ return self.index(j, 0, parent)
+ return QModelIndex()
+
+
def refresh_plugin(self, plugin, rescan=False):
if rescan:
self.populate()
@@ -171,7 +181,13 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
_('Plugin {0} successfully installed under '
' {1} plugins. You may have to restart calibre '
'for the plugin to take effect.').format(plugin.name, plugin.type),
- show=True)
+ show=True, show_copy_button=False)
+ idx = self._plugin_model.plugin_to_index_by_properties(plugin)
+ if idx.isValid():
+ self.plugin_view.scrollTo(idx,
+ self.plugin_view.PositionAtCenter)
+ self.plugin_view.scrollTo(idx,
+ self.plugin_view.PositionAtCenter)
else:
error_dialog(self, _('No valid plugin path'),
_('%s is not a valid plugin path')%path).exec_()
@@ -201,10 +217,13 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
if plugin.do_user_config():
self._plugin_model.refresh_plugin(plugin)
elif op == 'remove':
+ msg = _('Plugin {0} successfully removed').format(plugin.name)
if remove_plugin(plugin):
self._plugin_model.populate()
self._plugin_model.reset()
self.changed_signal.emit()
+ info_dialog(self, _('Success'), msg, show=True,
+ show_copy_button=False)
else:
error_dialog(self, _('Cannot remove builtin plugin'),
plugin.name + _(' cannot be removed. It is a '
diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py
index 798420200a..a6eeabd57f 100644
--- a/src/calibre/gui2/ui.py
+++ b/src/calibre/gui2/ui.py
@@ -19,7 +19,7 @@ from PyQt4.Qt import Qt, SIGNAL, QTimer, \
QMessageBox, QHelpEvent
from calibre import prints
-from calibre.constants import __appname__, isosx, DEBUG
+from calibre.constants import __appname__, isosx
from calibre.ptempfile import PersistentTemporaryFile
from calibre.utils.config import prefs, dynamic
from calibre.utils.ipc.server import Server
diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py
index 48c62efffe..aa491aff28 100644
--- a/src/calibre/library/database2.py
+++ b/src/calibre/library/database2.py
@@ -298,8 +298,8 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
base,
prefer_custom=True)
- self.FIELD_MAP['ondevice'] = base+1
- self.field_metadata.set_field_record_index('ondevice', base+1, prefer_custom=False)
+ self.FIELD_MAP['ondevice'] = base = base+1
+ self.field_metadata.set_field_record_index('ondevice', base, prefer_custom=False)
script = '''
DROP VIEW IF EXISTS meta2;
@@ -1373,9 +1373,8 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
if r is not None:
if (now - r[self.FIELD_MAP['timestamp']]) > delta:
tags = r[self.FIELD_MAP['tags']]
- tags = tags.lower().split(',') if tags else []
- tags = [tag.strip() for tag in tags if tag.strip()]
- if tag in tags:
+ if tags and tag in [x.strip() for x in
+ tags.lower().split(',')]:
yield r[self.FIELD_MAP['id']]
def get_next_series_num_for(self, series):