1.1 --- a/XSLForms/Prepare.py Mon Oct 24 15:28:21 2005 +0000
1.2 +++ b/XSLForms/Prepare.py Mon Oct 24 18:13:33 2005 +0000
1.3 @@ -26,6 +26,8 @@
1.4
1.5 resource_dir = os.path.join(os.path.split(__file__)[0], "XSL")
1.6
1.7 +# Web template functions.
1.8 +
1.9 def make_stylesheet(template_name, output_name, stylesheet_names=["PrepareMacro.xsl", "Prepare.xsl"], encoding=None):
1.10
1.11 """
1.12 @@ -77,6 +79,8 @@
1.13
1.14 make_stylesheet_fragment(template_name, output_name, element_id)
1.15
1.16 +# Document initialisation functions.
1.17 +
1.18 def make_input_stylesheet(template_name, input_name, stylesheet_names=["Schema.xsl", "Input.xsl"], encoding=None):
1.19
1.20 """
1.21 @@ -103,4 +107,17 @@
1.22
1.23 make_input_stylesheet(template_name, input_name)
1.24
1.25 +# Qt Designer functions.
1.26 +
1.27 +def make_qt_fragment(template_name, output_name, widget_name, stylesheet_name="QtDesignerExtract.xsl", encoding=None):
1.28 + proc = XSLOutput.Processor([os.path.join(resource_dir, stylesheet_name)], parameters={"widget-name" : widget_name})
1.29 + template = libxml2dom.parse(template_name)
1.30 + proc.send_output(open(output_name, "wb"), encoding, template)
1.31 +
1.32 +def ensure_qt_fragment(template_name, output_name, widget_name):
1.33 + if not os.path.exists(output_name) or \
1.34 + os.path.getmtime(output_name) < os.path.getmtime(template_name):
1.35 +
1.36 + make_qt_fragment(template_name, output_name, widget_name)
1.37 +
1.38 # vim: tabstop=4 expandtab shiftwidth=4