From 6e25583bc0b29c87eea491f145fd7acec5a58c52 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 15 Dec 2009 09:22:24 -0700 Subject: [PATCH] Fix #4220 (E-Book Viewer position in book navigation is broken) --- resources/recipes/financial_times.recipe | 20 ++++++++++---------- src/calibre/gui2/viewer/main.py | 5 ++++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/resources/recipes/financial_times.recipe b/resources/recipes/financial_times.recipe index 2864f7be89..25efc56e45 100644 --- a/resources/recipes/financial_times.recipe +++ b/resources/recipes/financial_times.recipe @@ -10,7 +10,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class FinancialTimes(BasicNewsRecipe): title = u'Financial Times' - __author__ = 'Darko Miletic' + __author__ = 'Darko Miletic and Sujata Raman' description = 'Financial world news' oldest_article = 2 language = 'en' @@ -21,9 +21,9 @@ class FinancialTimes(BasicNewsRecipe): needs_subscription = True simultaneous_downloads= 1 delay = 1 - + LOGIN = 'https://registration.ft.com/registration/barrier/login' - + def get_browser(self): br = BasicNewsRecipe.get_browser() if self.username is not None and self.password is not None: @@ -33,7 +33,7 @@ class FinancialTimes(BasicNewsRecipe): br['password'] = self.password br.submit() return br - + keep_only_tags = [ dict(name='div', attrs={'id':'cont'}) ] remove_tags_after = dict(name='p', attrs={'class':'copyright'}) remove_tags = [ @@ -48,12 +48,12 @@ class FinancialTimes(BasicNewsRecipe): a{color:#003399;} .container{font-size:x-small;} h3{font-size:x-small;color:#003399;} - ''' - feeds = [ - (u'UK' , u'http://www.ft.com/rss/home/uk' ) - ,(u'US' , u'http://www.ft.com/rss/home/us' ) - ,(u'Asia' , u'http://www.ft.com/rss/home/asia' ) - ,(u'Middle East', u'http://www.ft.com/rss/home/middleeast') + ''' + feeds = [ + (u'UK' , u'http://www.ft.com/rss/home/uk' ) + ,(u'US' , u'http://www.ft.com/rss/home/us' ) + ,(u'Asia' , u'http://www.ft.com/rss/home/asia' ) + ,(u'Middle East', u'http://www.ft.com/rss/home/middleeast') ] def preprocess_html(self, soup): diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py index cb2f3da7d6..7030d2623d 100644 --- a/src/calibre/gui2/viewer/main.py +++ b/src/calibre/gui2/viewer/main.py @@ -228,7 +228,7 @@ class EbookViewer(MainWindow, Ui_EbookViewer): self.connect(self.action_bookmark, SIGNAL('triggered(bool)'), self.bookmark) self.connect(self.action_forward, SIGNAL('triggered(bool)'), self.forward) self.connect(self.action_preferences, SIGNAL('triggered(bool)'), lambda x: self.view.config(self)) - self.connect(self.pos, SIGNAL('valueChanged(double)'), self.goto_page) + self.pos.editingFinished.connect(self.goto_page_num) self.connect(self.vertical_scrollbar, SIGNAL('valueChanged(int)'), lambda x: self.goto_page(x/100.)) self.connect(self.search, SIGNAL('search(PyQt_PyObject, PyQt_PyObject)'), self.find) @@ -319,6 +319,9 @@ class EbookViewer(MainWindow, Ui_EbookViewer): if pos is not None: self.goto_page(pos) + def goto_page_num(self): + num = self.pos.value() + self.goto_page(num) def forward(self, x): pos = self.history.forward()