Skip to content

Commit

Permalink
Remove Calibre Update Cover option entirely(was deprecated) #878
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmXinu committed Oct 20, 2022
1 parent ccea782 commit 4d322a8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 69 deletions.
20 changes: 1 addition & 19 deletions calibre-plugin/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@

from calibre_plugins.fanficfare_plugin.dialogs import (
UPDATE, UPDATEALWAYS, collision_order, save_collisions, RejectListDialog,
EditTextDialog, IniTextDialog, RejectUrlEntry,
updateepubcover_warning)
EditTextDialog, IniTextDialog, RejectUrlEntry)

from fanficfare.adapters import getSiteSections, get_section_url

Expand Down Expand Up @@ -280,7 +279,6 @@ def save_settings(self):
prefs['collision'] = save_collisions[unicode(self.basic_tab.collision.currentText())]
prefs['updatemeta'] = self.basic_tab.updatemeta.isChecked()
prefs['bgmeta'] = self.basic_tab.bgmeta.isChecked()
prefs['updateepubcover'] = self.basic_tab.updateepubcover.isChecked()
prefs['keeptags'] = self.basic_tab.keeptags.isChecked()
prefs['mark'] = self.basic_tab.mark.isChecked()
prefs['mark_success'] = self.basic_tab.mark_success.isChecked()
Expand Down Expand Up @@ -492,22 +490,6 @@ def __init__(self, parent_dialog, plugin_action):

self.l.addLayout(horz)

label = QLabel(_("The <i><b>Update EPUB Cover</b></i> option is DEPRECATED and in future will always be ON.<br>"
"For now you can still uncheck it here, but please see <a href='https://github.com/JimmXinu/FanFicFare/issues/878'>this issue</a> for more information."))
label.setWordWrap(True)
label.setOpenExternalLinks(True)
self.l.addWidget(label)

self.updateepubcover = QCheckBox(_('Default Update EPUB Cover when Updating EPUB?'),self)
self.updateepubcover.setToolTip(_("On each download, FanFicFare offers an option to update the book cover image <i>inside</i> the EPUB from the web site when the EPUB is updated.<br />This sets whether that will default to on or off."))
self.updateepubcover.setChecked(prefs['updateepubcover'])
self.l.addWidget(self.updateepubcover)

def updateepubcover_changed():
if not self.updateepubcover.isChecked():
updateepubcover_warning()
self.updateepubcover.stateChanged.connect(updateepubcover_changed)

cali_gb = groupbox = QGroupBox(_("Updating Calibre Options"))
self.l = QVBoxLayout()
groupbox.setLayout(self.l)
Expand Down
34 changes: 0 additions & 34 deletions calibre-plugin/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,6 @@ def __init__(self, gui, prefs, icon):
self.mergehide.append(self.updatemeta)
self.mergeupdateshow.append(self.updatemeta)

self.updateepubcover = QCheckBox(_('Update EPUB Cover?'),self)
# self.updateepubcover.setToolTip(_('Update book cover image from site or defaults (if found) <i>inside</i> the EPUB when EPUB is updated.'))
self.updateepubcover.setToolTip(_('This feature is being removed. See FanFicFare > Config > General.'))
self.updateepubcover.setChecked(self.prefs['updateepubcover'])
self.updateepubcover.setEnabled(False)
horz.addWidget(self.updateepubcover)
self.mergehide.append(self.updateepubcover)

self.gbl.addLayout(horz)

## bgmeta not used with Add New because of stories that change
Expand Down Expand Up @@ -451,11 +443,6 @@ def show_dialog(self,
self.updatemeta.setChecked(self.prefs['updatemeta'])
# self.bgmeta.setChecked(self.prefs['bgmeta'])

if not self.merge:
self.updateepubcover.setChecked(self.prefs['updateepubcover'])
if not self.prefs['updateepubcover']:
updateepubcover_warning()

self.url.setText(url_list_text)
if url_list_text:
self.button_box.button(QDialogButtonBox.Ok).setFocus()
Expand Down Expand Up @@ -493,14 +480,12 @@ def get_fff_options(self):
'collision': unicode(self.collision.currentText()),
'updatemeta': self.updatemeta.isChecked(),
'bgmeta': False, # self.bgmeta.isChecked(),
'updateepubcover': self.updateepubcover.isChecked(),
'smarten_punctuation':self.prefs['smarten_punctuation'],
'do_wordcount':self.prefs['do_wordcount'],
}

if self.merge:
retval['fileform']=='epub'
retval['updateepubcover']=True
if self.newmerge:
retval['updatemeta']=True
retval['collision']=ADDNEW
Expand Down Expand Up @@ -912,15 +897,6 @@ def __init__(self, gui, header, prefs, icon, books,
self.updatemeta.setChecked(self.prefs['updatemeta'])
horz.addWidget(self.updatemeta)

self.updateepubcover = QCheckBox(_('Update EPUB Cover?'),self)
# self.updateepubcover.setToolTip(_('Update book cover image from site or defaults (if found) <i>inside</i> the EPUB when EPUB is updated.'))
self.updateepubcover.setToolTip(_('This feature is being removed. See FanFicFare > Config > General.'))
self.updateepubcover.setEnabled(False)
self.updateepubcover.setChecked(self.prefs['updateepubcover'])
horz.addWidget(self.updateepubcover)
if not self.prefs['updateepubcover']:
updateepubcover_warning()

self.bgmeta = QCheckBox(_('Background Metadata?'),self)
self.bgmeta.setToolTip(_("Collect Metadata from sites in a Background process.<br />This returns control to you quicker while updating, but you won't be asked for username/passwords or if you are an adult--stories that need those will just fail."))
self.bgmeta.setChecked(self.prefs['bgmeta'])
Expand Down Expand Up @@ -972,7 +948,6 @@ def get_fff_options(self):
'collision': unicode(self.collision.currentText()),
'updatemeta': self.updatemeta.isChecked(),
'bgmeta': self.bgmeta.isChecked(),
'updateepubcover': self.updateepubcover.isChecked(),
'smarten_punctuation':self.prefs['smarten_punctuation'],
'do_wordcount':self.prefs['do_wordcount'],
}
Expand Down Expand Up @@ -1713,12 +1688,3 @@ def set_all_flag(a,s):
gprefs.set('questions_to_auto_skip', list(auto_skip))

return ret

from calibre.gui2.ui import get_gui
def updateepubcover_warning():
return confirm('<p>'+_("FanFicFare's <i><b>Update EPUB Cover</b></i> Download Option is being removed.")+'<\p>'+
'<p>'+_("It was a very old setting that didn't quite do what users expected.")+'<\p>'+
'<p>'+_("You are getting this warning because you have <i><b>Default Update EPUB Cover when Updating EPUB?</b></i> unchecked in FanFicFare > Config > General.")+'<\p>'+
'<p>'+_("See <a href='https://github.com/JimmXinu/FanFicFare/issues/878'>this issue</a> for more information.")+'<\p>',
'fff_updateepubcover_warning',
get_gui(), show_cancel_button=False, title=_("FanFicFare Warning"))
16 changes: 4 additions & 12 deletions calibre-plugin/fff_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@
LoopProgressDialog, UserPassDialog, AboutDialog, CollectURLDialog,
RejectListDialog, EmailPassDialog,
save_collisions, question_dialog_all,
NotGoingToDownload, RejectUrlEntry,
updateepubcover_warning)
NotGoingToDownload, RejectUrlEntry)

# because calibre immediately transforms html into zip and don't want
# to have an 'if html'. db.has_format is cool with the case mismatch,
Expand Down Expand Up @@ -591,15 +590,12 @@ def get_urls_from_imap_menu(self,checked,extraoptions={}):
if prefs['download_from_email_immediately']:
## do imap fetch w/o GUI elements
if url_list:
if prefs['updateepubcover'] == False:
updateepubcover_warning()
self.prep_downloads({
'fileform': prefs['fileform'],
# save_collisions==convert from save value to local lang value
'collision': extraoptions.get('collision',save_collisions[prefs['collision']]),
'updatemeta': prefs['updatemeta'],
'bgmeta': False,
'updateepubcover': prefs['updateepubcover'],
'smarten_punctuation':prefs['smarten_punctuation'],
'do_wordcount':prefs['do_wordcount'],
'add_tag':prefs['imaptags'],
Expand Down Expand Up @@ -1237,8 +1233,7 @@ def prep_download_loop(self,book,
options={'fileform':'epub',
'collision':ADDNEW,
'updatemeta':True,
'bgmeta':False,
'updateepubcover':True},
'bgmeta':False},
merge=False):
'''
Update passed in book dict with metadata from website and
Expand All @@ -1260,7 +1255,6 @@ def prep_download_loop(self,book,
collision = book['collision'] = options['collision']
updatemeta= options['updatemeta']
bgmeta= options['bgmeta']
updateepubcover= options['updateepubcover']

## Check reject list. Redundant with below for when story URL
## changes, but also kept here to avoid network hit in most
Expand Down Expand Up @@ -1668,8 +1662,7 @@ def start_download_job(self,book_list,
options={'fileform':'epub',
'collision':ADDNEW,
'updatemeta':True,
'bgmeta':False,
'updateepubcover':True},
'bgmeta':False},
merge=False):
'''
Called by LoopProgressDialog to start story downloads BG processing.
Expand Down Expand Up @@ -1798,8 +1791,7 @@ def update_books_loop(self,book,db=None,
options={'fileform':'epub',
'collision':ADDNEW,
'updatemeta':True,
'bgmeta':False,
'updateepubcover':True},
'bgmeta':False},
errorcol_label=None,
lastcheckedcol_label=None):

Expand Down
3 changes: 0 additions & 3 deletions calibre-plugin/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,6 @@ def do_download_for_worker(book,options,merge,notification=lambda x,y:x):
options['fileform'],
options['personal.ini'])

if not options['updateepubcover'] and 'epub_for_update' in book and book['collision'] in (UPDATE, UPDATEALWAYS):
configuration.set("overrides","never_make_cover","true")

# images only for epub, html, even if the user mistakenly
# turned it on else where.
if options['fileform'] not in ("epub","html"):
Expand Down
2 changes: 1 addition & 1 deletion calibre-plugin/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@

default_prefs['updatemeta'] = True
default_prefs['bgmeta'] = False
default_prefs['updateepubcover'] = True # removed in favor of always True Sep 2022
#default_prefs['updateepubcover'] = True # removed in favor of always True Oct 2022
default_prefs['keeptags'] = False
default_prefs['suppressauthorsort'] = False
default_prefs['suppresstitlesort'] = False
Expand Down

0 comments on commit 4d322a8

Please sign in to comment.