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::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
|
news
|
||||||
xpath
|
xpath
|
||||||
template_lang
|
template_lang
|
||||||
portable
|
portable
|
||||||
|
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from calibre import prints as prints_
|
from calibre import prints as prints_
|
||||||
from calibre.utils.config import Config, ConfigProxy
|
from calibre.utils.config import Config, ConfigProxy, JSONConfig
|
||||||
|
|
||||||
|
|
||||||
def console_config():
|
def console_config():
|
||||||
@ -20,7 +20,7 @@ def console_config():
|
|||||||
return c
|
return c
|
||||||
|
|
||||||
prefs = ConfigProxy(console_config())
|
prefs = ConfigProxy(console_config())
|
||||||
|
dynamic = JSONConfig('console')
|
||||||
|
|
||||||
def prints(*args, **kwargs):
|
def prints(*args, **kwargs):
|
||||||
kwargs['file'] = sys.__stdout__
|
kwargs['file'] = sys.__stdout__
|
||||||
|
@ -12,6 +12,7 @@ from PyQt4.Qt import QDialog, QToolBar, QStatusBar, QLabel, QFont, Qt, \
|
|||||||
QApplication, QIcon, QVBoxLayout, QAction
|
QApplication, QIcon, QVBoxLayout, QAction
|
||||||
|
|
||||||
from calibre.constants import __appname__, __version__
|
from calibre.constants import __appname__, __version__
|
||||||
|
from calibre.utils.pyconsole import dynamic
|
||||||
from calibre.utils.pyconsole.console import Console
|
from calibre.utils.pyconsole.console import Console
|
||||||
|
|
||||||
class MainWindow(QDialog):
|
class MainWindow(QDialog):
|
||||||
@ -26,6 +27,9 @@ class MainWindow(QDialog):
|
|||||||
self.setLayout(self.l)
|
self.setLayout(self.l)
|
||||||
|
|
||||||
self.resize(800, 600)
|
self.resize(800, 600)
|
||||||
|
geom = dynamic.get('console_window_geometry', None)
|
||||||
|
if geom is not None:
|
||||||
|
self.restoreGeometry(geom)
|
||||||
|
|
||||||
# Setup tool bar {{{
|
# Setup tool bar {{{
|
||||||
self.tool_bar = QToolBar(self)
|
self.tool_bar = QToolBar(self)
|
||||||
@ -62,17 +66,25 @@ class MainWindow(QDialog):
|
|||||||
self.restart_requested = True
|
self.restart_requested = True
|
||||||
self.reject()
|
self.reject()
|
||||||
|
|
||||||
def main():
|
def closeEvent(self, *args):
|
||||||
QApplication.setApplicationName(__appname__+' console')
|
dynamic.set('console_window_geometry',
|
||||||
QApplication.setOrganizationName('Kovid Goyal')
|
bytearray(self.saveGeometry()))
|
||||||
app = QApplication([])
|
return QDialog.closeEvent(self, *args)
|
||||||
app
|
|
||||||
|
|
||||||
|
def show():
|
||||||
while True:
|
while True:
|
||||||
m = MainWindow()
|
m = MainWindow()
|
||||||
m.exec_()
|
m.exec_()
|
||||||
if not m.restart_requested:
|
if not m.restart_requested:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
def main():
|
||||||
|
QApplication.setApplicationName(__appname__+' console')
|
||||||
|
QApplication.setOrganizationName('Kovid Goyal')
|
||||||
|
app = QApplication([])
|
||||||
|
app
|
||||||
|
show()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user