mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Warn the user when enabling the DOuban metadata download plugin that it is useful only for Chinese language books
This commit is contained in:
parent
80916e811f
commit
2cebf59638
@ -153,7 +153,8 @@ class Douban(Source):
|
|||||||
author = 'Li Fanxi'
|
author = 'Li Fanxi'
|
||||||
version = (2, 0, 0)
|
version = (2, 0, 0)
|
||||||
|
|
||||||
description = _('Downloads metadata and covers from Douban.com')
|
description = _('Downloads metadata and covers from Douban.com. '
|
||||||
|
'Useful only for chinese language books.')
|
||||||
|
|
||||||
capabilities = frozenset(['identify', 'cover'])
|
capabilities = frozenset(['identify', 'cover'])
|
||||||
touched_fields = frozenset(['title', 'authors', 'tags',
|
touched_fields = frozenset(['title', 'authors', 'tags',
|
||||||
|
@ -17,12 +17,13 @@ from calibre.gui2.preferences.metadata_sources_ui import Ui_Form
|
|||||||
from calibre.ebooks.metadata.sources.base import msprefs
|
from calibre.ebooks.metadata.sources.base import msprefs
|
||||||
from calibre.customize.ui import (all_metadata_plugins, is_disabled,
|
from calibre.customize.ui import (all_metadata_plugins, is_disabled,
|
||||||
enable_plugin, disable_plugin, default_disabled_plugins)
|
enable_plugin, disable_plugin, default_disabled_plugins)
|
||||||
from calibre.gui2 import NONE, error_dialog
|
from calibre.gui2 import NONE, error_dialog, question_dialog
|
||||||
|
|
||||||
class SourcesModel(QAbstractTableModel): # {{{
|
class SourcesModel(QAbstractTableModel): # {{{
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
QAbstractTableModel.__init__(self, parent)
|
QAbstractTableModel.__init__(self, parent)
|
||||||
|
self.gui_parent = parent
|
||||||
|
|
||||||
self.plugins = []
|
self.plugins = []
|
||||||
self.enabled_overrides = {}
|
self.enabled_overrides = {}
|
||||||
@ -87,6 +88,15 @@ class SourcesModel(QAbstractTableModel): # {{{
|
|||||||
if col == 0 and role == Qt.CheckStateRole:
|
if col == 0 and role == Qt.CheckStateRole:
|
||||||
val, ok = val.toInt()
|
val, ok = val.toInt()
|
||||||
if ok:
|
if ok:
|
||||||
|
if val == Qt.Checked and 'Douban' in plugin.name:
|
||||||
|
if not question_dialog(self.gui_parent,
|
||||||
|
_('Are you sure?'), '<p>'+
|
||||||
|
_('This plugin is useful only for <b>Chinese</b>'
|
||||||
|
' language books. It can return incorrect'
|
||||||
|
' results for books in English. Are you'
|
||||||
|
' sure you want to enable it?'),
|
||||||
|
show_copy_button=False):
|
||||||
|
return ret
|
||||||
self.enabled_overrides[plugin] = val
|
self.enabled_overrides[plugin] = val
|
||||||
ret = True
|
ret = True
|
||||||
if col == 1 and role == Qt.EditRole:
|
if col == 1 and role == Qt.EditRole:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user