From 445066a3811b8209cf4acb9b839325d32ecbd141 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 10 Jul 2022 09:34:36 +0530 Subject: [PATCH] Allow running the template preferences without a gui --- src/calibre/gui2/preferences/template_functions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/preferences/template_functions.py b/src/calibre/gui2/preferences/template_functions.py index a5d0a3b974..59b80a76e8 100644 --- a/src/calibre/gui2/preferences/template_functions.py +++ b/src/calibre/gui2/preferences/template_functions.py @@ -505,7 +505,11 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): if __name__ == '__main__': - from calibre import Application + from calibre.gui2 import Application + from calibre.gui2.ui import get_gui + from calibre.library import db app = Application([]) + app.current_db = db() + get_gui.ans = app test_widget('Advanced', 'TemplateFunctions') del app