From c1bb1ab5c6446622367afbfa04e2aaea5a7cc9e3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 20 Mar 2012 09:57:59 +0530 Subject: [PATCH] E-book viewer: When in full screen mode, using the close window keyboard shortcut drops out of full screen instead of closing the window --- src/calibre/gui2/viewer/main.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py index 64521ecdd7..a83c5d12c0 100644 --- a/src/calibre/gui2/viewer/main.py +++ b/src/calibre/gui2/viewer/main.py @@ -5,11 +5,11 @@ import traceback, os, sys, functools, collections, re from functools import partial from threading import Thread -from PyQt4.Qt import QApplication, Qt, QIcon, QTimer, SIGNAL, QByteArray, \ - QDoubleSpinBox, QLabel, QTextBrowser, \ - QPainter, QBrush, QColor, QStandardItemModel, QPalette, \ - QStandardItem, QUrl, QRegExpValidator, QRegExp, QLineEdit, \ - QToolButton, QMenu, QInputDialog, QAction, QKeySequence +from PyQt4.Qt import (QApplication, Qt, QIcon, QTimer, SIGNAL, QByteArray, + QDoubleSpinBox, QLabel, QTextBrowser, + QPainter, QBrush, QColor, QStandardItemModel, QPalette, + QStandardItem, QUrl, QRegExpValidator, QRegExp, QLineEdit, + QToolButton, QMenu, QInputDialog, QAction, QKeySequence) from calibre.gui2.viewer.main_ui import Ui_EbookViewer from calibre.gui2.viewer.printing import Printing @@ -338,6 +338,10 @@ class EbookViewer(MainWindow, Ui_EbookViewer): count += 1 def closeEvent(self, e): + if self.isFullScreen(): + self.showNormal() + e.ignore() + return self.save_state() return MainWindow.closeEvent(self, e)