[Libreoffice-commits] core.git: wizards/com

Xisco Fauli anistenis at gmail.com
Tue Mar 12 13:05:35 PDT 2013


 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(-)

New commits:
commit 58b8c60758cea0249735d8208bd3cd55759722fb
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Tue Mar 12 20:58:37 2013 +0100

    pywizards: make configset general
    
    Change-Id: Ia2d953166cac672fd9aa44e71d6486cb59df440e

diff --git a/wizards/com/sun/star/wizards/agenda/CGAgenda.py b/wizards/com/sun/star/wizards/agenda/CGAgenda.py
index 335f6ed..ee8435b 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 ee041de..79ae0e3 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)


More information about the Libreoffice-commits mailing list