From d96328a259609b78b3b05da0fca8cfbd64acd639 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jan 2013 14:51:07 +0530 Subject: [PATCH 1/5] Fix Volksrant --- recipes/volksrant.recipe | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/recipes/volksrant.recipe b/recipes/volksrant.recipe index b3629ee4e0..e5499fed73 100644 --- a/recipes/volksrant.recipe +++ b/recipes/volksrant.recipe @@ -9,7 +9,6 @@ __docformat__ = 'restructuredtext en' Modified by Tony Stegall on 10/10/10 to include function to grab print version of articles ''' - from datetime import date from calibre.web.feeds.news import BasicNewsRecipe ''' @@ -42,9 +41,16 @@ class AdvancedUserRecipe1249039563(BasicNewsRecipe): ####################################################################################################### temp_files = [] articles_are_obfuscated = True + use_javascript_to_login = True + + def javascript_login(self, br, username, password): + 'Volksrant wants the user to explicitly allow cookies' + if not br.visit('http://www.volkskrant.nl'): + raise Exception('Failed to connect to volksrant website') + br.click('#pop_cookie_text a[onclick]', wait_for_load=True, timeout=120) def get_obfuscated_article(self, url): - br = self.get_browser() + br = self.browser.clone_browser() print 'THE CURRENT URL IS: ', url br.open(url) year = date.today().year From df382c177b944c0ef0b50f7efb61fa11a411b13c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jan 2013 19:48:24 +0530 Subject: [PATCH 2/5] ... --- src/calibre/ebooks/oeb/transforms/subset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/transforms/subset.py b/src/calibre/ebooks/oeb/transforms/subset.py index 0cca73fcce..3d2ab8d873 100644 --- a/src/calibre/ebooks/oeb/transforms/subset.py +++ b/src/calibre/ebooks/oeb/transforms/subset.py @@ -280,7 +280,7 @@ class SubsetFonts(object): return ans def find_usage_in(self, elem, inherited_style): - style = self.elem_style(elem.get('class', ''), inherited_style) + style = self.elem_style(elem.get('class', '') or '', inherited_style) for child in elem: self.find_usage_in(child, style) font = self.used_font(style) From f1dce0942c643b39bbddf1a023cf8b54f436d507 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jan 2013 23:10:23 +0530 Subject: [PATCH 3/5] Fix #1106172 (Some problems in Category Editor) --- src/calibre/gui2/dialogs/tag_list_editor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/dialogs/tag_list_editor.py b/src/calibre/gui2/dialogs/tag_list_editor.py index 298641a9df..4397ad7d28 100644 --- a/src/calibre/gui2/dialogs/tag_list_editor.py +++ b/src/calibre/gui2/dialogs/tag_list_editor.py @@ -136,7 +136,7 @@ class TagListEditor(QDialog, Ui_TagListEditor): item.setFlags (item.flags() & ~Qt.ItemIsSelectable) self.table.setItem(row, 1, item) item = QTableWidgetItem('') - item.setFlags (item.flags() & ~Qt.ItemIsSelectable) + item.setFlags (item.flags() & ~(Qt.ItemIsSelectable|Qt.ItemIsEditable)) self.table.setItem(row, 2, item) # Scroll to the selected item if there is one From 08fc8e274a09452ce000a9298c757fde79790277 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jan 2013 23:16:23 +0530 Subject: [PATCH 4/5] Add the full item name to the tool tip of a leaf item displayed in the tag browser. Fixes #1106231 (Some enhancements for Tags) --- src/calibre/library/database2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index d93833ae9c..2c58658bef 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -1881,7 +1881,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): # icon_map is not None if get_categories is to store an icon and # possibly a tooltip in the tag structure. icon = None - tooltip = '(' + category + ')' label = tb_cats.key_to_label(category) if icon_map: if not tb_cats.is_custom_field(category): @@ -1935,7 +1934,9 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): is_editable = category not in ['news', 'rating', 'languages'] categories[category] = [tag_class(formatter(r.n), count=r.c, id=r.id, avg=avgr(r), sort=r.s, icon=icon, - tooltip=tooltip, category=category, + tooltip=u'({0}:{1})'.format(category, + formatter(r.n)), + category=category, id_set=r.id_set, is_editable=is_editable, use_sort_as_name=use_sort_as_name) for r in items] From aa256bb189e28cd1fd6fcbcf7d4ff9a82436b55c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 27 Jan 2013 23:27:58 +0530 Subject: [PATCH 5/5] port the new tb tooltip to the new backend --- src/calibre/db/categories.py | 6 +++--- src/calibre/library/database2.py | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/calibre/db/categories.py b/src/calibre/db/categories.py index b934aec0c1..900f245b36 100644 --- a/src/calibre/db/categories.py +++ b/src/calibre/db/categories.py @@ -35,6 +35,8 @@ class Tag(object): self.avg_rating = avg/2.0 if avg is not None else 0 self.sort = sort self.use_sort_as_name = use_sort_as_name + if tooltip is None: + tooltip = '(%s:%s)'%(category, name) if self.avg_rating > 0: if tooltip: tooltip = tooltip + ': ' @@ -65,7 +67,6 @@ def find_categories(field_metadata): def create_tag_class(category, fm, icon_map): cat = fm[category] icon = None - tooltip = None if category in {'formats', 'identifiers'} else ('(' + category + ')') label = fm.key_to_label(category) if icon_map: if not fm.is_custom_field(category): @@ -87,8 +88,7 @@ def create_tag_class(category, fm, icon_map): use_sort_as_name = False return partial(Tag, use_sort_as_name=use_sort_as_name, icon=icon, - tooltip=tooltip, is_editable=is_editable, - category=category) + is_editable=is_editable, category=category) def clean_user_categories(dbcache): user_cats = dbcache.pref('user_categories', {}) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 2c58658bef..a1202db44d 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -1934,8 +1934,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): is_editable = category not in ['news', 'rating', 'languages'] categories[category] = [tag_class(formatter(r.n), count=r.c, id=r.id, avg=avgr(r), sort=r.s, icon=icon, - tooltip=u'({0}:{1})'.format(category, - formatter(r.n)), category=category, id_set=r.id_set, is_editable=is_editable, use_sort_as_name=use_sort_as_name)