mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Wire up the reports tool
This commit is contained in:
parent
31b97d7bae
commit
a7505aa324
BIN
resources/images/reports.png
Normal file
BIN
resources/images/reports.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 117 KiB |
@ -129,6 +129,7 @@ class Boss(QObject):
|
|||||||
self.gui.manage_fonts.container_changed.connect(self.apply_container_update_to_gui)
|
self.gui.manage_fonts.container_changed.connect(self.apply_container_update_to_gui)
|
||||||
self.gui.manage_fonts.embed_all_fonts.connect(self.manage_fonts_embed)
|
self.gui.manage_fonts.embed_all_fonts.connect(self.manage_fonts_embed)
|
||||||
self.gui.manage_fonts.subset_all_fonts.connect(self.manage_fonts_subset)
|
self.gui.manage_fonts.subset_all_fonts.connect(self.manage_fonts_subset)
|
||||||
|
self.gui.reports.edit_requested.connect(self.report_edit_requested)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def currently_editing(self):
|
def currently_editing(self):
|
||||||
@ -1151,6 +1152,17 @@ class Boss(QObject):
|
|||||||
self.gui.image_browser.show()
|
self.gui.image_browser.show()
|
||||||
self.gui.image_browser.raise_()
|
self.gui.image_browser.raise_()
|
||||||
|
|
||||||
|
def show_reports(self):
|
||||||
|
self.gui.reports.refresh()
|
||||||
|
self.gui.reports.show()
|
||||||
|
self.gui.reports.raise_()
|
||||||
|
|
||||||
|
def report_edit_requested(self, name, location=None):
|
||||||
|
mt = current_container().mime_map.get(name, guess_type(name))
|
||||||
|
editor = self.edit_file_requested(name, None, mt)
|
||||||
|
if editor is None and location is not None:
|
||||||
|
pass
|
||||||
|
|
||||||
def image_activated(self, name):
|
def image_activated(self, name):
|
||||||
mt = current_container().mime_map.get(name, guess_type(name))
|
mt = current_container().mime_map.get(name, guess_type(name))
|
||||||
self.edit_file_requested(name, None, mt)
|
self.edit_file_requested(name, None, mt)
|
||||||
|
@ -175,7 +175,7 @@ class FilesWidget(QWidget):
|
|||||||
human_readable, (m.total_size, m.images_size, m.fonts_size))))
|
human_readable, (m.total_size, m.images_size, m.fonts_size))))
|
||||||
|
|
||||||
def double_clicked(self, index):
|
def double_clicked(self, index):
|
||||||
name = self.model.name(index)
|
name = self.model.name(self.proxy.mapToSource(index))
|
||||||
if name is not None:
|
if name is not None:
|
||||||
self.edit_requested.emit(name, None)
|
self.edit_requested.emit(name, None)
|
||||||
|
|
||||||
@ -231,6 +231,7 @@ class Reports(Dialog):
|
|||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
Dialog.__init__(self, _('Reports'), 'reports-dialog', parent=parent)
|
Dialog.__init__(self, _('Reports'), 'reports-dialog', parent=parent)
|
||||||
self.data_gathered.connect(self.display_data, type=Qt.QueuedConnection)
|
self.data_gathered.connect(self.display_data, type=Qt.QueuedConnection)
|
||||||
|
self.setAttribute(Qt.WA_DeleteOnClose, False)
|
||||||
|
|
||||||
def setup_ui(self):
|
def setup_ui(self):
|
||||||
self.l = l = QVBoxLayout(self)
|
self.l = l = QVBoxLayout(self)
|
||||||
|
@ -38,6 +38,7 @@ from calibre.gui2.tweak_book.search import SavedSearches
|
|||||||
from calibre.gui2.tweak_book.toc import TOCViewer
|
from calibre.gui2.tweak_book.toc import TOCViewer
|
||||||
from calibre.gui2.tweak_book.char_select import CharSelect
|
from calibre.gui2.tweak_book.char_select import CharSelect
|
||||||
from calibre.gui2.tweak_book.live_css import LiveCSS
|
from calibre.gui2.tweak_book.live_css import LiveCSS
|
||||||
|
from calibre.gui2.tweak_book.reports import Reports
|
||||||
from calibre.gui2.tweak_book.manage_fonts import ManageFonts
|
from calibre.gui2.tweak_book.manage_fonts import ManageFonts
|
||||||
from calibre.gui2.tweak_book.function_replace import DebugOutput
|
from calibre.gui2.tweak_book.function_replace import DebugOutput
|
||||||
from calibre.gui2.tweak_book.editor.widget import register_text_editor_actions
|
from calibre.gui2.tweak_book.editor.widget import register_text_editor_actions
|
||||||
@ -238,6 +239,7 @@ class Main(MainWindow):
|
|||||||
self.toc_view = TOCViewer(self)
|
self.toc_view = TOCViewer(self)
|
||||||
self.saved_searches = SavedSearches(self)
|
self.saved_searches = SavedSearches(self)
|
||||||
self.image_browser = InsertImage(self, for_browsing=True)
|
self.image_browser = InsertImage(self, for_browsing=True)
|
||||||
|
self.reports = Reports(self)
|
||||||
self.insert_char = CharSelect(self)
|
self.insert_char = CharSelect(self)
|
||||||
self.manage_fonts = ManageFonts(self)
|
self.manage_fonts = ManageFonts(self)
|
||||||
self.sr_debug_output = DebugOutput(self)
|
self.sr_debug_output = DebugOutput(self)
|
||||||
@ -368,6 +370,8 @@ class Main(MainWindow):
|
|||||||
_('Filter style information'))
|
_('Filter style information'))
|
||||||
self.action_manage_fonts = treg('font.png', _('Manage &fonts'), self.boss.manage_fonts, 'manage-fonts', (), _('Manage fonts in the book'))
|
self.action_manage_fonts = treg('font.png', _('Manage &fonts'), self.boss.manage_fonts, 'manage-fonts', (), _('Manage fonts in the book'))
|
||||||
self.action_add_cover = treg('default_cover.png', _('Add &cover'), self.boss.add_cover, 'add-cover', (), _('Add a cover to the book'))
|
self.action_add_cover = treg('default_cover.png', _('Add &cover'), self.boss.add_cover, 'add-cover', (), _('Add a cover to the book'))
|
||||||
|
self.action_reports = treg(
|
||||||
|
'reports.png', _('&Reports'), self.boss.show_reports, 'show-reports', ('Ctrl+Shift+R',), _('Show a report on various aspects of the book'))
|
||||||
|
|
||||||
def ereg(icon, text, target, sid, keys, description):
|
def ereg(icon, text, target, sid, keys, description):
|
||||||
return reg(icon, text, partial(self.boss.editor_action, target), sid, keys, description)
|
return reg(icon, text, partial(self.boss.editor_action, target), sid, keys, description)
|
||||||
@ -525,6 +529,7 @@ class Main(MainWindow):
|
|||||||
e.addAction(self.action_filter_css)
|
e.addAction(self.action_filter_css)
|
||||||
e.addAction(self.action_spell_check_book)
|
e.addAction(self.action_spell_check_book)
|
||||||
e.addAction(self.action_check_book)
|
e.addAction(self.action_check_book)
|
||||||
|
e.addAction(self.action_reports)
|
||||||
|
|
||||||
e = b.addMenu(_('&View'))
|
e = b.addMenu(_('&View'))
|
||||||
t = e.addMenu(_('Tool&bars'))
|
t = e.addMenu(_('Tool&bars'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user