From 7d5da9f48d59254db290c6bf87a4111a0d633fbc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 18 Sep 2010 19:34:40 -0600 Subject: [PATCH 1/4] GUI deveice detection: Handle case when user yanks connected device before device connection handler is called. Fixes #6864 (Unhandled exception, probably when trying to connect to iTunes/iPad) --- src/calibre/gui2/device.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index b20cd7594f..ae3141db56 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -707,6 +707,10 @@ class DeviceMixin(object): # {{{ ''' Called when a device is connected to the computer. ''' + # This can happen as this function is called in a queued connection and + # the user could have yanked the device in the meantime + if connected and not self.device_manager.is_device_connected: + connected = False self.set_device_menu_items_state(connected) if connected: self.device_manager.get_device_information(\ From 25bacf9a97f34a360e150487b65cc940bc01988f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 18 Sep 2010 19:59:31 -0600 Subject: [PATCH 2/4] Initialize interface actions in the order they are defined to prevent interaction dependencies from creating a problem --- src/calibre/gui2/ui.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index f40eed1fcd..f8d50d1cd2 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -38,6 +38,7 @@ from calibre.gui2.init import LibraryViewMixin, LayoutMixin from calibre.gui2.search_box import SearchBoxMixin, SavedSearchBoxMixin from calibre.gui2.search_restriction_mixin import SearchRestrictionMixin from calibre.gui2.tag_view import TagBrowserMixin +from calibre.utils.ordered_dict import OrderedDict class Listener(Thread): # {{{ @@ -97,7 +98,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, # {{{ MainWindow.__init__(self, opts, parent) self.opts = opts self.device_connected = None - acmap = {} + acmap = OrderedDict() for action in interface_actions(): mod, cls = action.actual_plugin.split(':') ac = getattr(__import__(mod, fromlist=['1'], level=0), cls)(self, From 1a5b92d6d915775428c38b6f99768c6def9bf012 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 18 Sep 2010 20:17:30 -0600 Subject: [PATCH 3/4] Popular Science by Tony Stegall --- resources/images/news/popscience.png | Bin 0 -> 737 bytes resources/recipes/popscience.recipe | 59 +++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 resources/images/news/popscience.png create mode 100644 resources/recipes/popscience.recipe diff --git a/resources/images/news/popscience.png b/resources/images/news/popscience.png new file mode 100644 index 0000000000000000000000000000000000000000..ff33483b10421b209f599cdec809544db83988e7 GIT binary patch literal 737 zcmeAS@N?(olHy`uVBq!ia0vp^f*{Pn1|+R>-G2cowj^(N7l!{JxM1({$v_d#0*}aI zAngIhZYQ(tK!Rljj_E)ete>H;(O;c`fr-o0#WBRQAzgQ^}I3sDr zEs}bFIvJBwqaPUcE+q zV_I6|?mA{M9-)bsPx{?cF*TW?b4hbr!70&y>`8k(&R^ALSkjdC{oLLFhrH{D3|BB5 z++3S2wAxB`X6MG1oAo9tny1q&@~&|Ix*cct+12Xkr1dM_v-vukMc+6dzaS%8aB<~- z=Ec3i^}QNBjW4-xew9kfkg$1qYW;6M&)2@rRhM{I2d_LeUt4?Qz5d(f$?xZtJl$R_ zp2C&PnR-(tx17;{-JfYe-yEll+Y&;Tzl{0B8`A%!{a>lP4cGLk-+K5BuW$Vs&S3Fg zT!6XO<1zQSS6My6Z@NtOH*fT?TKb;xfT(T9{rZV+(#L;v%+Ol=!usZ%v&UTa{Iba| z=6$0cTsM!&|4!7|_{V)Q5%-p#FZ6$B&$E}avc3PbNrOeP)aqX%sp|x9+Zopj21+HEtq-c=jMqw+y!ipc6y(Dxk6agNLl^gnQ!yIcW&&+*;e!DAoGgf-;b?p zVA#*#rWWaIlH~$Q9;zj-5hW>!C8<`)MX5lF!N|bSK-a)h*U%!w$iT|b)XKzM*TBrm rz(8f@sU{Q+x%nxXX_Y7%jI0cS$Pl98PswvoB4+S(^>bP0l+XkK_>3?| literal 0 HcmV?d00001 diff --git a/resources/recipes/popscience.recipe b/resources/recipes/popscience.recipe new file mode 100644 index 0000000000..a1ea91a6ae --- /dev/null +++ b/resources/recipes/popscience.recipe @@ -0,0 +1,59 @@ +import re +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipe1282101454(BasicNewsRecipe): + title = 'Popular Science' + language = 'en' + __author__ = 'TonytheBookworm' + description = 'Popular Science' + publisher = 'Popular Science' + category = 'gadgets,science' + oldest_article = 7 # change this if you want more current articles. I like to go a week in + max_articles_per_feed = 100 + no_stylesheets = True + remove_javascript = True + + masthead_url = 'http://www.raytheon.com/newsroom/rtnwcm/groups/Public/documents/masthead/rtn08_popscidec_masthead.jpg' + + remove_tags = [dict(name='div', attrs={'id':['toolbar','main_supplements']}), + dict(name='span', attrs={'class':['comments']}), + dict(name='div', attrs={'class':['relatedinfo related-right','node_navigation','content2']}), + dict(name='ul', attrs={'class':['item-list clear-block']})] + feeds = [ + + ('Gadgets', 'http://www.popsci.com/full-feed/gadgets'), + ('Cars', 'http://www.popsci.com/full-feed/cars'), + ('Science', 'http://www.popsci.com/full-feed/science'), + ('Technology', 'http://www.popsci.com/full-feed/technology'), + ('DIY', 'http://www.popsci.com/full-feed/diy'), + + ] + + + #The following will get read of the Gallery: links when found + + def preprocess_html(self, soup) : + print 'SOUP IS: ', soup + weblinks = soup.findAll(['head','h2']) + if weblinks is not None: + for link in weblinks: + if re.search('(Gallery)(:)',str(link)): + + link.parent.extract() + return soup + #----------------------------------------------------------------- + + + + + + + + + + + + + + + From 3b9e43e79ec323d2d7d4fd0b7b9900cec0d971ff Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 18 Sep 2010 21:00:28 -0600 Subject: [PATCH 4/4] EPUB metadata: Don't read timestamp value from epubs as I am sick of closing bugs about adding books and having the Date not be today. Does not affect reading of metadata from OPF, so it should still be possible to restore date when adding from a previously saved to disk folder (as long as the OPF was saved) --- src/calibre/ebooks/metadata/epub.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calibre/ebooks/metadata/epub.py b/src/calibre/ebooks/metadata/epub.py index 041a1ee603..df9a394258 100644 --- a/src/calibre/ebooks/metadata/epub.py +++ b/src/calibre/ebooks/metadata/epub.py @@ -176,6 +176,7 @@ def get_metadata(stream, extract_cover=True): except: import traceback traceback.print_exc() + mi.timestamp = None return mi def get_quick_metadata(stream):