mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Modify author sort tooltip to explain the color. Fix #6836 (Updated recipe for Adventure Gamers)
This commit is contained in:
parent
32381d8030
commit
307f90457d
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2009-2010, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
www.adventuregamers.com
|
www.adventuregamers.com
|
||||||
'''
|
'''
|
||||||
@ -11,13 +9,10 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
|||||||
class AdventureGamers(BasicNewsRecipe):
|
class AdventureGamers(BasicNewsRecipe):
|
||||||
title = u'Adventure Gamers'
|
title = u'Adventure Gamers'
|
||||||
language = 'en'
|
language = 'en'
|
||||||
|
|
||||||
__author__ = 'Darko Miletic'
|
__author__ = 'Darko Miletic'
|
||||||
description = 'Adventure games portal'
|
description = 'Adventure games portal'
|
||||||
publisher = 'Adventure Gamers'
|
publisher = 'Adventure Gamers'
|
||||||
category = 'news, games, adventure, technology'
|
category = 'news, games, adventure, technology'
|
||||||
language = 'en'
|
|
||||||
|
|
||||||
oldest_article = 10
|
oldest_article = 10
|
||||||
delay = 10
|
delay = 10
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
@ -26,14 +21,25 @@ class AdventureGamers(BasicNewsRecipe):
|
|||||||
remove_javascript = True
|
remove_javascript = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
INDEX = u'http://www.adventuregamers.com'
|
INDEX = u'http://www.adventuregamers.com'
|
||||||
|
extra_css = """
|
||||||
|
.pageheader_type{font-size: x-large; font-weight: bold; color: #828D74}
|
||||||
|
.pageheader_title{font-size: xx-large; color: #394128}
|
||||||
|
.pageheader_byline{font-size: small; font-weight: bold; color: #394128}
|
||||||
|
.score_bg {display: inline; width: 100%; margin-bottom: 2em}
|
||||||
|
.score_column_1{ padding-left: 10px; font-size: small; width: 50%}
|
||||||
|
.score_column_2{ padding-left: 10px; font-size: small; width: 50%}
|
||||||
|
.score_column_3{ padding-left: 10px; font-size: small; width: 50%}
|
||||||
|
.score_header{font-size: large; color: #50544A}
|
||||||
|
.bodytext{display: block}
|
||||||
|
body{font-family: Helvetica,Arial,sans-serif}
|
||||||
|
"""
|
||||||
|
|
||||||
html2lrf_options = [
|
conversion_options = {
|
||||||
'--comment', description
|
'comment' : description
|
||||||
, '--category', category
|
, 'tags' : category
|
||||||
, '--publisher', publisher
|
, 'publisher' : publisher
|
||||||
]
|
, 'language' : language
|
||||||
|
}
|
||||||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
|
|
||||||
|
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
dict(name='div', attrs={'class':'content_middle'})
|
dict(name='div', attrs={'class':'content_middle'})
|
||||||
@ -45,6 +51,7 @@ class AdventureGamers(BasicNewsRecipe):
|
|||||||
]
|
]
|
||||||
|
|
||||||
remove_tags_after = [dict(name='div', attrs={'class':'toolbar_fat'})]
|
remove_tags_after = [dict(name='div', attrs={'class':'toolbar_fat'})]
|
||||||
|
remove_attributes = ['width','height']
|
||||||
|
|
||||||
feeds = [(u'Articles', u'http://feeds2.feedburner.com/AdventureGamers')]
|
feeds = [(u'Articles', u'http://feeds2.feedburner.com/AdventureGamers')]
|
||||||
|
|
||||||
@ -66,12 +73,12 @@ class AdventureGamers(BasicNewsRecipe):
|
|||||||
|
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
mtag = '<meta http-equiv="Content-Language" content="en-US"/>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>'
|
|
||||||
soup.head.insert(0,mtag)
|
|
||||||
for item in soup.findAll(style=True):
|
for item in soup.findAll(style=True):
|
||||||
del item['style']
|
del item['style']
|
||||||
|
for item in soup.findAll('div', attrs={'class':'floatright'}):
|
||||||
|
item.extract()
|
||||||
self.append_page(soup, soup.body, 3)
|
self.append_page(soup, soup.body, 3)
|
||||||
pager = soup.find('div',attrs={'class':'toolbar_fat'})
|
pager = soup.find('div',attrs={'class':'toolbar_fat'})
|
||||||
if pager:
|
if pager:
|
||||||
pager.extract()
|
pager.extract()
|
||||||
return soup
|
return self.adeify_images(soup)
|
||||||
|
@ -6,10 +6,7 @@ The dialog used to edit meta information for a book as well as
|
|||||||
add/remove formats
|
add/remove formats
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import os
|
import os, re, time, traceback, textwrap
|
||||||
import re
|
|
||||||
import time
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
from PyQt4.Qt import SIGNAL, QObject, Qt, QTimer, QThread, QDate, \
|
from PyQt4.Qt import SIGNAL, QObject, Qt, QTimer, QThread, QDate, \
|
||||||
QPixmap, QListWidgetItem, QDialog, pyqtSignal
|
QPixmap, QListWidgetItem, QDialog, pyqtSignal
|
||||||
@ -331,6 +328,7 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
ResizableDialog.__init__(self, window)
|
ResizableDialog.__init__(self, window)
|
||||||
self.bc_box.layout().setAlignment(self.cover, Qt.AlignCenter|Qt.AlignHCenter)
|
self.bc_box.layout().setAlignment(self.cover, Qt.AlignCenter|Qt.AlignHCenter)
|
||||||
self.cancel_all = False
|
self.cancel_all = False
|
||||||
|
self.normal_aus_tooltip = unicode(self.author_sort.toolTip())
|
||||||
if cancel_all:
|
if cancel_all:
|
||||||
self.__abort_button = self.button_box.addButton(self.button_box.Abort)
|
self.__abort_button = self.button_box.addButton(self.button_box.Abort)
|
||||||
self.__abort_button.setToolTip(_('Abort the editing of all remaining books'))
|
self.__abort_button.setToolTip(_('Abort the editing of all remaining books'))
|
||||||
@ -454,6 +452,9 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
else:
|
else:
|
||||||
self.create_custom_column_editors()
|
self.create_custom_column_editors()
|
||||||
self.generate_cover_button.clicked.connect(self.generate_cover)
|
self.generate_cover_button.clicked.connect(self.generate_cover)
|
||||||
|
self.author_sort.setToolTip(textwrap.fill('<p>'+self.normal_aus_tooltip+'<br><br>'+
|
||||||
|
_(' The green color indicates that the current '
|
||||||
|
'author sort matches the current author')))
|
||||||
|
|
||||||
def create_custom_column_editors(self):
|
def create_custom_column_editors(self):
|
||||||
w = self.central_widget.widget(1)
|
w = self.central_widget.widget(1)
|
||||||
@ -490,6 +491,12 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
|||||||
col = 'rgb(255, 0, 0, 20%)'
|
col = 'rgb(255, 0, 0, 20%)'
|
||||||
self.author_sort.setStyleSheet('QLineEdit { color: black; '
|
self.author_sort.setStyleSheet('QLineEdit { color: black; '
|
||||||
'background-color: %s; }'%col)
|
'background-color: %s; }'%col)
|
||||||
|
tt = self.normal_aus_tooltip
|
||||||
|
if not normal:
|
||||||
|
tt = '<p>'+textwrap.fill(tt + '<br><br>'+
|
||||||
|
_(' The red color indicates that the current '
|
||||||
|
'author sort does not match the current author'))
|
||||||
|
self.author_sort.setToolTip(tt)
|
||||||
|
|
||||||
def validate_isbn(self, isbn):
|
def validate_isbn(self, isbn):
|
||||||
isbn = unicode(isbn).strip()
|
isbn = unicode(isbn).strip()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user