From 58b8c60758cea0249735d8208bd3cd55759722fb Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 12 Mar 2013 20:58:37 +0100 Subject: pywizards: make configset general Change-Id: Ia2d953166cac672fd9aa44e71d6486cb59df440e --- wizards/com/sun/star/wizards/agenda/CGAgenda.py | 3 ++- wizards/com/sun/star/wizards/common/ConfigSet.py | 26 +++++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'wizards/com') diff --git a/wizards/com/sun/star/wizards/agenda/CGAgenda.py b/wizards/com/sun/star/wizards/agenda/CGAgenda.py index 335f6edfb470..ee8435ba1c30 100644 --- a/wizards/com/sun/star/wizards/agenda/CGAgenda.py +++ b/wizards/com/sun/star/wizards/agenda/CGAgenda.py @@ -17,6 +17,7 @@ # from ..common.ConfigGroup import ConfigGroup from ..common.ConfigSet import ConfigSet +from .CGTopic import CGTopic class CGAgenda(ConfigGroup): @@ -42,4 +43,4 @@ class CGAgenda(ConfigGroup): self.cp_TemplatePath = str() self.cp_ProceedMethod = int() - self.cp_Topics = ConfigSet() + self.cp_Topics = ConfigSet(CGTopic) diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.py b/wizards/com/sun/star/wizards/common/ConfigSet.py index ee041dea6c5c..79ae0e378520 100644 --- a/wizards/com/sun/star/wizards/common/ConfigSet.py +++ b/wizards/com/sun/star/wizards/common/ConfigSet.py @@ -18,7 +18,6 @@ import traceback from .ConfigGroup import ConfigGroup from .Configuration import Configuration -from ..agenda.CGTopic import CGTopic class ConfigSet(ConfigGroup): ''' @@ -30,7 +29,8 @@ class ConfigSet(ConfigGroup): to avoid this "deletion" of nulls. ''' - def __init__(self): + def __init__(self, childType): + self.childType = childType self.childrenList = [] self.childrenListLen = 0 @@ -42,12 +42,13 @@ class ConfigSet(ConfigGroup): try: childView = configurationView.createInstance() configurationView.insertByName(index, childView) - topic = CGTopic() - topic.cp_Index = item[0].Value - topic.cp_Topic = item[1].Value - topic.cp_Responsible = item[2].Value - topic.cp_Time = item[3].Value - topic.writeConfiguration(childView, param) + if callable( self.childType ): + topic = self.childType() + topic.cp_Index = item[0].Value + topic.cp_Topic = item[1].Value + topic.cp_Responsible = item[2].Value + topic.cp_Time = item[3].Value + topic.writeConfiguration(childView, param) except Exception: traceback.print_exc() @@ -57,10 +58,11 @@ class ConfigSet(ConfigGroup): if names: for i in names: try: - topic = CGTopic() - topic.readConfiguration( - configurationView.getByName(i), param) - self.childrenList.append(topic) + if callable( self.childType ): + topic = self.childType() + topic.readConfiguration( + configurationView.getByName(i), param) + self.childrenList.append(topic) except Exception: traceback.print_exc() self.childrenListLen = len(self.childrenList) -- cgit