mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Show EPUB version in window title
This commit is contained in:
parent
b4036b1c44
commit
53cd9b3f42
@ -253,6 +253,10 @@ class Container(ContainerBase): # {{{
|
|||||||
SUPPORTS_TITLEPAGES = True
|
SUPPORTS_TITLEPAGES = True
|
||||||
SUPPORTS_FILENAMES = True
|
SUPPORTS_FILENAMES = True
|
||||||
|
|
||||||
|
@property
|
||||||
|
def book_type_for_display(self):
|
||||||
|
return self.book_type.upper()
|
||||||
|
|
||||||
def __init__(self, rootpath, opfpath, log, clone_data=None):
|
def __init__(self, rootpath, opfpath, log, clone_data=None):
|
||||||
ContainerBase.__init__(self, log)
|
ContainerBase.__init__(self, log)
|
||||||
self.root = clone_data['root'] if clone_data is not None else os.path.abspath(rootpath)
|
self.root = clone_data['root'] if clone_data is not None else os.path.abspath(rootpath)
|
||||||
@ -1118,6 +1122,26 @@ class EpubContainer(Container):
|
|||||||
|
|
||||||
book_type = 'epub'
|
book_type = 'epub'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def book_type_for_display(self):
|
||||||
|
ans = self.book_type.upper()
|
||||||
|
try:
|
||||||
|
v = self.opf_version_parsed
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
if v.major == 2:
|
||||||
|
ans += ' 2'
|
||||||
|
else:
|
||||||
|
if not v.minor:
|
||||||
|
ans += ' {}'.format(v.major)
|
||||||
|
else:
|
||||||
|
ans += ' {}.{}'.format(v.major, v.minor)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return ans
|
||||||
|
|
||||||
META_INF = {
|
META_INF = {
|
||||||
'container.xml': True,
|
'container.xml': True,
|
||||||
'manifest.xml': False,
|
'manifest.xml': False,
|
||||||
|
@ -456,6 +456,7 @@ class Boss(QObject):
|
|||||||
c = current_container()
|
c = current_container()
|
||||||
if c.opf_name in editors and not editors[c.opf_name].is_synced_to_container:
|
if c.opf_name in editors and not editors[c.opf_name].is_synced_to_container:
|
||||||
self.commit_editor_to_container(c.opf_name)
|
self.commit_editor_to_container(c.opf_name)
|
||||||
|
self.gui.update_window_title()
|
||||||
|
|
||||||
def reorder_spine(self, items):
|
def reorder_spine(self, items):
|
||||||
self.add_savepoint(_('Before: Re-order text'))
|
self.add_savepoint(_('Before: Re-order text'))
|
||||||
@ -603,6 +604,7 @@ class Boss(QObject):
|
|||||||
raise
|
raise
|
||||||
if changed:
|
if changed:
|
||||||
self.apply_container_update_to_gui()
|
self.apply_container_update_to_gui()
|
||||||
|
self.gui.update_window_title()
|
||||||
if not changed:
|
if not changed:
|
||||||
self.rewind_savepoint()
|
self.rewind_savepoint()
|
||||||
show_report(changed, self.current_metadata.title, report, parent or self.gui, self.show_current_diff)
|
show_report(changed, self.current_metadata.title, report, parent or self.gui, self.show_current_diff)
|
||||||
|
@ -776,8 +776,12 @@ class Main(MainWindow):
|
|||||||
return super(Main, self).resizeEvent(ev)
|
return super(Main, self).resizeEvent(ev)
|
||||||
|
|
||||||
def update_window_title(self):
|
def update_window_title(self):
|
||||||
fname = os.path.basename(current_container().path_to_ebook)
|
cc = current_container()
|
||||||
self.setWindowTitle(self.current_metadata.title + ' [%s] :: %s :: %s' %(current_container().book_type.upper(), fname, self.APP_NAME))
|
if cc is not None:
|
||||||
|
fname = os.path.basename(cc.path_to_ebook)
|
||||||
|
self.setWindowTitle(self.current_metadata.title + ' [%s] :: %s :: %s' %(cc.book_type_for_display, fname, self.APP_NAME))
|
||||||
|
else:
|
||||||
|
self.setWindowTitle(self.APP_NAME)
|
||||||
|
|
||||||
def closeEvent(self, e):
|
def closeEvent(self, e):
|
||||||
if self.boss.quit():
|
if self.boss.quit():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user