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