diff --git a/src/calibre/gui2/viewer/config.ui b/src/calibre/gui2/viewer/config.ui index c317bb3411..77532cdd6e 100644 --- a/src/calibre/gui2/viewer/config.ui +++ b/src/calibre/gui2/viewer/config.ui @@ -144,13 +144,36 @@ - + Remember last used &window size + + + + px + + + 100 + + + 10000 + + + + + + + Maximum &view width: + + + max_view_width + + + @@ -159,7 +182,7 @@ &User stylesheet - + @@ -180,6 +203,18 @@ + + serif_family + sans_family + mono_family + default_font_size + mono_font_size + standard_font + max_view_width + opt_remember_window_size + css + buttonBox + diff --git a/src/calibre/gui2/viewer/documentview.py b/src/calibre/gui2/viewer/documentview.py index 1fdd3a503b..fa0486b952 100644 --- a/src/calibre/gui2/viewer/documentview.py +++ b/src/calibre/gui2/viewer/documentview.py @@ -59,6 +59,8 @@ def config(defaults=None): help=_('Remember last used window size')) c.add_opt('user_css', default='', help=_('Set the user CSS stylesheet. This can be used to customize the look of all books.')) + c.add_opt('max_view_width', default=6000, + help=_('Maximum width of the viewer window, in pixels.')) fonts = c.add_group('FONTS', _('Font options')) fonts('serif_family', default='Times New Roman' if iswindows else 'Liberation Serif', @@ -103,6 +105,7 @@ class ConfigDialog(QDialog, Ui_Dialog): self.standard_font.setCurrentIndex({'serif':0, 'sans':1, 'mono':2}[opts.standard_font]) self.css.setPlainText(opts.user_css) self.css.setToolTip(_('Set the user CSS stylesheet. This can be used to customize the look of all books.')) + self.max_view_width.setValue(opts.max_view_width) def accept(self, *args): @@ -115,6 +118,7 @@ class ConfigDialog(QDialog, Ui_Dialog): c.set('standard_font', {0:'serif', 1:'sans', 2:'mono'}[self.standard_font.currentIndex()]) c.set('user_css', unicode(self.css.toPlainText())) c.set('remember_window_size', self.opt_remember_window_size.isChecked()) + c.set('max_view_width', int(self.max_view_width.value())) return QDialog.accept(self, *args) @@ -349,6 +353,8 @@ class DocumentView(QWebView): def config(self, parent=None): self.document.do_config(parent) + if self.manager is not None: + self.manager.set_max_width() def bookmark(self): return self.document.bookmark() diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py index 4182897ee0..7c50db68ee 100644 --- a/src/calibre/gui2/viewer/main.py +++ b/src/calibre/gui2/viewer/main.py @@ -284,6 +284,13 @@ class EbookViewer(MainWindow, Ui_EbookViewer): self.tool_bar.widgetForAction(self.action_print).setPopupMode(QToolButton.MenuButtonPopup) self.connect(self.action_print, SIGNAL("triggered(bool)"), partial(self.print_book, preview=False)) self.connect(self.print_menu.actions()[0], SIGNAL("triggered(bool)"), partial(self.print_book, preview=True)) + self.set_max_width() + + + def set_max_width(self): + from calibre.gui2.viewer.documentview import config + c = config().parse() + self.frame.setMaximumWidth(c.max_view_width) def print_book(self, preview): Printing(self.iterator.spine, preview) diff --git a/src/calibre/gui2/viewer/main.ui b/src/calibre/gui2/viewer/main.ui index f94f68b315..9161e76491 100644 --- a/src/calibre/gui2/viewer/main.ui +++ b/src/calibre/gui2/viewer/main.ui @@ -1,7 +1,8 @@ - + + EbookViewer - - + + 0 0 @@ -9,37 +10,42 @@ 672 - + Ebook Viewer - - + + :/images/viewer.svg:/images/viewer.svg - - - - - + + + + + Qt::Horizontal - - - - - - + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + - - - + + + Qt::Vertical - - - + + + Qt::Horizontal @@ -50,193 +56,193 @@ - - + + toolBar - + 32 32 - + LeftToolBarArea - + false - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - + + TopToolBarArea - + false - + - - - + + + :/images/back.svg:/images/back.svg - + Back - - - + + + :/images/forward.svg:/images/forward.svg - + Forward - - - + + + :/images/next.svg:/images/next.svg - + Next page - - - + + + :/images/previous.svg:/images/previous.svg - + Previous page - - - + + + :/images/font_size_larger.svg:/images/font_size_larger.svg - + Font size larger - - - + + + :/images/font_size_smaller.svg:/images/font_size_smaller.svg - + Font size smaller - - - + + + :/images/chapters.svg:/images/chapters.svg - + Table of Contents - - - + + + :/images/dialog_information.svg:/images/dialog_information.svg - + Metadata - - - + + + :/images/document_open.svg:/images/document_open.svg - + Open ebook - - - + + + :/images/arrow-down.svg:/images/arrow-down.svg - + Find next - - - + + + :/images/convert.svg:/images/convert.svg - + Copy to clipboard - - - + + + :/images/config.svg:/images/config.svg - + Preferences - - - + + + :/images/lookfeel.svg:/images/lookfeel.svg - + Reference Mode - - - + + + :/images/bookmarks.svg:/images/bookmarks.svg - + Bookmark - - - + + + :/images/page.svg:/images/page.svg - + Toggle full screen - - - + + + :/images/print.svg:/images/print.svg - + Print @@ -249,7 +255,7 @@ - +