diff --git a/resources/recipes/Ansa.recipe b/resources/recipes/Ansa.recipe new file mode 100644 index 0000000000..8ee4cc32a7 --- /dev/null +++ b/resources/recipes/Ansa.recipe @@ -0,0 +1,72 @@ +#!/usr/bin/env python +__license__ = 'GPL v3' +__author__ = 'Gabriele Marini, based on Darko Miletic' +__copyright__ = '2010, Darko Miletic ' +description = 'Italian daily newspaper - 01-05-2010' +''' +http://www.ansa.it/ +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class Ansa(BasicNewsRecipe): + __author__ = 'Gabriele Marini' + description = 'Italian News Agency' + + cover_url = 'http://www.ansa.it/web/images/logo_ansa_interna.gif' + title = u'Ansa' + publisher = 'Ansa' + category = 'News, politics, culture, economy, general interest' + + language = 'it' + timefmt = '[%a, %d %b, %Y]' + + oldest_article = 1 + max_articles_per_feed = 10 + use_embedded_content = False + recursion = 10 + + remove_javascript = True + no_stylesheets = True + conversion_options = {'linearize_tables':True} + remove_attributes = ['colspan'] + + keep_only_tags = [dict(name='div', attrs={'class':['path','header-content','corpo']}), + ] + + + remove_tags = [ + dict(name='div', attrs={'class':'tools-bar'}), + dict(name='div', attrs={'id':['rssdiv','blocco']}) + ] + + + feeds = [ + (u'HomePage', u'http://www.ansa.it/web/ansait_web_rss_homepage.xml'), + (u'Top New', u'http://www.ansa.it/web/notizie/rubriche/topnews/topnews_rss.xml'), + (u'Cronaca', u'http://www.ansa.it/web/notizie/rubriche/cronaca/cronaca_rss.xml'), + (u'Mondo', u'http://www.ansa.it/web/notizie/rubriche/mondo/mondo_rss.xml'), + (u'Economia', u'http://www.ansa.it/web/notizie/rubriche/economia/economia_rss.xml'), + (u'Politica', u'http://www.ansa.it/web/notizie/rubriche/politica/politica_rss.xml'), + (u'Scienze', u'http://www.ansa.it/web/notizie/rubriche/scienza/scienza_rss.xml'), + (u'Cinema', u'http://www.ansa.it/web/notizie/rubriche/cinema/cinema_rss.xml'), + (u'Tecnologia e Internet', u'http://www.ansa.it/web/notizie/rubriche/tecnologia/tecnologia_rss.xml'), + (u'Spettacolo', u'http://www.ansa.it/web/notizie/rubriche/spettacolo/spettacolo_rss.xml'), + (u'Cultura e Tendenze', u'http://www.ansa.it/web/notizie/rubriche/cultura/cultura_rss.xml'), + (u'Sport', u'http://www.ansa.it/web/notizie/rubriche/altrisport/altrisport_rss.xml'), + (u'Calcio', u'http://www.ansa.it/web/notizie/rubriche/calcio/calcio_rss.xml'), + (u'Lazio', u'http://www.ansa.it/web/notizie/regioni/lazio/lazio_rss.xml'), + (u'Lombardia', u'http://www.ansa.it/web/notizie/regioni/lombardia/lombardia.shtml'), + (u'Veneto', u'http://www.ansa.it/web/notizie/regioni/veneto/veneto.shtml'), + (u'Campanioa', u'http://www.ansa.it/web/notizie/regioni/campania/campania.shtml'), + (u'Sicilia', u'http://www.ansa.it/web/notizie/regioni/sicilia/sicilia.shtml'), + (u'Toscana', u'http://www.ansa.it/web/notizie/regioni/toscana/toscana.shtml'), + (u'Trentino', u'http://www.ansa.it/web/notizie/regioni/trentino/trentino.shtml') + ] + + extra_css = ''' + .path{font-style: italic; font-size: small} + .header-content h1{font-weight: bold; font-size: xx-large} + .header-content h2{font-weight: bold; font-size: x-large; font-syle: italic} + .content-corpo{font-size: 14px;font-family: Times New Roman;} + ''' diff --git a/resources/recipes/apcom.recipe b/resources/recipes/apcom.recipe new file mode 100644 index 0000000000..9131810dd8 --- /dev/null +++ b/resources/recipes/apcom.recipe @@ -0,0 +1,48 @@ +#!/usr/bin/env python +__license__ = 'GPL v3' +__author__ = 'Gabriele Marini, based on Darko Miletic' +__copyright__ = '2009-2010, Darko Miletic ' +description = 'Italian daily newspaper - 14-05-2010' + +''' +http://www.apcom.NET/ +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class Apcom(BasicNewsRecipe): + __author__ = 'Marini Gabriele' + description = 'Italian daily newspaper' + + cover_url = 'http://www.apcom.net/img/logoAP.gif' + title = u'Apcom' + publisher = 'TM News S.p.A.' + category = 'News, politics, culture, economy, general interest' + + language = 'it' + timefmt = '[%a, %d %b, %Y]' + + oldest_article = 7 + max_articles_per_feed = 50 + use_embedded_content = False + recursion = 100 + + no_stylesheets = True + conversion_options = {'linearize_tables':True} + remove_javascript = True + + keep_only_tags = [ + dict(name='div', attrs={'id':'ag_center'}) + ] + + + + feeds = [ + (u'Globale', u'http://www.apcom.net/rss/globale.xml '), + (u'Politica', u'http://www.apcom.net/rss/politica.xml'), + (u'Cronaca', u'http://www.apcom.net/rss/cronaca.xml'), + (u'Econimia', u'http://www.apcom.net/rss/economia.xml'), + (u'Esteri', u'http://www.apcom.net/rss/esteri.xml'), + (u'Cultura', u'http://www.apcom.net/rss/cultura.xml'), + (u'Sport', u'http://www.apcom.net/rss/sport.xml') + ] diff --git a/resources/recipes/leggo_it.recipe b/resources/recipes/leggo_it.recipe new file mode 100644 index 0000000000..1e2b5aca5b --- /dev/null +++ b/resources/recipes/leggo_it.recipe @@ -0,0 +1,49 @@ +#!/usr/bin/env python +__license__ = 'GPL v3' +__author__ = 'Gabriele Marini, based on Darko Miletic' +__copyright__ = '2009, Darko Miletic ' +description = 'Italian daily newspaper - v1.00 05-05-2010' + +''' +http://www.leggo.it +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class LeggoIT(BasicNewsRecipe): + __author__ = 'Gabriele Marini' + description = 'Italian Free daily newspaper' + + cover_url = 'http://www.leggo.it/img/logo-leggo2.gif' + title = u'Leggo.it' + publisher = 'Ced Caltagirone Editore S.p.A.' + category = 'News, politics, culture, economy, general interest' + + language = 'it' + timefmt = '[%a, %d %b, %Y]' + + oldest_article = 5 + max_articles_per_feed = 100 + use_embedded_content = False + recursion = 100 + + no_stylesheets = True + remove_javascript = True + conversion_options = {'linearize_tables':True} + + keep_only_tags = [ + dict(name='h1',attrs={'class':'nero22'}), + dict(name='div',attrs={'id':'testodim'}) + ] + feeds = [ + (u'Home Page', u'http://www.leggo.it/rss/home.xml'), + (u'Italia', u'http://www.leggo.it/rss/italia.xml'), + (u'Esteri', u'http://www.leggo.it/rss/esteri.xml'), + (u'Economia', u'http://www.leggo.it/rss/economia.xml'), + (u'Sport', u'http://www.leggo.it/rss/sport.xml'), + (u'Gossip', u'http://www.leggo.it/rss/gossip.xml'), + (u'Spettacoli', u'http://www.leggo.it/rss/spettacoli.xml'), + (u'Salute', u'http://www.leggo.it/rss/salute.xml'), + (u'Scienza', u'http://www.leggo.it/rss/scienza.xml') + ] + diff --git a/resources/recipes/physics_world.recipe b/resources/recipes/physics_world.recipe index 24e40cce78..87425e2b54 100644 --- a/resources/recipes/physics_world.recipe +++ b/resources/recipes/physics_world.recipe @@ -10,6 +10,7 @@ class PhysicsWorld(BasicNewsRecipe): oldest_article = 7 max_articles_per_feed = 100 no_stylesheets = True + cover_url = 'http://images.iop.org/cws/icons/themes/phw/header-logo.png' use_embedded_content = False remove_javascript = True needs_subscription = True @@ -27,7 +28,7 @@ class PhysicsWorld(BasicNewsRecipe): br = BasicNewsRecipe.get_browser(self) if self.username is not None and self.password is not None: br.open('http://physicsworld.com/cws/sign-in') - br.select_form(nr=1) + br.select_form(nr=2) br['username'] = self.username br['password'] = self.password br.submit() diff --git a/resources/recipes/punto_informatico.recipe b/resources/recipes/punto_informatico.recipe new file mode 100644 index 0000000000..3553d3341f --- /dev/null +++ b/resources/recipes/punto_informatico.recipe @@ -0,0 +1,38 @@ +#!/usr/bin/env python +__license__ = 'GPL v3' +__author__ = 'Gabriele Marini' +__copyright__ = 'Gabriele Marini' +__description__ = 'Punto Informatico' + +''' +http://www.punto-informatico.it/ +''' + +from calibre.web.feeds.news import BasicNewsRecipe + + +class PuntoInformatico(BasicNewsRecipe): + __author__ = 'Gabriele Marini' + description = 'Punto Informatico: Internet dal 1996' + + cover_url = 'http://punto-informatico.it/images/logo_8bit.png' + title = u'Punto Informatico ' + publisher = 'italiaNews High Tech' + category = 'News, Information Tecnology' + + language = 'it' + timefmt = '[%a, %d %b, %Y]' + + oldest_article = 15 + max_articles_per_feed = 50 + use_embedded_content = False + + remove_javascript = True + no_stylesheets = True + keep_only_tags = [dict(name='div', attrs={'class':'box'})] + remove_tags = [dict(name='div',attrs={'class':'boxadv'})] + def get_article_url(self, article): + return article.get('id', article.get('guid', None)) + + feeds = [(u'Punto Informatico',u'http://feeds.punto-informatico.it/c/32288/f/438866/index.rss')] + diff --git a/src/calibre/devices/misc.py b/src/calibre/devices/misc.py index a375df5694..c1a2ee66da 100644 --- a/src/calibre/devices/misc.py +++ b/src/calibre/devices/misc.py @@ -66,5 +66,6 @@ class AVANT(USBMS): VENDOR_NAME = 'E-BOOK' WINDOWS_MAIN_MEM = 'READER' - EBOOK_DIR_MAIN = 'E-books' + EBOOK_DIR_MAIN = '' + SUPPORTS_SUB_DIRS = True diff --git a/src/calibre/ebooks/oeb/iterator.py b/src/calibre/ebooks/oeb/iterator.py index ed0ca6c3f4..69f7b7fe4e 100644 --- a/src/calibre/ebooks/oeb/iterator.py +++ b/src/calibre/ebooks/oeb/iterator.py @@ -92,10 +92,10 @@ class EbookIterator(object): ext = re.sub(r'(x{0,1})htm(l{0,1})', 'html', ext) self.ebook_ext = ext - def search(self, text, index): + def search(self, text, index, backwards=False): text = text.lower() for i, path in enumerate(self.spine): - if i > index: + if (backwards and i < index) or (not backwards and i > index): if text in open(path, 'rb').read().decode(path.encoding).lower(): return i diff --git a/src/calibre/gui2/search_box.py b/src/calibre/gui2/search_box.py index 7eb3173972..776127b698 100644 --- a/src/calibre/gui2/search_box.py +++ b/src/calibre/gui2/search_box.py @@ -141,6 +141,13 @@ class SearchBox2(QComboBox): if event.timerId() == self.timer: self.do_search() + @property + def smart_text(self): + text = unicode(self.currentText()).strip() + if not text or text == self.help_text: + return '' + return text + def do_search(self): text = unicode(self.currentText()).strip() if not text or text == self.help_text: diff --git a/src/calibre/gui2/viewer/documentview.py b/src/calibre/gui2/viewer/documentview.py index 2267efb893..bd4bd0a01a 100644 --- a/src/calibre/gui2/viewer/documentview.py +++ b/src/calibre/gui2/viewer/documentview.py @@ -585,7 +585,9 @@ class DocumentView(QWebView): def fset(self, val): self.document.current_language = val return property(fget=fget, fset=fset) - def search(self, text): + def search(self, text, backwards=False): + if backwards: + return self.findText(text, self.document.FindBackwards) return self.findText(text) def path(self): diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py index 689613111e..77d7269e17 100644 --- a/src/calibre/gui2/viewer/main.py +++ b/src/calibre/gui2/viewer/main.py @@ -229,7 +229,11 @@ class EbookViewer(MainWindow, Ui_EbookViewer): self.connect(self.action_previous_page, SIGNAL('triggered(bool)'), lambda x:self.view.previous_page()) self.connect(self.action_find_next, SIGNAL('triggered(bool)'), - lambda x:self.find(unicode(self.search.text()), True, repeat=True)) + lambda x:self.find(self.search.smart_text, True, repeat=True)) + self.connect(self.action_find_previous, SIGNAL('triggered(bool)'), + lambda x:self.find(self.search.smart_text, True, + repeat=True, backwards=True)) + self.connect(self.action_full_screen, SIGNAL('triggered(bool)'), self.toggle_fullscreen) self.action_full_screen.setShortcuts([Qt.Key_F11, Qt.CTRL+Qt.SHIFT+Qt.Key_F]) @@ -420,13 +424,15 @@ class EbookViewer(MainWindow, Ui_EbookViewer): self.set_bookmarks(self.iterator.bookmarks) - def find(self, text, refinement, repeat=False): + def find(self, text, refinement, repeat=False, backwards=False): if not text: + self.view.search('') return self.search.search_done(False) if self.view.search(text): self.scrolled(self.view.scroll_fraction) return self.search.search_done(True) - index = self.iterator.search(text, self.current_index) + index = self.iterator.search(text, self.current_index, + backwards=backwards) if index is None: if self.current_index > 0: index = self.iterator.search(text, 0) @@ -444,10 +450,7 @@ class EbookViewer(MainWindow, Ui_EbookViewer): self.scrolled(self.view.scroll_fraction) def keyPressEvent(self, event): - if event.key() == Qt.Key_F3: - text = unicode(self.search.text()) - self.find(text, True, repeat=True) - elif event.key() == Qt.Key_Slash: + if event.key() == Qt.Key_Slash: self.search.setFocus(Qt.OtherFocusReason) else: return MainWindow.keyPressEvent(self, event) diff --git a/src/calibre/gui2/viewer/main.ui b/src/calibre/gui2/viewer/main.ui index be18a3036b..9177f2713f 100644 --- a/src/calibre/gui2/viewer/main.ui +++ b/src/calibre/gui2/viewer/main.ui @@ -142,6 +142,7 @@ false + @@ -232,6 +233,12 @@ Find next + + Find next occurrence + + + F3 + @@ -287,6 +294,21 @@ Print + + + + :/images/arrow-up.svg:/images/arrow-up.svg + + + Find previous + + + Find previous occurrence + + + Shift+F3 + + diff --git a/src/calibre/gui2/wizard/__init__.py b/src/calibre/gui2/wizard/__init__.py index 30127b7266..0a395e9eb8 100644 --- a/src/calibre/gui2/wizard/__init__.py +++ b/src/calibre/gui2/wizard/__init__.py @@ -97,9 +97,18 @@ class Kobo(Device): manufacturer = 'Kobo' output_profile = 'kobo' output_format = 'EPUB' - name = 'Kobo Reader' id = 'kobo' +class Booq(Device): + name = 'Booq Reader' + manufacturer = 'Booq' + output_profile = 'prs505' + output_format = 'EPUB' + id = 'booq' + +class Avant(Booq): + name = 'Booq Avant' + class Sony300(Sony505): name = 'SONY Reader Pocket Edition'