From 7aafb31929bf34fa18bf39722b83d03d08057495 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 17 Jul 2012 13:32:54 +0530 Subject: [PATCH 1/7] Digitally sign the windows .msi installer --- setup/installer/windows/__init__.py | 13 ++++++++++++- setup/installer/windows/freeze.py | 1 - 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/setup/installer/windows/__init__.py b/setup/installer/windows/__init__.py index a7b4a62af4..13b452b31c 100644 --- a/setup/installer/windows/__init__.py +++ b/setup/installer/windows/__init__.py @@ -6,11 +6,13 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os, shutil, subprocess +import os, shutil, subprocess, re from setup import Command, __appname__, __version__ from setup.installer import VMInstaller +SIGNTOOL = r'C:\cygwin\home\kovid\sign.bat' + class Win(Command): description = 'Build windows binary installers' @@ -34,10 +36,19 @@ class Win32(VMInstaller): INSTALLER_EXT = 'msi' SHUTDOWN_CMD = ['shutdown.exe', '-s', '-f', '-t', '0'] + def sign_msi(self): + raw = open(self.VM).read() + vmx = re.search(r'''launch_vmware\(['"](.+?)['"]''', raw).group(1) + subprocess.check_call(['vmrun', '-T', 'ws', '-gu', 'kovid', '-gp', + "et tu brutus", 'runProgramInGuest', vmx, 'cmd.exe', '/C', + r'C:\cygwin\home\kovid\sign.bat']) + def download_installer(self): installer = self.installer() if os.path.exists('build/winfrozen'): shutil.rmtree('build/winfrozen') + self.sign_msi() + subprocess.check_call(('scp', 'xp_build:build/%s/%s'%(__appname__, installer), 'dist')) if not os.path.exists(installer): diff --git a/setup/installer/windows/freeze.py b/setup/installer/windows/freeze.py index b7f6c426f1..48dd2479c2 100644 --- a/setup/installer/windows/freeze.py +++ b/setup/installer/windows/freeze.py @@ -23,7 +23,6 @@ SW = r'C:\cygwin\home\kovid\sw' IMAGEMAGICK = os.path.join(SW, 'build', 'ImageMagick-6.7.6', 'VisualMagick', 'bin') CRT = r'C:\Microsoft.VC90.CRT' -SIGNTOOL = r'C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\signtool.exe' VERSION = re.sub('[a-z]\d+', '', __version__) WINVER = VERSION+'.0' From b6b1436c1bb5b00c458c3a78cd9f0021e5650f6e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 17 Jul 2012 15:11:35 +0530 Subject: [PATCH 2/7] Dont use Tab to cycle through completions as we have the arrow keys and Tab doesn't work when the completions popup is not visible --- resources/default_tweaks.py | 2 +- src/calibre/gui2/complete2.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index 3bba5ecca5..b096cd1d65 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -522,5 +522,5 @@ enable_multicharacters_in_tag_browser = True # completions you will now have to press Tab to select one before pressing # Enter. Which technique you prefer will depend on the state of metadata in # your library and your personal editing style. -preselect_first_completion = False +preselect_first_completion = True diff --git a/src/calibre/gui2/complete2.py b/src/calibre/gui2/complete2.py index 603177498d..eb28c38881 100644 --- a/src/calibre/gui2/complete2.py +++ b/src/calibre/gui2/complete2.py @@ -193,8 +193,8 @@ class Completer(QListView): # {{{ if key in (Qt.Key_PageUp, Qt.Key_PageDown): # Let the list view handle these keys return False - if key in (Qt.Key_Tab, Qt.Key_Backtab, Qt.Key_Up, Qt.Key_Down): - self.next_match(previous=key in (Qt.Key_Backtab, Qt.Key_Up)) + if key in (Qt.Key_Up, Qt.Key_Down): + self.next_match(previous=key == Qt.Key_Up) e.accept() return True # Send to widget From 3d18757d8eaf5b89ac4ad7f69ccaa31de60a6fa5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 17 Jul 2012 16:18:34 +0530 Subject: [PATCH 3/7] Digitally sign OS X builds --- setup/installer/osx/app/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup/installer/osx/app/main.py b/setup/installer/osx/app/main.py index f318ff07f6..8d3853ea28 100644 --- a/setup/installer/osx/app/main.py +++ b/setup/installer/osx/app/main.py @@ -624,8 +624,9 @@ class Py2App(object): if os.path.exists(dmg): os.unlink(dmg) tdir = tempfile.mkdtemp() - shutil.copytree(d, os.path.join(tdir, os.path.basename(d)), - symlinks=True) + appdir = os.path.join(tdir, os.path.basename(d)) + shutil.copytree(d, appdir, symlinks=True) + subprocess.check_call(['/Users/kovid/sign.sh', appdir]) os.symlink('/Applications', os.path.join(tdir, 'Applications')) subprocess.check_call(['/usr/bin/hdiutil', 'create', '-srcfolder', tdir, '-volname', volname, '-format', format, dmg]) From 4aa6477eea88380397e5cbb1bdae9e60342595bc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 17 Jul 2012 17:03:19 +0530 Subject: [PATCH 4/7] ... --- resources/default_tweaks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py index b096cd1d65..3bba5ecca5 100644 --- a/resources/default_tweaks.py +++ b/resources/default_tweaks.py @@ -522,5 +522,5 @@ enable_multicharacters_in_tag_browser = True # completions you will now have to press Tab to select one before pressing # Enter. Which technique you prefer will depend on the state of metadata in # your library and your personal editing style. -preselect_first_completion = True +preselect_first_completion = False From 1508b76c689ce20885bcd11202d9c9b48b4fe24b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 17 Jul 2012 17:39:41 +0530 Subject: [PATCH 5/7] Fix Toronto Star --- recipes/thestar.recipe | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/recipes/thestar.recipe b/recipes/thestar.recipe index e7dafae6d5..f667b86472 100644 --- a/recipes/thestar.recipe +++ b/recipes/thestar.recipe @@ -16,6 +16,8 @@ class TheTorontoStar(BasicNewsRecipe): language = 'en_CA' max_articles_per_feed = 100 no_stylesheets = True + #auto_cleanup = True + #auto_cleanup_keep = '//div[@class="topsContent topsContentActive"]' use_embedded_content = False delay = 2 publisher = 'The Toronto Star' @@ -28,18 +30,18 @@ class TheTorontoStar(BasicNewsRecipe): ,'publisher' : publisher } - keep_only_tags = [dict(name='div', attrs={'class':'ts-article'})] - remove_tags_before = dict(name='div',attrs={'id':'ts-article_header'}) + #keep_only_tags = [dict(name='div', attrs={'class':'ts-article'})] + #remove_tags_before = dict(name='div',attrs={'id':'ts-article_header'}) feeds = [ - (u'News' , u'http://www.thestar.com/rss/82672?' ) - ,(u'Opinion' , u'http://www.thestar.com/rss/82863?' ) - ,(u'Business' , u'http://www.thestar.com/rss/82796?' ) - ,(u'Sports' , u'http://www.thestar.com/rss/82758?' ) - ,(u'Entertainment', u'http://www.thestar.com/rss/117741?' ) - ,(u'Living' , u'http://www.thestar.com/rss/82839?' ) - ,(u'Travel' , u'http://www.thestar.com/rss/82858?' ) - ,(u'Science' , u'http://www.thestar.com/rss/82848?') + (u'News' , u'http://www.thestar.com/rss/?categories=293' ) + ,(u'Opinion' , u'http://www.thestar.com/rss/?categories=303' ) + ,(u'Business' , u'http://www.thestar.com/rss/?categories=294' ) + ,(u'Sports' , u'http://www.thestar.com/rss/?categories=295' ) + ,(u'Entertainment', u'http://www.toronto.com/rss?categories=6298' ) + ,(u'Living' , u'http://www.thestar.com/rss/?categories=297' ) + ,(u'Travel' , u'http://www.thestar.com/rss/list/1042246?' ) + ,(u'Science' , u'http://www.thestar.com/rss?categories=6481') ] def print_version(self, url): @@ -47,3 +49,4 @@ class TheTorontoStar(BasicNewsRecipe): artid = artl.rpartition('/')[2] return 'http://www.thestar.com/printarticle/' + artid + From 274d3d4a13d3620764daaa1c606986dca397a9b9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 17 Jul 2012 17:44:52 +0530 Subject: [PATCH 6/7] Fix return key not working in completion popup on OS X --- src/calibre/gui2/complete2.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/complete2.py b/src/calibre/gui2/complete2.py index eb28c38881..dad2e21d90 100644 --- a/src/calibre/gui2/complete2.py +++ b/src/calibre/gui2/complete2.py @@ -185,11 +185,14 @@ class Completer(QListView): # {{{ e.accept() return True if key in (Qt.Key_Enter, Qt.Key_Return): - if not self.currentIndex().isValid(): - self.hide() - e.accept() - return True - return False + # We handle this explicitly because on OS X activated() is + # not emitted on pressing Enter. + idx = self.currentIndex() + if idx.isValid(): + self.item_chosen(idx) + self.hide() + e.accept() + return True if key in (Qt.Key_PageUp, Qt.Key_PageDown): # Let the list view handle these keys return False From 6c9b9c3d6473146e3aa8f3ffb49a029e7df75f46 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 17 Jul 2012 17:54:42 +0530 Subject: [PATCH 7/7] Fix completion popup not blocking single key shortcuts in the main book list --- src/calibre/gui2/complete2.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/gui2/complete2.py b/src/calibre/gui2/complete2.py index dad2e21d90..59291cf04b 100644 --- a/src/calibre/gui2/complete2.py +++ b/src/calibre/gui2/complete2.py @@ -214,6 +214,8 @@ class Completer(QListView): # {{{ self.hide() e.accept() return True + elif etype == e.ShortcutOverride: + QApplication.sendEvent(widget, e) return False # }}}