mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
671d618254
commit
7e233696a1
@ -11,6 +11,7 @@ Here you will find tutorials to get you started using |app|'s more advanced feat
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
news
|
||||
xpath
|
||||
template_lang
|
||||
portable
|
||||
|
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
||||
import sys
|
||||
|
||||
from calibre import prints as prints_
|
||||
from calibre.utils.config import Config, ConfigProxy
|
||||
from calibre.utils.config import Config, ConfigProxy, JSONConfig
|
||||
|
||||
|
||||
def console_config():
|
||||
@ -20,7 +20,7 @@ def console_config():
|
||||
return c
|
||||
|
||||
prefs = ConfigProxy(console_config())
|
||||
|
||||
dynamic = JSONConfig('console')
|
||||
|
||||
def prints(*args, **kwargs):
|
||||
kwargs['file'] = sys.__stdout__
|
||||
|
@ -12,6 +12,7 @@ from PyQt4.Qt import QDialog, QToolBar, QStatusBar, QLabel, QFont, Qt, \
|
||||
QApplication, QIcon, QVBoxLayout, QAction
|
||||
|
||||
from calibre.constants import __appname__, __version__
|
||||
from calibre.utils.pyconsole import dynamic
|
||||
from calibre.utils.pyconsole.console import Console
|
||||
|
||||
class MainWindow(QDialog):
|
||||
@ -26,6 +27,9 @@ class MainWindow(QDialog):
|
||||
self.setLayout(self.l)
|
||||
|
||||
self.resize(800, 600)
|
||||
geom = dynamic.get('console_window_geometry', None)
|
||||
if geom is not None:
|
||||
self.restoreGeometry(geom)
|
||||
|
||||
# Setup tool bar {{{
|
||||
self.tool_bar = QToolBar(self)
|
||||
@ -62,17 +66,25 @@ class MainWindow(QDialog):
|
||||
self.restart_requested = True
|
||||
self.reject()
|
||||
|
||||
def main():
|
||||
QApplication.setApplicationName(__appname__+' console')
|
||||
QApplication.setOrganizationName('Kovid Goyal')
|
||||
app = QApplication([])
|
||||
app
|
||||
def closeEvent(self, *args):
|
||||
dynamic.set('console_window_geometry',
|
||||
bytearray(self.saveGeometry()))
|
||||
return QDialog.closeEvent(self, *args)
|
||||
|
||||
|
||||
def show():
|
||||
while True:
|
||||
m = MainWindow()
|
||||
m.exec_()
|
||||
if not m.restart_requested:
|
||||
break
|
||||
|
||||
def main():
|
||||
QApplication.setApplicationName(__appname__+' console')
|
||||
QApplication.setOrganizationName('Kovid Goyal')
|
||||
app = QApplication([])
|
||||
app
|
||||
show()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user