1.1 --- a/XSLForms/Resources/PyQtResources.py Thu Oct 27 16:31:26 2005 +0000
1.2 +++ b/XSLForms/Resources/PyQtResources.py Thu Oct 27 16:33:53 2005 +0000
1.3 @@ -31,6 +31,9 @@
1.4
1.5 widget_resources = {}
1.6
1.7 + def __init__(self, design_identifier):
1.8 + self.factory = Factory(self.prepare_design(design_identifier))
1.9 +
1.10 def get_document(self, document_identifier):
1.11 return qtxmldom.parse(self.prepare_document(document_identifier))
1.12
1.13 @@ -41,29 +44,6 @@
1.14 XSLForms.Prepare.ensure_qt_fragment(design_path, fragment_path, widget_name)
1.15 return qtui.QWidgetFactory.create(fragment_path, None, parent)
1.16
1.17 - def populate_list(self, field, elements):
1.18 - current_text = field.currentText()
1.19 - while field.count() > 0:
1.20 - field.removeItem(0)
1.21 - item = 0
1.22 - set = 0
1.23 - for element in elements:
1.24 - text = element.getAttribute("value")
1.25 - field.insertItem(text)
1.26 - if text == current_text:
1.27 - field.setCurrentItem(item)
1.28 - set = 1
1.29 - item += 1
1.30 - if not set:
1.31 - field.setCurrentItem(0)
1.32 -
1.33 - def reset_collection(self, field):
1.34 - layout = field.layout()
1.35 - for child in field.children():
1.36 - if child is not layout:
1.37 - layout.remove(child)
1.38 - child.deleteLater()
1.39 -
1.40 class Factory:
1.41
1.42 "A widget factory helper class."
1.43 @@ -90,6 +70,10 @@
1.44 for sender in senders:
1.45 qt.QObject.connect(sender, signal, getattr(obj, slot))
1.46
1.47 + def get_text(self, node):
1.48 + node.normalize()
1.49 + return node.childNodes[0].nodeValue
1.50 +
1.51 def find_widgets(self, widget, name):
1.52 widgets = []
1.53 found = widget.child(name)
1.54 @@ -99,18 +83,4 @@
1.55 widgets += self.find_widgets(child, name)
1.56 return widgets
1.57
1.58 - def get_text(self, node):
1.59 - node.normalize()
1.60 - return node.childNodes[0].nodeValue
1.61 -
1.62 - def find_widget_element(self, name):
1.63 - for widget in self.ui_doc.getElementsByTagName("widget"):
1.64 - for property in widget.getElementsByTagName("property"):
1.65 - if property.getAttribute("name") == "name":
1.66 - for cstring in property.getElementsByTagName("cstring"):
1.67 - found_name = self.get_text(cstring)
1.68 - if found_name == name:
1.69 - return widget
1.70 - return None
1.71 -
1.72 # vim: tabstop=4 expandtab shiftwidth=4