mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-16 21:55:50 +01:00
More miscellaneous fixes
This commit is contained in:
parent
19e7ed0cb7
commit
e80fcc13fc
3 changed files with 10 additions and 3 deletions
|
|
@ -941,7 +941,10 @@ def abshref(self, href):
|
|||
href = urlunparse(purl)
|
||||
path, frag = urldefrag(href)
|
||||
if not path:
|
||||
return '#'.join((self.href, frag))
|
||||
if frag:
|
||||
return '#'.join((self.href, frag))
|
||||
else:
|
||||
return self.href
|
||||
if '/' not in self.href:
|
||||
return href
|
||||
dirname = os.path.dirname(self.href)
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ def create_toc_from_links(self):
|
|||
play_order=self.oeb.toc.next_play_order())
|
||||
|
||||
|
||||
|
||||
def elem_to_link(self, item, elem, counter):
|
||||
text = u' '.join([t.strip() for t in elem.xpath('descendant::text()')])
|
||||
text = text[:100].strip()
|
||||
|
|
|
|||
|
|
@ -159,9 +159,12 @@ def set_cover(self):
|
|||
row = self.formats.currentRow()
|
||||
fmt = self.formats.item(row)
|
||||
if fmt is None:
|
||||
error_dialog(self, _('No format selected'),
|
||||
if self.formats.count() == 1:
|
||||
fmt = self.formats.item(0)
|
||||
if fmt is None:
|
||||
error_dialog(self, _('No format selected'),
|
||||
_('No format selected')).exec_()
|
||||
return
|
||||
return
|
||||
ext = fmt.ext.lower()
|
||||
if fmt.path is None:
|
||||
stream = self.db.format(self.row, ext, as_file=True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue