Allow running doc editor via calibre-debug

Use

calibre-debug -c "from calibre.gui2.dialogs.ff_doc_editor import main; main()"
This commit is contained in:
Kovid Goyal 2024-11-13 20:48:04 +05:30
parent 7430a74bd9
commit d06185156a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -11,8 +11,7 @@ Created on 12 Nov 2024
@author: chaley
'''
from qt.core import (QApplication, QCheckBox, QComboBox, QFrame, QLabel, QGridLayout,
QHBoxLayout, QPlainTextEdit, QPushButton, QSize, QTimer)
from qt.core import QApplication, QCheckBox, QComboBox, QFrame, QGridLayout, QHBoxLayout, QLabel, QPlainTextEdit, QPushButton, QSize, QTimer
from calibre.constants import iswindows
from calibre.gui2 import gprefs
@ -186,8 +185,10 @@ class FFDocEditor(Dialog):
self.show_original_cb.setChecked(True)
self.fill_in_top_row()
if __name__ == '__main__':
def main():
from tempfile import TemporaryDirectory
from calibre.db.legacy import LibraryDatabase
from calibre.gui2 import Application
@ -196,4 +197,9 @@ if __name__ == '__main__':
db = LibraryDatabase(tdir) # needed to load formatter_funcs
d = FFDocEditor(None)
d.exec()
del db
del app
if __name__ == '__main__':
main()