From f0a74d06778a021432b5bc974f16e3cd27132989 Mon Sep 17 00:00:00 2001 From: John Schember Date: Thu, 21 Apr 2011 20:49:03 -0400 Subject: [PATCH] Store: Info about ACSM. Change MobileRead to use SearchResult instead of BookRef. --- src/calibre/gui2/store/mobileread_plugin.py | 10 ++-------- src/calibre/gui2/store/web_control.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/calibre/gui2/store/mobileread_plugin.py b/src/calibre/gui2/store/mobileread_plugin.py index 56fcb207bf..cc6a5eb387 100644 --- a/src/calibre/gui2/store/mobileread_plugin.py +++ b/src/calibre/gui2/store/mobileread_plugin.py @@ -97,12 +97,12 @@ class MobileReadStore(BasicStoreConfig, StorePlugin): if not raw_data: return - # Turn books listed in the HTML file into BookRef's. + # Turn books listed in the HTML file into SearchResults's. books = [] try: data = html.fromstring(raw_data) for book_data in data.xpath('//ul/li'): - book = BookRef() + book = SearchResult() book.detail_item = ''.join(book_data.xpath('.//a/@href')) book.formats = ''.join(book_data.xpath('.//i/text()')) book.formats = book.formats.strip() @@ -126,12 +126,6 @@ class MobileReadStore(BasicStoreConfig, StorePlugin): return self.config.get(self.name + '_book_list', []) -class BookRef(SearchResult): - - def __init__(self): - SearchResult.__init__(self) - - class MobeReadStoreDialog(QDialog, Ui_Dialog): def __init__(self, plugin, *args): diff --git a/src/calibre/gui2/store/web_control.py b/src/calibre/gui2/store/web_control.py index 0b79c526a8..58711d786f 100644 --- a/src/calibre/gui2/store/web_control.py +++ b/src/calibre/gui2/store/web_control.py @@ -68,6 +68,18 @@ class NPWebView(QWebView): filename = get_download_filename(url, cf) ext = os.path.splitext(filename)[1][1:].lower() if ext not in BOOK_EXTENSIONS: + if ext == 'acsm': + from calibre.gui2.dialogs.confirm_delete import confirm + confirm(_('

You have selected to download an ebook that uses ' + 'the ACSM format. ACSM files are not ebook files but ' + 'pointers ' + '' + 'Adobe Digital Editions (ADE) uses so it can download ' + 'the ebook and apply DRM to it. You will be prompted to save this ' + 'file to your computer. Then open it using ADE. Once ADE has ' + 'downloaded the actual ebook you can add the book to calibre ' + 'using Add and selecting the file from the ADE library folder.'), + 'acsm_download', self) home = os.path.expanduser('~') name = QFileDialog.getSaveFileName(self, _('File is not a supported ebook type. Save to disk?'),