mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 03:53:51 +02:00
Merge from trunk
This commit is contained in:
commit
91d2e1e282
4 changed files with 30 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -77,6 +77,16 @@ def plugin_to_index(self, plugin):
|
|||
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 @@ def add_plugin(self):
|
|||
_('Plugin <b>{0}</b> successfully installed under <b>'
|
||||
' {1} plugins</b>. 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 @@ def modify_plugin(self, op=''):
|
|||
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 '
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
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
|
||||
|
|
|
|||
|
|
@ -298,8 +298,8 @@ def migrate_preference(key, default):
|
|||
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 @@ def tags_older_than(self, tag, delta):
|
|||
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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue