1.1 --- a/examples/Common/QtConfigurator/__init__.py Tue Oct 25 17:50:19 2005 +0000
1.2 +++ b/examples/Common/QtConfigurator/__init__.py Tue Oct 25 17:51:39 2005 +0000
1.3 @@ -1,10 +1,8 @@
1.4 #!/usr/bin/env python
1.5
1.6 -import XSLForms.PyQt
1.7 -import QtConfigurator.Forms
1.8 import os
1.9
1.10 -class Configurator(QtConfigurator.Forms.Configurator, XSLForms.PyQt.XSLFormsResource):
1.11 +class ConfiguratorResource:
1.12
1.13 # Standard attributes.
1.14
1.15 @@ -35,8 +33,6 @@
1.16 # Initialisation.
1.17
1.18 def __init__(self, *args, **kw):
1.19 - QtConfigurator.Forms.Configurator.__init__(self, *args, **kw)
1.20 - self.factory = XSLForms.PyQt.Factory(self.prepare_template("configuration"))
1.21
1.22 # Get field data.
1.23 # NOTE: This would be done for whole page updates in a Web application.
1.24 @@ -45,6 +41,9 @@
1.25 self.populate_list(self.keyboard, self.get_elements("keyboard"))
1.26 self.populate_list(self.mouse, self.get_elements("mouse"))
1.27 self.populate_list(self.screen, self.get_elements("screen"))
1.28 + self.reset_collection(self.hard_disks)
1.29 + self.reset_collection(self.memory_units)
1.30 + self.reset_collection(self.storage_units)
1.31
1.32 # General functionality.
1.33
1.34 @@ -167,4 +166,22 @@
1.35 def exportConfig(self):
1.36 print "configuration.exportConfig(): Not implemented yet"
1.37
1.38 +def get_resource_class(resource_type):
1.39 +
1.40 + if resource_type == "PyQt":
1.41 + import XSLForms.PyQt
1.42 + import QtConfigurator.Forms
1.43 + class Configurator(ConfiguratorResource, QtConfigurator.Forms.Configurator, XSLForms.PyQt.XSLFormsResource):
1.44 + def __init__(self, *args, **kw):
1.45 + QtConfigurator.Forms.Configurator.__init__(self, *args, **kw)
1.46 + self.factory = XSLForms.PyQt.Factory(self.prepare_template("configuration"))
1.47 + ConfiguratorResource.__init__(self, *args, **kw)
1.48 + else:
1.49 + import XSLForms.Resources
1.50 + class Configurator(ConfiguratorResource, XSLForms.PyQtWeb.XSLFormsResource):
1.51 + def __init__(self, *args, **kw):
1.52 + ConfiguratorResource.__init__(self, *args, **kw)
1.53 +
1.54 + return Configurator
1.55 +
1.56 # vim: tabstop=4 expandtab shiftwidth=4