# HG changeset patch # User paulb # Date 1130871252 0 # Node ID d2d05b53c4382585ed375ec499e750181b3fb94d # Parent f2710049be3e4bc265d40b60c902ff545db9bb37 [project @ 2005-11-01 18:54:12 by paulb] Added functions for preparing template and stylesheet fragments from Qt Designer files. diff -r f2710049be3e -r d2d05b53c438 XSLForms/Prepare.py --- a/XSLForms/Prepare.py Tue Nov 01 16:47:22 2005 +0000 +++ b/XSLForms/Prepare.py Tue Nov 01 18:54:12 2005 +0000 @@ -28,7 +28,7 @@ # Generic functions. -def _ensure_stylesheet(template_name, output_name, fn, *args, **kw): +def _ensure_document(template_name, output_name, fn, *args, **kw): if not os.path.exists(output_name) or \ os.path.getmtime(output_name) < os.path.getmtime(template_name): @@ -69,7 +69,7 @@ given 'output_name'. """ - _ensure_stylesheet(template_name, output_name, make_stylesheet) + _ensure_document(template_name, output_name, make_stylesheet) def ensure_stylesheet_fragment(template_name, output_name, element_id): @@ -80,7 +80,7 @@ 'element_id'. """ - _ensure_stylesheet(template_name, output_name, make_stylesheet_fragment, element_id) + _ensure_document(template_name, output_name, make_stylesheet_fragment, element_id) # Document initialisation functions. @@ -112,7 +112,7 @@ indicate whether enumerations are to be initialised from external documents. """ - _ensure_stylesheet(template_name, input_name, make_input_stylesheet, init_enumerations) + _ensure_document(template_name, input_name, make_input_stylesheet, init_enumerations) # Schema-related functions. @@ -131,20 +131,36 @@ _make_document(template_name, output_name, stylesheet_names, encoding, parameters={"widget-name" : widget_name}) def ensure_qt_fragment(template_name, output_name, widget_name): - _ensure_stylesheet(template_name, output_name, make_qt_fragment, widget_name) + _ensure_document(template_name, output_name, make_qt_fragment, widget_name) # Qt Designer Web functions. def make_qt_template(template_name, output_name, stylesheet_names=["QtDesigner.xsl"], encoding=None): - return make_stylesheet(template_name, output_name, stylesheet_names, encoding) + _make_document(template_name, output_name, stylesheet_names, encoding) def ensure_qt_template(template_name, output_name): - _ensure_stylesheet(template_name, output_name, make_qt_template) + _ensure_document(template_name, output_name, make_qt_template) def make_qt_stylesheet(template_name, output_name, stylesheet_names=["QtDesigner.xsl", "PrepareMacro.xsl", "Prepare.xsl"], encoding=None): - return make_stylesheet(template_name, output_name, stylesheet_names, encoding) + _make_document(template_name, output_name, stylesheet_names, encoding) def ensure_qt_stylesheet(template_name, output_name): - _ensure_stylesheet(template_name, output_name, make_qt_stylesheet) + _ensure_document(template_name, output_name, make_qt_stylesheet) + +# Qt Designer Web functions for fragments. + +def make_qt_template_fragment(template_name, output_name, widget_name, stylesheet_names=["QtDesignerExtract.xsl", "QtDesigner.xsl"], encoding=None): + _make_document(template_name, output_name, stylesheet_names, encoding, parameters={"widget-name" : widget_name}) + +def ensure_qt_template_fragment(template_name, output_name, widget_name): + _ensure_document(template_name, output_name, make_qt_template_fragment, widget_name) + +def make_qt_stylesheet_fragment(template_name, output_name, widget_name, + stylesheet_names=["QtDesignerExtract.xsl", "QtDesigner.xsl", "PrepareMacro.xsl", "Prepare.xsl"], encoding=None): + + _make_document(template_name, output_name, stylesheet_names, encoding, parameters={"widget-name" : widget_name}) + +def ensure_qt_stylesheet_fragment(template_name, output_name, widget_name): + _ensure_document(template_name, output_name, make_qt_stylesheet_fragment, widget_name) # vim: tabstop=4 expandtab shiftwidth=4