diff --git a/src/calibre/gui2/dialogs/metadata_bulk.ui b/src/calibre/gui2/dialogs/metadata_bulk.ui index 8c60715ae2..0fe537b598 100644 --- a/src/calibre/gui2/dialogs/metadata_bulk.ui +++ b/src/calibre/gui2/dialogs/metadata_bulk.ui @@ -39,7 +39,7 @@ - 2 + 0 diff --git a/src/calibre/gui2/dialogs/scheduler.py b/src/calibre/gui2/dialogs/scheduler.py index 30f4a2d8a2..071c5778a8 100644 --- a/src/calibre/gui2/dialogs/scheduler.py +++ b/src/calibre/gui2/dialogs/scheduler.py @@ -120,12 +120,15 @@ class SchedulerDialog(QDialog, Ui_Dialog): if self.account.isVisible(): un, pw = map(unicode, (self.username.text(), self.password.text())) + un, pw = un.strip(), pw.strip() if not un and not pw and self.schedule.isChecked(): - error_dialog(self, _('Need username and password'), - _('You must provide a username and/or password to ' - 'use this news source.'), show=True) - return False - self.recipe_model.set_account_info(urn, un.strip(), pw.strip()) + if not getattr(self, 'subscription_optional', False): + error_dialog(self, _('Need username and password'), + _('You must provide a username and/or password to ' + 'use this news source.'), show=True) + return False + if un or pw: + self.recipe_model.set_account_info(urn, un, pw) if self.schedule.isChecked(): schedule_type = 'interval' if self.interval_button.isChecked() else 'day/time' @@ -157,7 +160,13 @@ class SchedulerDialog(QDialog, Ui_Dialog): account_info = self.recipe_model.account_info_from_urn(urn) customize_info = self.recipe_model.get_customize_info(urn) - self.account.setVisible(recipe.get('needs_subscription', '') == 'yes') + ns = recipe.get('needs_subscription', '') + self.account.setVisible(ns in ('yes', 'optional')) + self.subscription_optional = ns == 'optional' + act = _('Account') + act2 = _('(optional)') if self.subscription_optional else \ + _('(required)') + self.account.setTitle(act+' '+act2) un = pw = '' if account_info is not None: un, pw = account_info[:2] diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index d1e7866198..f3d77061c3 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -110,9 +110,11 @@ class BasicNewsRecipe(Recipe): #: If True the GUI will ask the user for a username and password #: to use while downloading - #: @type: boolean + #: If set to "optional" the use of a username and password becomes optional needs_subscription = False + #: + #: If True the navigation bar is center aligned, otherwise it is left aligned center_navbar = True @@ -609,7 +611,8 @@ class BasicNewsRecipe(Recipe): if self.needs_subscription and (\ self.username is None or self.password is None or \ (not self.username and not self.password)): - raise ValueError(_('The "%s" recipe needs a username and password.')%self.title) + if self.needs_subscription != 'optional': + raise ValueError(_('The "%s" recipe needs a username and password.')%self.title) self.browser = self.get_browser() self.image_map, self.image_counter = {}, 1 diff --git a/src/calibre/web/feeds/recipes/collection.py b/src/calibre/web/feeds/recipes/collection.py index 1dd19dc524..012e24a799 100644 --- a/src/calibre/web/feeds/recipes/collection.py +++ b/src/calibre/web/feeds/recipes/collection.py @@ -45,12 +45,17 @@ def serialize_recipe(urn, recipe_class): return ans default_author = _('You') if urn.startswith('custom:') else _('Unknown') + ns = attr('needs_subscription', False) + if not ns: + ns = 'no' + if ns is True: + ns = 'yes' return E.recipe({ 'id' : str(urn), 'title' : attr('title', _('Unknown')), 'author' : attr('__author__', default_author), 'language' : attr('language', 'und'), - 'needs_subscription' : 'yes' if attr('needs_subscription', False) else 'no', + 'needs_subscription' : ns, 'description' : attr('description', '') })