1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/Common/QtConfigurator/factory.py Mon Oct 24 15:27:48 2005 +0000
1.3 @@ -0,0 +1,22 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +from qt import *
1.7 +import qtxmldom
1.8 +
1.9 +class Factory:
1.10 + def __init__(self, ui_filename):
1.11 + self.ui = qtxmldom.parse(ui_filename)
1.12 +
1.13 + def findWidget(self, widget_class, name):
1.14 + for widget in self.ui.getElementsByTagName("widget"):
1.15 + if widget.getAttribute("class") == widget_class:
1.16 + for property in widget.getElementsByTagName("property"):
1.17 + if property.getAttribute("name") == "name":
1.18 + for cstring in property.getElementsByTagName("cstring"):
1.19 + cstring.normalize()
1.20 + found_name = cstring.childNodes[0].nodeValue
1.21 + if found_name == name:
1.22 + return widget
1.23 + return None
1.24 +
1.25 +# vim: tabstop=4 expandtab shiftwidth=4