Merge from trunk

This commit is contained in:
Charles Haley 2011-07-08 17:46:47 +01:00
commit 0ed69b6ea1
4 changed files with 23 additions and 19 deletions

View File

@ -1,10 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__author__ = 'Lorenzo Vigentini' __author__ = 'DrMerry Based on v1.01 by Lorenzo Vigentini'
__copyright__ = '2009, Lorenzo Vigentini <l.vigentini at gmail.com>' __copyright__ = 'For version 1.02: DrMerry'
__version__ = 'v1.01' __version__ = 'v1.02'
__date__ = '14, January 2010' __date__ = '08, July 2011'
__description__ = 'Computeractive publishes new downloads, reviews, news stories, step-by-step guides and answers to PC problems every day.' __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/ http://www.computeractive.co.uk/
@ -33,12 +33,12 @@ class computeractive(BasicNewsRecipe):
no_stylesheets = True no_stylesheets = True
keep_only_tags = [ keep_only_tags = [
dict(name='div', attrs={'id':'main'}) dict(name='div', attrs={'id':'container_left'})
] ]
remove_tags = [ remove_tags = [
dict(name='div', attrs={'id':['seeAlsoTags','commentsModule','relatedArticles','mainLeft','mainRight']}), dict(name='div', attrs={'id':['seeAlsoTags','commentsModule','relatedArticles','mainLeft','mainRight','recent_comment_block_parent','reviewDetails']}),
dict(name='div', attrs={'class':['buyIt','detailMpu']}), 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'}) dict(name='a', attrs={'class':'largerImage'})
] ]

View File

@ -284,7 +284,7 @@ class EditMetadataAction(InterfaceAction):
if not confirm('<p>'+_( if not confirm('<p>'+_(
'Book formats from the selected books will be merged ' 'Book formats from the selected books will be merged '
'into the <b>first selected book</b> (%s). ' '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>' 'Author, Title, ISBN and all other metadata will <i>not</i> be merged.<br><br>'
'After merger the second and subsequently ' 'After merger the second and subsequently '
'selected books, with any metadata they have will be <b>deleted</b>. <br><br>' 'selected books, with any metadata they have will be <b>deleted</b>. <br><br>'

View File

@ -155,7 +155,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
return return
if self.argument_count.value() == 0: if self.argument_count.value() == 0:
box = warning_dialog(self.gui, _('Template functions'), 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 ' 'Setting it to zero means that this function cannot '
'be used in single function mode.'), det_msg = '', 'be used in single function mode.'), det_msg = '',
show=False) show=False)

View File

@ -12,7 +12,7 @@ import traceback, cPickle, copy
from itertools import repeat from itertools import repeat
from PyQt4.Qt import (QAbstractItemModel, QIcon, QVariant, QFont, Qt, 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.gui2 import NONE, gprefs, config, error_dialog
from calibre.library.database2 import Tag from calibre.library.database2 import Tag
@ -227,6 +227,10 @@ class TagsModel(QAbstractItemModel): # {{{
self._build_in_progress = False self._build_in_progress = False
self.reread_collapse_model({}, rebuild=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): def reread_collapse_model(self, state_map, rebuild=True):
if gprefs['tags_browser_collapse_at'] == 0: if gprefs['tags_browser_collapse_at'] == 0:
self.collapse_model = 'disable' self.collapse_model = 'disable'
@ -726,12 +730,12 @@ class TagsModel(QAbstractItemModel): # {{{
if (key == 'authors' and len(ids) >= 5): if (key == 'authors' and len(ids) >= 5):
if not confirm('<p>'+_('Changing the authors for several books can ' if not confirm('<p>'+_('Changing the authors for several books can '
'take a while. Are you sure?') 'take a while. Are you sure?')
+'</p>', 'tag_browser_drop_authors', self.parent()): +'</p>', 'tag_browser_drop_authors', self.gui_parent):
return return
elif len(ids) > 15: elif len(ids) > 15:
if not confirm('<p>'+_('Changing the metadata for that many books ' if not confirm('<p>'+_('Changing the metadata for that many books '
'can take a while. Are you sure?') 'can take a while. Are you sure?')
+'</p>', 'tag_browser_many_changes', self.parent()): +'</p>', 'tag_browser_many_changes', self.gui_parent):
return return
fm = self.db.metadata_for_field(key) fm = self.db.metadata_for_field(key)
@ -875,13 +879,13 @@ class TagsModel(QAbstractItemModel): # {{{
# we position at the parent label # we position at the parent label
val = unicode(value.toString()).strip() val = unicode(value.toString()).strip()
if not val: 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_() _('An item cannot be set to nothing. Delete it instead.')).exec_()
return False return False
item = self.get_node(index) item = self.get_node(index)
if item.type == TagTreeItem.CATEGORY and item.category_key.startswith('@'): if item.type == TagTreeItem.CATEGORY and item.category_key.startswith('@'):
if val.find('.') >= 0: 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 ' _('You cannot use periods in the name when '
'renaming user categories'), show=True) 'renaming user categories'), show=True)
return False return False
@ -901,7 +905,7 @@ class TagsModel(QAbstractItemModel): # {{{
if len(c) == len(ckey): if len(c) == len(ckey):
if strcmp(ckey, nkey) != 0 and \ if strcmp(ckey, nkey) != 0 and \
nkey_lower in user_cat_keys_lower: 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) _('The name %s is already used')%nkey, show=True)
return False return False
user_cats[nkey] = user_cats[ckey] user_cats[nkey] = user_cats[ckey]
@ -910,7 +914,7 @@ class TagsModel(QAbstractItemModel): # {{{
rest = c[len(ckey):] rest = c[len(ckey):]
if strcmp(ckey, nkey) != 0 and \ if strcmp(ckey, nkey) != 0 and \
icu_lower(nkey + rest) in user_cat_keys_lower: 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) _('The name %s is already used')%(nkey+rest), show=True)
return False return False
user_cats[nkey + rest] = user_cats[ckey + rest] user_cats[nkey + rest] = user_cats[ckey + rest]
@ -925,12 +929,12 @@ class TagsModel(QAbstractItemModel): # {{{
return False return False
if key == 'authors': if key == 'authors':
if val.find('&') >= 0: 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_() _('Author names cannot contain & characters.')).exec_()
return False return False
if key == 'search': if key == 'search':
if val in saved_searches().names(): 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_() _('The saved search name %s is already used.')%val).exec_()
return False return False
saved_searches().rename(unicode(item.data(role).toString()), val) saved_searches().rename(unicode(item.data(role).toString()), val)