Fix Preferences menu and update Globe and Mail recipe

This commit is contained in:
Kovid Goyal 2009-06-21 09:20:22 -07:00
parent 2d2fadcbd6
commit 61677b6980
3 changed files with 76 additions and 45 deletions

View File

@ -70,6 +70,8 @@ def option_recommendation_to_cli_option(add_option, rec):
switches.append('--'+opt.long_switch)
attrs = dict(dest=opt.name, help=opt.help,
choices=opt.choices, default=rec.recommended_value)
if opt.long_switch == 'verbose':
attrs['action'] = 'count'
if isinstance(rec.recommended_value, type(True)):
attrs['action'] = 'store_false' if rec.recommended_value else \
'store_true'

View File

@ -315,10 +315,14 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
SIGNAL('triggered(bool)'), self.convert_single)
self.convert_menu = cm
pm = QMenu()
pm.addAction(self.action_preferences)
ap = self.action_preferences
pm.addAction(ap.icon(), ap.text())
pm.addAction(_('Run welcome wizard'))
self.connect(pm.actions()[1], SIGNAL('triggered(bool)'),
self.run_wizard)
self.connect(pm.actions()[0], SIGNAL('triggered(bool)'),
self.do_config)
self.action_preferences.setMenu(pm)
self.preferences_menu = pm

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
@ -10,35 +11,59 @@ globeandmail.com
from calibre.web.feeds.news import BasicNewsRecipe
class GlobeAndMail(BasicNewsRecipe):
title = 'Globe and Mail'
__author__ = 'Kovid Goyal'
title = u'Globe and Mail'
language = _('English')
oldest_article = 2.0
__author__ = 'Kovid Goyal'
oldest_article = 2
max_articles_per_feed = 10
no_stylesheets = True
extra_css = '''
h3 {font-size: 22pt; font-weight:bold; margin:0px; padding:0px 0px 8pt 0px;}
h4 {margin-top: 0px;}
#byline { font-family: monospace; font-weight:bold; }
#placeline {font-weight:bold;}
#credit {margin-top:0px;}
.tag {font-size: 22pt;}'''
description = 'Canada\'s national newspaper'
remove_tags_before = dict(id="article-top")
remove_tags = [
{'id':['util', 'article-tabs', 'comments', 'article-relations',
'gallery-controls', 'video', 'galleryLoading']},
'gallery-controls', 'video', 'galleryLoading','deck','header'] },
{'class':['credit','inline-img-caption','tab-pointer'] },
dict(name='div', attrs={'id':'lead-photo'}),
dict(name='div', attrs={'class':'right'}),
dict(name='div', attrs={'id':'footer'}),
dict(name='div', attrs={'id':'beta-msg'}),
dict(name='img', attrs={'class':'headshot'}),
dict(name='div', attrs={'class':'brand'}),
dict(name='div', attrs={'id':'nav-wrap'}),
dict(name='div', attrs={'id':'featureTopics'}),
dict(name='div', attrs={'id':'videoNav'}),
dict(name='div', attrs={'id':'blog-header'}),
dict(name='div', attrs={'id':'right-rail'}),
dict(name='div', attrs={'id':'group-footer-container'}),
dict(name=['iframe','img'])
]
remove_tags_after = [{'id':['article-content']},
{'class':['pull','inline-img'] },
dict(name='img', attrs={'class':'inline-media-embed'}),
]
remove_tags_after = dict(id='article-content')
feeds = [
('Latest headlines', 'http://www.theglobeandmail.com/?service=rss'),
('Top stories', 'http://www.theglobeandmail.com/?service=rss&feed=topstories'),
('National', 'http://www.theglobeandmail.com/news/national/?service=rss'),
('Politics', 'http://www.theglobeandmail.com/news/politics/?service=rss'),
('World', 'http://www.theglobeandmail.com/news/world/?service=rss'),
('Business', 'http://www.theglobeandmail.com/report-on-business/?service=rss'),
('Opinions', 'http://www.theglobeandmail.com/news/opinions/?service=rss'),
('Columnists', 'http://www.theglobeandmail.com/news/opinions/columnists/?service=rss'),
('Globe Investor', 'http://www.theglobeandmail.com/globe-investor/?service=rss'),
('Sports', 'http://www.theglobeandmail.com/sports/?service=rss'),
('Technology', 'http://www.theglobeandmail.com/news/technology/?service=rss'),
('Arts', 'http://www.theglobeandmail.com/news/arts/?service=rss'),
('Life', 'http://www.theglobeandmail.com/life/?service=rss'),
('Blogs', 'http://www.theglobeandmail.com/blogs/?service=rss'),
('Real Estate', 'http://www.theglobeandmail.com/real-estate/?service=rss'),
('Auto', 'http://www.theglobeandmail.com/auto/?service=rss'),
(u'Latest headlines', u'http://www.theglobeandmail.com/?service=rss'),
(u'Top stories', u'http://www.theglobeandmail.com/?service=rss&feed=topstories'),
(u'National', u'http://www.theglobeandmail.com/news/national/?service=rss'),
(u'Politics', u'http://www.theglobeandmail.com/news/politics/?service=rss'),
(u'World', u'http://www.theglobeandmail.com/news/world/?service=rss'),
(u'Business', u'http://www.theglobeandmail.com/report-on-business/?service=rss'),
(u'Opinions', u'http://www.theglobeandmail.com/news/opinions/?service=rss'),
(u'Columnists', u'http://www.theglobeandmail.com/news/opinions/columnists/?service=rss'),
(u'Globe Investor', u'http://www.theglobeandmail.com/globe-investor/?service=rss'),
(u'Sports', u'http://www.theglobeandmail.com/sports/?service=rss'),
(u'Technology', u'http://www.theglobeandmail.com/news/technology/?service=rss'),
(u'Arts', u'http://www.theglobeandmail.com/news/arts/?service=rss'),
(u'Life', u'http://www.theglobeandmail.com/life/?service=rss'),
(u'Blogs', u'http://www.theglobeandmail.com/blogs/?service=rss'),
(u'Real Estate', u'http://www.theglobeandmail.com/real-estate/?service=rss'),
(u'Auto', u'http://www.theglobeandmail.com/auto/?service=rss')
]