mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Merge from trunk
This commit is contained in:
commit
0ed69b6ea1
@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
__license__ = 'GPL v3'
|
||||
__author__ = 'Lorenzo Vigentini'
|
||||
__copyright__ = '2009, Lorenzo Vigentini <l.vigentini at gmail.com>'
|
||||
__version__ = 'v1.01'
|
||||
__date__ = '14, January 2010'
|
||||
__description__ = 'Computeractive publishes new downloads, reviews, news stories, step-by-step guides and answers to PC problems every day.'
|
||||
__author__ = 'DrMerry Based on v1.01 by Lorenzo Vigentini'
|
||||
__copyright__ = 'For version 1.02: DrMerry'
|
||||
__version__ = 'v1.02'
|
||||
__date__ = '08, July 2011'
|
||||
__description__ = 'Computeractive publishes new downloads, reviews, news stories, step-by-step guides and answers to PC problems every day. Original version (c): 2009, Lorenzo Vigentini <l.vigentini at gmail.com>'
|
||||
|
||||
'''
|
||||
http://www.computeractive.co.uk/
|
||||
@ -33,12 +33,12 @@ class computeractive(BasicNewsRecipe):
|
||||
no_stylesheets = True
|
||||
|
||||
keep_only_tags = [
|
||||
dict(name='div', attrs={'id':'main'})
|
||||
dict(name='div', attrs={'id':'container_left'})
|
||||
]
|
||||
|
||||
remove_tags = [
|
||||
dict(name='div', attrs={'id':['seeAlsoTags','commentsModule','relatedArticles','mainLeft','mainRight']}),
|
||||
dict(name='div', attrs={'class':['buyIt','detailMpu']}),
|
||||
dict(name='div', attrs={'id':['seeAlsoTags','commentsModule','relatedArticles','mainLeft','mainRight','recent_comment_block_parent','reviewDetails']}),
|
||||
dict(name='div', attrs={'class':['buyIt','detailMpu','small_section','recent_comment_block_parent','title_right_button_fix','section_title.title_right_button_fix','common_button']}),
|
||||
dict(name='a', attrs={'class':'largerImage'})
|
||||
]
|
||||
|
||||
|
@ -284,7 +284,7 @@ class EditMetadataAction(InterfaceAction):
|
||||
if not confirm('<p>'+_(
|
||||
'Book formats from the selected books will be merged '
|
||||
'into the <b>first selected book</b> (%s). '
|
||||
'Metadata in the first selected book will not be changed.'
|
||||
'Metadata in the first selected book will not be changed. '
|
||||
'Author, Title, ISBN and all other metadata will <i>not</i> be merged.<br><br>'
|
||||
'After merger the second and subsequently '
|
||||
'selected books, with any metadata they have will be <b>deleted</b>. <br><br>'
|
||||
|
@ -155,7 +155,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
return
|
||||
if self.argument_count.value() == 0:
|
||||
box = warning_dialog(self.gui, _('Template functions'),
|
||||
_('Argument count should be -1 or greater than zero.'
|
||||
_('Argument count should be -1 or greater than zero. '
|
||||
'Setting it to zero means that this function cannot '
|
||||
'be used in single function mode.'), det_msg = '',
|
||||
show=False)
|
||||
|
@ -12,7 +12,7 @@ import traceback, cPickle, copy
|
||||
from itertools import repeat
|
||||
|
||||
from PyQt4.Qt import (QAbstractItemModel, QIcon, QVariant, QFont, Qt,
|
||||
QMimeData, QModelIndex, pyqtSignal)
|
||||
QMimeData, QModelIndex, pyqtSignal, QObject)
|
||||
|
||||
from calibre.gui2 import NONE, gprefs, config, error_dialog
|
||||
from calibre.library.database2 import Tag
|
||||
@ -227,6 +227,10 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
self._build_in_progress = False
|
||||
self.reread_collapse_model({}, rebuild=False)
|
||||
|
||||
@property
|
||||
def gui_parent(self):
|
||||
return QObject.parent(self)
|
||||
|
||||
def reread_collapse_model(self, state_map, rebuild=True):
|
||||
if gprefs['tags_browser_collapse_at'] == 0:
|
||||
self.collapse_model = 'disable'
|
||||
@ -726,12 +730,12 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
if (key == 'authors' and len(ids) >= 5):
|
||||
if not confirm('<p>'+_('Changing the authors for several books can '
|
||||
'take a while. Are you sure?')
|
||||
+'</p>', 'tag_browser_drop_authors', self.parent()):
|
||||
+'</p>', 'tag_browser_drop_authors', self.gui_parent):
|
||||
return
|
||||
elif len(ids) > 15:
|
||||
if not confirm('<p>'+_('Changing the metadata for that many books '
|
||||
'can take a while. Are you sure?')
|
||||
+'</p>', 'tag_browser_many_changes', self.parent()):
|
||||
+'</p>', 'tag_browser_many_changes', self.gui_parent):
|
||||
return
|
||||
|
||||
fm = self.db.metadata_for_field(key)
|
||||
@ -875,13 +879,13 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
# we position at the parent label
|
||||
val = unicode(value.toString()).strip()
|
||||
if not val:
|
||||
error_dialog(self.parent(), _('Item is blank'),
|
||||
error_dialog(self.gui_parent, _('Item is blank'),
|
||||
_('An item cannot be set to nothing. Delete it instead.')).exec_()
|
||||
return False
|
||||
item = self.get_node(index)
|
||||
if item.type == TagTreeItem.CATEGORY and item.category_key.startswith('@'):
|
||||
if val.find('.') >= 0:
|
||||
error_dialog(self.parent(), _('Rename user category'),
|
||||
error_dialog(self.gui_parent, _('Rename user category'),
|
||||
_('You cannot use periods in the name when '
|
||||
'renaming user categories'), show=True)
|
||||
return False
|
||||
@ -901,7 +905,7 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
if len(c) == len(ckey):
|
||||
if strcmp(ckey, nkey) != 0 and \
|
||||
nkey_lower in user_cat_keys_lower:
|
||||
error_dialog(self.parent(), _('Rename user category'),
|
||||
error_dialog(self.gui_parent, _('Rename user category'),
|
||||
_('The name %s is already used')%nkey, show=True)
|
||||
return False
|
||||
user_cats[nkey] = user_cats[ckey]
|
||||
@ -910,7 +914,7 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
rest = c[len(ckey):]
|
||||
if strcmp(ckey, nkey) != 0 and \
|
||||
icu_lower(nkey + rest) in user_cat_keys_lower:
|
||||
error_dialog(self.parent(), _('Rename user category'),
|
||||
error_dialog(self.gui_parent, _('Rename user category'),
|
||||
_('The name %s is already used')%(nkey+rest), show=True)
|
||||
return False
|
||||
user_cats[nkey + rest] = user_cats[ckey + rest]
|
||||
@ -925,12 +929,12 @@ class TagsModel(QAbstractItemModel): # {{{
|
||||
return False
|
||||
if key == 'authors':
|
||||
if val.find('&') >= 0:
|
||||
error_dialog(self.parent(), _('Invalid author name'),
|
||||
error_dialog(self.gui_parent, _('Invalid author name'),
|
||||
_('Author names cannot contain & characters.')).exec_()
|
||||
return False
|
||||
if key == 'search':
|
||||
if val in saved_searches().names():
|
||||
error_dialog(self.parent(), _('Duplicate search name'),
|
||||
error_dialog(self.gui_parent, _('Duplicate search name'),
|
||||
_('The saved search name %s is already used.')%val).exec_()
|
||||
return False
|
||||
saved_searches().rename(unicode(item.data(role).toString()), val)
|
||||
|
Loading…
x
Reference in New Issue
Block a user