From 88709bb88ffbdc2cd5972987b89b4047fde831b2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 29 May 2011 11:06:56 -0600 Subject: [PATCH 1/4] Windows installer: Remember and use previous settings for installing desktop icons, adding to path, etc. --- setup/installer/windows/wix-template.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/setup/installer/windows/wix-template.xml b/setup/installer/windows/wix-template.xml index d4bfbc3c7c..0a85b6fb81 100644 --- a/setup/installer/windows/wix-template.xml +++ b/setup/installer/windows/wix-template.xml @@ -17,6 +17,7 @@ IncludeMaximum="yes" OnlyDetect="no" Language="1033" + MigrateFeatures="yes" Property="OLDPRODUCTFOUND"/> Date: Sun, 29 May 2011 11:26:35 -0600 Subject: [PATCH 2/4] Observatorul cultural by song2 and update Dilema Veche --- recipes/dilemaveche.recipe | 116 +++++++++++++++------------ recipes/observatorul_cultural.recipe | 64 +++++++++++++++ 2 files changed, 130 insertions(+), 50 deletions(-) create mode 100644 recipes/observatorul_cultural.recipe diff --git a/recipes/dilemaveche.recipe b/recipes/dilemaveche.recipe index 0d5013b287..8ba75c4123 100644 --- a/recipes/dilemaveche.recipe +++ b/recipes/dilemaveche.recipe @@ -1,55 +1,71 @@ -# -*- coding: utf-8 -*- -#!/usr/bin/env python - -__license__ = 'GPL v3' -__copyright__ = u'2011, Silviu Cotoar\u0103' -''' -dilemaveche.ro -''' - from calibre.web.feeds.news import BasicNewsRecipe class DilemaVeche(BasicNewsRecipe): - title = u'Dilema Veche' - __author__ = u'Silviu Cotoar\u0103' - description = u'Sunt vechi, domnule!' - publisher = u'Dilema Veche' - oldest_article = 50 - language = 'ro' - max_articles_per_feed = 100 - no_stylesheets = True - use_embedded_content = False - category = 'Ziare' - encoding = 'utf-8' - cover_url = 'http://www.dilemaveche.ro/sites/all/themes/dilema/theme/dilema_two/layouter/dilema_two_homepage/logo.png' - - conversion_options = { - 'comments' : description - ,'tags' : category - ,'language' : language - ,'publisher' : publisher - } - - keep_only_tags = [ - dict(name='h1', attrs={'class':'art_title'}) - , dict(name='h1', attrs={'class':'art_title online'}) - , dict(name='div', attrs={'class':'item'}) - , dict(name='div', attrs={'class':'art_content'}) - ] - + title = u'Dilema Veche' # apare vinerea, mai pe dupa-masa,depinde de Luiza cred (care se semneaza ca fiind creatorul fiecarui articol in feed-ul RSS) + __author__ = 'song2' # inspirat din scriptul pentru Le Monde. Inspired from the Le Monde script + description = '"Sint vechi, domnule!" (I.L. Caragiale)' + publisher = 'Adevarul Holding' + oldest_article = 7 + max_articles_per_feed = 200 + encoding = 'utf8' + language = 'ro' + masthead_url = 'http://www.dilemaveche.ro/sites/all/themes/dilema/theme/dilema_two/layouter/dilema_two_homepage/logo.png' + publication_type = 'magazine' + feeds = [ + ('Editoriale si opinii - Situatiunea', 'http://www.dilemaveche.ro/taxonomy/term/37/0/feed'), + ('Editoriale si opinii - Pe ce lume traim', 'http://www.dilemaveche.ro/taxonomy/term/38/0/feed'), + ('Editoriale si opinii - Bordeie si obiceie', 'http://www.dilemaveche.ro/taxonomy/term/44/0/feed'), + ('Editoriale si opinii - Talc Show', 'http://www.dilemaveche.ro/taxonomy/term/44/0/feed'), + ('Tema saptamanii', 'http://www.dilemaveche.ro/taxonomy/term/19/0/feed'), + ('La zi in cultura - Dilema va recomanda', 'http://www.dilemaveche.ro/taxonomy/term/58/0/feed'), + ('La zi in cultura - Carte', 'http://www.dilemaveche.ro/taxonomy/term/14/0/feed'), + ('La zi in cultura - Film', 'http://www.dilemaveche.ro/taxonomy/term/13/0/feed'), + ('La zi in cultura - Muzica', 'http://www.dilemaveche.ro/taxonomy/term/1341/0/feed'), + ('La zi in cultura - Arte performative', 'http://www.dilemaveche.ro/taxonomy/term/1342/0/feed'), + ('La zi in cultura - Arte vizuale', 'http://www.dilemaveche.ro/taxonomy/term/1512/0/feed'), + ('Societate - Ieri cu vedere spre azi', 'http://www.dilemaveche.ro/taxonomy/term/15/0/feed'), + ('Societate - Din polul opus', 'http://www.dilemaveche.ro/taxonomy/term/41/0/feed'), + ('Societate - Mass comedia', 'http://www.dilemaveche.ro/taxonomy/term/43/0/feed'), + ('Societate - La singular si la plural', 'http://www.dilemaveche.ro/taxonomy/term/42/0/feed'), + ('Oameni si idei - Educatie', 'http://www.dilemaveche.ro/taxonomy/term/46/0/feed'), + ('Oameni si idei - Polemici si dezbateri', 'http://www.dilemaveche.ro/taxonomy/term/48/0/feed'), + ('Oameni si idei - Stiinta si tehnologie', 'http://www.dilemaveche.ro/taxonomy/term/46/0/feed'), + ('Dileme on-line', 'http://www.dilemaveche.ro/taxonomy/term/005/0/feed') + ] + remove_tags_before = dict(name='div',attrs={'class':'spacer_10'}) remove_tags = [ - dict(name='div', attrs={'class':['article_details']}) - , dict(name='div', attrs={'class':['controale']}) - , dict(name='div', attrs={'class':['art_related_left']}) - ] + dict(name='div', attrs={'class':'art_related_left'}), + dict(name='div', attrs={'class':'controale'}), + dict(name='div', attrs={'class':'simple_overlay'}), + ] + remove_tags_after = [dict(id='facebookLike')] + remove_javascript = True + no_stylesheets = True + remove_empty_feeds = True + extra_css = """ + body{font-family: Georgia,Times,serif } + img{margin-bottom: 0.4em; display:block} + """ + def get_cover_url(self): + cover_url = None + soup = self.index_to_soup('http://dilemaveche.ro') + link_item = soup.find('div',attrs={'class':'box_dr_pdf_picture'}) + if link_item and link_item.a: + cover_url = link_item.a['href'] + br = BasicNewsRecipe.get_browser() + try: + br.open(cover_url) + except: #daca nu gaseste pdf-ul + self.log("\nPDF indisponibil") + link_item = soup.find('div',attrs={'class':'box_dr_pdf_picture'}) + if link_item and link_item.img: + cover_url = link_item.img['src'] + br = BasicNewsRecipe.get_browser() + try: + br.open(cover_url) + except: #daca nu gaseste nici imaginea mica mica + print('Mama lor de nenorociti! nu este nici pdf nici imagine') + cover_url ='http://www.dilemaveche.ro/sites/all/themes/dilema/theme/dilema_two/layouter/dilema_two_homepage/logo.png' + return cover_url + cover_margins = (10, 15, '#ffffff') - remove_tags_after = [ - dict(name='div', attrs={'class':['article_details']}) - ] - - feeds = [ - (u'Feeds', u'http://www.dilemaveche.ro/rss.xml') - ] - - def preprocess_html(self, soup): - return self.adeify_images(soup) diff --git a/recipes/observatorul_cultural.recipe b/recipes/observatorul_cultural.recipe new file mode 100644 index 0000000000..0d64334fd5 --- /dev/null +++ b/recipes/observatorul_cultural.recipe @@ -0,0 +1,64 @@ +import re +from calibre.web.feeds.news import BasicNewsRecipe +coverpage = None + +class ObservatorulCultural(BasicNewsRecipe): + title = u'Observatorul cultural' + __author__ = 'song2' #prelucrat dupa un script de http://www.thenowhereman.com + encoding = 'utf-8' + language = 'ro' + publication_type = 'magazine' + description = 'Spiritul critic in acÅĢiune\n' + no_stylesheets = True + remove_javascript = True + masthead_url='http://www.observatorcultural.ro/userfiles/article/sigla%20Observator%20cultural_02231058.JPG' + keep_only_tags = [ + dict(name='div', attrs={'class':'detaliuArticol'})] + remove_tags = [dict(name='div', attrs={'class':'comentariiArticol'}), + dict(name='div', attrs={'class':'postComment'}), + dict(name='div', attrs={'class':'utileArticol'}), + dict(name='p', attrs={'class':'butonComenteaza'}), + dict(name='h5'), + dict(name='div', attrs={'style':'margin-top: 0px; padding-top: 0px;'}) + ] + def parse_index(self): + soup = self.index_to_soup('http://www.observatorcultural.ro/Arhiva*-archive.html') + issueTag = soup.find('a', href=re.compile("observatorcultural.ro\/Numarul")) + issueURL = issueTag['href'] + print issueURL; + issueSoup = self.index_to_soup(issueURL) + feeds = [] + stories = [] + for categorie in issueSoup.findAll('dl',attrs={'class':'continutArhive'}): + categ=self.tag_to_string(categorie.find('dt')) + for story in categorie.findAll('dd'): + title=[] + for bucatele in story.findAll('a'): + title.append(bucatele) + if len(title)==1: #daca articolul nu are autor + stories.append({ + 'title' : self.tag_to_string(title[0]), + 'url' : title[0]['href'], + 'date' : '', + 'author' : ''}) + else: # daca articolul are autor len(title)=2 + stories.append({ + 'title' : self.tag_to_string(title[1]), + 'url' :title[1]['href'], + 'date' : '', + 'author' : self.tag_to_string(title[0])}) + print(self.tag_to_string(title[0])) + if 'Editorial' in categ: + global coverpage + coverpage=title[1]['href'] # am luat link-ul spre editorial + feeds.append((categ,stories)) + stories = [] + print feeds + return feeds +#procedura de luat coperta + def get_cover_url(self): + soup = self.index_to_soup(coverpage) + link_item = soup.find('a',attrs={'rel':'lightbox'}) # caut imaginea textului + a='' + cover_url = a.join(link_item.img['src'].split('_details_')) + return cover_url From 7a6f8b13a2d83e38117268f3abd2d0845d36cd8d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 29 May 2011 12:58:54 -0600 Subject: [PATCH 3/4] ... --- src/calibre/gui2/update.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/update.py b/src/calibre/gui2/update.py index 847b5785e9..9aae245d98 100644 --- a/src/calibre/gui2/update.py +++ b/src/calibre/gui2/update.py @@ -49,11 +49,12 @@ class UpdateNotification(QDialog): self.logo.setMaximumWidth(110) self.logo.setPixmap(QPixmap(I('lt.png')).scaled(100, 100, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)) - self.label = QLabel('

'+ + self.label = QLabel(('

'+ _('%s has been updated to version %s. ' 'See the new features. Only update if one of the ' - 'new features or bug fixes is important to you.')%(__appname__, version)) + '">new features.') + '

'+_('Update only if one of the ' + 'new features or bug fixes is important to you. ' + 'If the current version works well for you, do not update.'))%(__appname__, version)) self.label.setOpenExternalLinks(True) self.label.setWordWrap(True) self.setWindowTitle(_('Update available!')) From 1ae716a115664b46b51a02355fa11df6c3c5972b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 29 May 2011 14:38:35 -0600 Subject: [PATCH 4/4] Change default toolbar to make it a little more newbie on small screen/non maximized window friendly --- src/calibre/gui2/__init__.py | 7 ++++--- src/calibre/gui2/layout.py | 1 - src/calibre/gui2/preferences/look_feel.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index 2cb18f3bda..8499e304c3 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -48,8 +48,9 @@ else: gprefs.defaults['action-layout-menubar-device'] = () gprefs.defaults['action-layout-toolbar'] = ( 'Add Books', 'Edit Metadata', None, 'Convert Books', 'View', None, - 'Choose Library', 'Donate', None, 'Fetch News', 'Store', 'Save To Disk', - 'Connect Share', None, 'Remove Books', None, 'Help', 'Preferences', + 'Store', 'Donate', 'Fetch News', 'Help', None, + 'Remove Books', 'Choose Library', 'Save To Disk', + 'Connect Share', 'Preferences', ) gprefs.defaults['action-layout-toolbar-device'] = ( 'Add Books', 'Edit Metadata', None, 'Convert Books', 'View', @@ -75,7 +76,7 @@ gprefs.defaults['action-layout-context-menu-device'] = ( gprefs.defaults['show_splash_screen'] = True gprefs.defaults['toolbar_icon_size'] = 'medium' gprefs.defaults['automerge'] = 'ignore' -gprefs.defaults['toolbar_text'] = 'auto' +gprefs.defaults['toolbar_text'] = 'always' gprefs.defaults['font'] = None gprefs.defaults['tags_browser_partition_method'] = 'first letter' gprefs.defaults['tags_browser_collapse_at'] = 100 diff --git a/src/calibre/gui2/layout.py b/src/calibre/gui2/layout.py index 7d07463b87..76b9f5f9a2 100644 --- a/src/calibre/gui2/layout.py +++ b/src/calibre/gui2/layout.py @@ -238,7 +238,6 @@ class Spacer(QWidget): # {{{ self.l.addStretch(10) # }}} - class MainWindowMixin(object): # {{{ def __init__(self, db): diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index 37e4588b9b..862636cb04 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -129,7 +129,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): (_('Medium'), 'medium'), (_('Large'), 'large')] r('toolbar_icon_size', gprefs, choices=choices) - choices = [(_('Automatic'), 'auto'), (_('Always'), 'always'), + choices = [(_('If there is enough room'), 'auto'), (_('Always'), 'always'), (_('Never'), 'never')] r('toolbar_text', gprefs, choices=choices)