From 6e2e11f90078b76bc88025074db880dd029ef232 Mon Sep 17 00:00:00 2001 From: GRiker Date: Fri, 20 Jul 2012 04:53:28 -0600 Subject: [PATCH 1/5] Added diagnostic displaying OS X version --- src/calibre/devices/apple/driver.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/apple/driver.py b/src/calibre/devices/apple/driver.py index fffe34ad34..838edb4e69 100644 --- a/src/calibre/devices/apple/driver.py +++ b/src/calibre/devices/apple/driver.py @@ -5,7 +5,7 @@ __copyright__ = '2010, Gregory Riker' __docformat__ = 'restructuredtext en' -import cStringIO, ctypes, datetime, os, re, shutil, sys, tempfile, time +import cStringIO, ctypes, datetime, os, platform, re, shutil, sys, tempfile, time from calibre.constants import __appname__, __version__, DEBUG from calibre import fit_image, confirm_config_name, strftime as _strftime @@ -2427,8 +2427,9 @@ class ITUNES(DriverBase): if DEBUG: logger().info(" %s %s" % (__appname__, __version__)) - logger().info(" [OSX %s - %s (%s), driver version %d.%d.%d]" % - (self.iTunes.name(), self.iTunes.version(), self.initial_status, + logger().info(" [OSX %s, %s %s (%s), driver version %d.%d.%d]" % + (platform.mac_ver()[0], + self.iTunes.name(), self.iTunes.version(), self.initial_status, self.version[0],self.version[1],self.version[2])) logger().info(" communicating with iTunes via %s %s using %s binding" % (as_name, as_version, as_binding)) logger().info(" calibre_library_path: %s" % self.calibre_library_path) From cf06ad7e67adcba458cb141f46c850d2b341a70d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 26 Jul 2012 00:20:12 +0530 Subject: [PATCH 2/5] Only write to gui.json once during shutdown --- src/calibre/gui2/ui.py | 7 ++++--- src/calibre/utils/config.py | 9 +++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index b414ef04dd..7a05810f2d 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -702,9 +702,10 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ self.read_layout_settings() def write_settings(self): - config.set('main_window_geometry', self.saveGeometry()) - dynamic.set('sort_history', self.library_view.model().sort_history) - self.save_layout_state() + with gprefs: # Only write to gprefs once + config.set('main_window_geometry', self.saveGeometry()) + dynamic.set('sort_history', self.library_view.model().sort_history) + self.save_layout_state() def quit(self, checked=True, restart=False, debug_on_restart=False, confirm_quit=True): diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py index 3bd6b2c364..734be6c1a4 100644 --- a/src/calibre/utils/config.py +++ b/src/calibre/utils/config.py @@ -240,6 +240,7 @@ class XMLConfig(dict): def __init__(self, rel_path_to_cf_file): dict.__init__(self) + self.no_commit = False self.defaults = {} self.file_path = os.path.join(config_dir, *(rel_path_to_cf_file.split('/'))) @@ -304,6 +305,7 @@ class XMLConfig(dict): self.commit() def commit(self): + if self.no_commit: return if hasattr(self, 'file_path') and self.file_path: dpath = os.path.dirname(self.file_path) if not os.path.exists(dpath): @@ -314,6 +316,13 @@ class XMLConfig(dict): f.truncate() f.write(raw) + def __enter__(self): + self.no_commit = True + + def __exit__(self, *args): + self.no_commit = False + self.commit() + def to_json(obj): if isinstance(obj, bytearray): return {'__class__': 'bytearray', From 1fac69c87032da2afffa17992b8ae9cbcb9df4db Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 26 Jul 2012 10:06:45 +0530 Subject: [PATCH 3/5] ... --- manual/develop.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/manual/develop.rst b/manual/develop.rst index 12bbcefe57..ce8b02a70d 100755 --- a/manual/develop.rst +++ b/manual/develop.rst @@ -150,9 +150,8 @@ the previously checked out |app| code directory, for example:: calibre is the directory that contains the src and resources sub-directories. Ensure you have installed the |app| commandline tools via :guilabel:`Preferences->Advanced->Miscellaneous` in the |app| GUI. The next step is to set the environment variable ``CALIBRE_DEVELOP_FROM`` to the absolute path of the src directory. -So, following the example above, it would be ``/Users/kovid/work/calibre/src``. Apple -`documentation `_ -on how to set environment variables. +So, following the example above, it would be ``/Users/kovid/work/calibre/src``. +`How to set environment variables `_. Once you have set the environment variable, open a new Terminal and check that it was correctly set by using the command:: From fff1892577c90561a92e6d3f27646df3266e6587 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 26 Jul 2012 10:14:12 +0530 Subject: [PATCH 4/5] Updated The Sun --- recipes/the_sun.recipe | 46 ++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/recipes/the_sun.recipe b/recipes/the_sun.recipe index ae7c599328..d93ac2c49b 100644 --- a/recipes/the_sun.recipe +++ b/recipes/the_sun.recipe @@ -1,4 +1,4 @@ -import re, random +import random from calibre import browser from calibre.web.feeds.recipes import BasicNewsRecipe @@ -8,45 +8,43 @@ class AdvancedUserRecipe1325006965(BasicNewsRecipe): title = u'The Sun UK' description = 'Articles from The Sun tabloid UK' __author__ = 'Dave Asbury' - # last updated 15/7/12 + # last updated 25/7/12 language = 'en_GB' oldest_article = 1 - max_articles_per_feed = 15 + max_articles_per_feed = 12 remove_empty_feeds = True no_stylesheets = True masthead_url = 'http://www.thesun.co.uk/sol/img/global/Sun-logo.gif' encoding = 'UTF-8' - - remove_empty_feeds = True remove_javascript = True no_stylesheets = True + + + #preprocess_regexps = [ + # (re.compile(r'