BUILT_SOURCES = $(UIC_FILES_QDIALOG) $(UIC_FILES_GDIALOG)
# extra distributed files
-EXTRA_DIST += $(QDIALOG_TEMPLATES) $(GDIALOG_TEMPLATES) GenericDialog.ui README.txt dlgfactory.sh
+EXTRA_DIST += $(QDIALOG_TEMPLATES) $(GDIALOG_TEMPLATES) GenericDialog.ui README.txt dlgfactory.py
mostlyclean-local:
rm @builddir@/QDialogTest*
rm @builddir@/GDialogTest*
rm -f @builddir@/*_moc.cxx @builddir@/ui_*.hxx
-QDialogTest.hxx QDialogTest.cxx QDialogTest.ui: $(QDIALOG_TEMPLATES) dlgfactory.sh
- $(srcdir)/dlgfactory.sh -n QDialogTest -t qdialog
+QDialogTest.hxx QDialogTest.cxx QDialogTest.ui: $(QDIALOG_TEMPLATES) dlgfactory.py
+ $(srcdir)/dlgfactory.py -n QDialogTest -t qdialog
-GDialogTest.hxx GDialogTest.cxx GDialogTest.ui : $(GDIALOG_TEMPLATES) dlgfactory.sh
- $(srcdir)/dlgfactory.sh -n GDialogTest -t gdialog
+GDialogTest.hxx GDialogTest.cxx GDialogTest.ui : $(GDIALOG_TEMPLATES) dlgfactory.py
+ $(srcdir)/dlgfactory.py -n GDialogTest -t gdialog
QT_CXXFLAGS=@QT_INCLUDES@ @QT_MT_INCLUDES@
QT_LIBS=@QT_LIBS@
--- /dev/null
+#!/usr/bin/env python
+
+import sys, os
+from optparse import OptionParser
+import shutil, fileinput
+
+descr_str = """
+ This script generates a set of files to initiate a dialog qt window
+ (i.e. MyDialog.ui, MyDialog.hxx and MyDialog.cxx files).
+
+ The dialog window can be a self-consistent class (i.e. depends only
+ on Qt classes) or a classe that inherits from the class
+ GenericDialog whose implementation is provided in this package and
+ whose design is defined by the GenericDialog.ui file (editable using
+ the qt designer).
+
+ The -t option let you choose between the two possibilities (specify
+ "-t qdialog" for the first case, "-t gdialog" otherwise).
+"""
+msg_str = """
+#
+# ---------------------------------------------------------
+# Generation rules to create moc files from QObject headers
+# and form source files from ui files
+# ---------------------------------------------------------
+
+%_moc.cxx: %.hxx
+ $(MOC) $< -o $@
+
+ui_%.hxx: %.ui
+ $(UIC) -o $@ $<
+
+
+# ---------------------------------------------------------
+# Declaration of form files generated by UIC and MOC files
+# as BUILT_SOURCES to be used in the building process.
+# ---------------------------------------------------------
+#
+UIC_FILES = \
+ ui___CLASSNAME__.hxx
+#
+MOC_FILES = \
+ __CLASSNAME___moc.cxx
+
+BUILT_SOURCES = $(UIC_FILES)
+
+#
+# ---------------------------------------------------------
+# Declaration of sources files to the building process
+# ---------------------------------------------------------
+# MOC files and UIC files should be added to the list of undistributed
+# source files with something like (where <MyLibrary> should be
+# replaced by the name of the product declared by the directive
+# lib_LTLIBRARIES):
+#
+nodist_<MyLibrary>_la_SOURCES += $(MOC_FILES) $(UIC_FILES)
+
+dist_<MyLibrary>_la_SOURCES += __CLASSNAME__.cxx
+salomeinclude_HEADERS += __CLASSNAME__.hxx
+
+<MyLibrary>_la_CPPFLAGS = \\
+ $(QT_CXXFLAGS)
+
+<MyLibrary>_la_LDFLAGS = \\
+ $(QT_LIBS)
+"""
+
+tool_path = os.path.dirname( os.path.abspath(__file__) )
+
+parser = OptionParser(description=descr_str)
+parser.add_option("-n", action="store", default="TestDialog",
+ help="specify the name of the class (default is TestDialog)", metavar="className")
+parser.add_option("-t", action="store", default="qdialog",
+ choices=["qdialog", "gdialog"],
+ help="specify the type of the class (default is qdialog)", metavar="classType")
+
+(options, args) = parser.parse_args()
+className = options.n
+classType = options.t
+
+sep = os.path.sep
+for ext in [".cxx", ".hxx", ".ui"]:
+ file_dest = className + ext
+ if classType == "qdialog":
+ file_src = tool_path + sep + "__QDIALOG__" + ext
+ else:
+ file_src = tool_path + sep + "__GDIALOG__" + ext
+ shutil.copyfile(file_src, file_dest)
+ finput = fileinput.FileInput(file_dest,inplace=1)
+ for line in finput:
+ line = line[:-1]
+ line = line.replace("__CLASSNAME__",className)
+ print line
+
+print "Note that the following directives should be present in your Makefile.am (or something like that): \n"
+print msg_str.replace("__CLASSNAME__",className)
+
+
+
+
\ No newline at end of file