mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Remove the superseeded --redirect-console-output option from the calibre gui launcher
This commit is contained in:
parent
83d951fccb
commit
96017ef227
@ -20,26 +20,8 @@ Usage: %prog [options]
|
|||||||
Launch the Graphical User Interface
|
Launch the Graphical User Interface
|
||||||
'''):
|
'''):
|
||||||
parser = OptionParser(usage)
|
parser = OptionParser(usage)
|
||||||
# The b is required because of a regression in optparse.py in python 2.7.0
|
|
||||||
parser.add_option(b'--redirect-console-output', default=False, action='store_true', dest='redirect',
|
|
||||||
help=_('Redirect console output to a dialog window (both stdout and stderr). Useful on windows where GUI apps do not have a output streams.'))
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
class DebugWindow(ConversionErrorDialog):
|
|
||||||
|
|
||||||
def __init__(self, parent):
|
|
||||||
ConversionErrorDialog.__init__(self, parent, 'Console output', '')
|
|
||||||
self.setModal(Qt.NonModal)
|
|
||||||
font = QFont()
|
|
||||||
font.setStyleHint(QFont.TypeWriter)
|
|
||||||
self.text.setFont(font)
|
|
||||||
|
|
||||||
def write(self, msg):
|
|
||||||
self.text.setPlainText(self.text.toPlainText()+QString(msg))
|
|
||||||
|
|
||||||
def flush(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class GarbageCollector(QObject):
|
class GarbageCollector(QObject):
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@ -120,10 +102,6 @@ class MainWindow(QMainWindow):
|
|||||||
QMainWindow.__init__(self, parent)
|
QMainWindow.__init__(self, parent)
|
||||||
if disable_automatic_gc:
|
if disable_automatic_gc:
|
||||||
self._gc = GarbageCollector(self, debug=False)
|
self._gc = GarbageCollector(self, debug=False)
|
||||||
if getattr(opts, 'redirect', False):
|
|
||||||
self.__console_redirect = DebugWindow(self)
|
|
||||||
sys.stdout = sys.stderr = self.__console_redirect
|
|
||||||
self.__console_redirect.show()
|
|
||||||
|
|
||||||
def unhandled_exception(self, type, value, tb):
|
def unhandled_exception(self, type, value, tb):
|
||||||
if type == KeyboardInterrupt:
|
if type == KeyboardInterrupt:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user