[Libreoffice-commits] .: Branch 'feature/gsoc2011_wizards' - wizards/com

Xisco Fauli xfauli at kemper.freedesktop.org
Sun Jul 24 09:46:49 PDT 2011


 wizards/com/sun/star/wizards/agenda/AgendaTemplate.java        |    5 
 wizards/com/sun/star/wizards/agenda/AgendaTemplate.py          |    9 -
 wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py      |   13 +
 wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py |    2 
 wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py  |   78 ++++++----
 wizards/com/sun/star/wizards/agenda/TopicsControl.py           |   66 ++++----
 wizards/com/sun/star/wizards/common/ConfigSet.java             |    2 
 wizards/com/sun/star/wizards/common/ConfigSet.py               |   66 +++-----
 wizards/com/sun/star/wizards/common/Configuration.py           |   15 +
 wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py        |    3 
 wizards/com/sun/star/wizards/text/TextFieldHandler.py          |    2 
 wizards/com/sun/star/wizards/text/TextSectionHandler.py        |    7 
 12 files changed, 137 insertions(+), 131 deletions(-)

New commits:
commit 14c8c4759b256e2fb369e88df38a25ccec5c2a1b
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Sun Jul 24 18:46:22 2011 +0200

    Fix Finish Button

diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
index 9293d03..526ae2c 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
@@ -661,6 +661,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
 
     private void writeTitle(TextElement te, XTextRange tr, String text)
     {
+        System.out.println("yeeep");
         te.text = (text == null ? PropertyNames.EMPTY_STRING : text);
         te.write(tr);
     }
@@ -1498,7 +1499,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
             int targetNumOfRows = topics * rowsPerTopic + 1;
             if (tableRows.getCount() > targetNumOfRows)
             {
-                tableRows.removeByIndex(targetNumOfRows, tableRows.getCount() - targetNumOfRows);
+                //tableRows.removeByIndex(targetNumOfRows, tableRows.getCount() - targetNumOfRows);
             }
             formatLastRow();
             while (writtenTopics.size() > topics)
@@ -1614,7 +1615,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
     public static void removeTableRows(Object table, int start, int count)
     {
         XTableRows rows = UnoRuntime.queryInterface(XTextTable.class, table).getRows();
-        rows.removeByIndex(start, count);
+        //rows.removeByIndex(start, count);
     }
 
     /**
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
index 99cdc59..24c49ca 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
@@ -389,8 +389,9 @@ class AgendaTemplate(TextDocument):
 
     @synchronized(lock)
     def finish(self, topics):
-        createMinutes(topics)
-        deleteHiddenSections()
+        #COMMENTED
+        #self.createMinutes(topics)
+        self.deleteHiddenSections()
         AgendaTemplate.textSectionHandler.removeAllTextSections()
 
     '''
@@ -403,7 +404,7 @@ class AgendaTemplate(TextDocument):
         allSections = AgendaTemplate.document.TextSections.ElementNames
         try:
             for i in allSections:
-                self.section = getSection(i)
+                self.section = self.getSection(i)
                 visible = bool(Helper.getUnoPropertyValue(self.section, "IsVisible"))
                 if not visible:
                     self.section.Anchor.String = ""
@@ -422,7 +423,7 @@ class AgendaTemplate(TextDocument):
     def createMinutes(self, topicsData):
         # if the minutes section should be removed (the
         # user did not check "create minutes")
-        if not AgendaTemplate.agenda.cp_IncludeMinutes or (topicsData.size() <= 1):
+        if not AgendaTemplate.agenda.cp_IncludeMinutes or topicsData.size() <= 1:
             try:
                 minutesAllSection = getSection(SECTION_MINUTES_ALL)
                 minutesAllSection.Anchor.String = ""
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py
index ec8a2b0..d71fade 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py
@@ -178,17 +178,20 @@ class AgendaWizardDialog(WizardDialog):
         self.insertLabel("lblTitle3", self.PROPS_LABEL_B,
             (self.fontDescriptor4, 16, self.resources.reslblTitle3_value,
                 True, 91, 8, 3, 300,212))
-        self.chkMeetingTitle = self.insertCheckBox("chkMeetingTitle", None,
-            self.PROPS_CHECK,
+        self.chkMeetingTitle = self.insertCheckBox("chkMeetingTitle",
+            CHKCHECKBOX_ITEM_CHANGED, self.PROPS_CHECK,
             (8, CHKMEETINGTITLE_HID, self.resources.reschkMeetingTitle_value,
                 97, 32, 1, 3, 301, 69), self)
-        self.chkRead = self.insertCheckBox("chkRead", None, self.PROPS_CHECK,
+        self.chkRead = self.insertCheckBox("chkRead",
+            CHKCHECKBOX_ITEM_CHANGED, self.PROPS_CHECK,
             (8, CHKREAD_HID, self.resources.reschkRead_value,
                 97, 46, 0, 3, 302, 162), self)
-        self.chkBring = self.insertCheckBox("chkBring", None, self.PROPS_CHECK,
+        self.chkBring = self.insertCheckBox("chkBring",
+            CHKCHECKBOX_ITEM_CHANGED, self.PROPS_CHECK,
             (8, CHKBRING_HID, self.resources.reschkBring_value,
                 97, 60, 0, 3, 303, 162), self)
-        self.chkNotes = self.insertCheckBox("chkNotes", None, self.PROPS_CHECK,
+        self.chkNotes = self.insertCheckBox("chkNotes",
+            CHKCHECKBOX_ITEM_CHANGED, self.PROPS_CHECK,
             (8, CHKNOTES_HID, self.resources.reschkNotes_value,
                 97, 74, 1, 3, 304, 160), self)
         self.insertImage("imgHelp3", self.PROPS_IMAGE, (0, 10,
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py
index dadd842..3c37362 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py
@@ -1,5 +1,7 @@
 from common.HelpIds import HelpIds
 
+CHKCHECKBOX_ITEM_CHANGED =         "checkBoxItemChanged"
+TXTTEXTFIELD_TEXT_CHANGED =        ""
 LISTPAGEDESIGN_ACTION_PERFORMED =  "pageDesignChanged"
 TXTTEMPLATENAME_TEXT_CHANGED =     "templateTitleChanged"
 BTNTEMPLATEPATH_ACTION_PERFORMED = "saveAs"
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
index a29ea3c..c43f475 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
@@ -8,6 +8,8 @@ from ui.PathSelection import *
 from ui.event.UnoDataAware import *
 from ui.event.RadioDataAware import *
 
+from com.sun.star.view.DocumentZoomType import OPTIMAL
+from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO
 from com.sun.star.awt.VclWindowPeerAttribute import OK
 from common.NoValidPathException import *
 
@@ -151,7 +153,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
         self.setControlProperty(
             "listPageDesign", "StringItemList", tuple(self.agendaTemplates[0]))
         self.checkSavePath()
-        #setFilename(agenda.cp_TemplatePath);
+
         UnoDataAware.attachListBox(
             self.agenda, "cp_AgendaType", self.listPageDesign, True).updateUI()
         UnoDataAware.attachCheckBox(
@@ -192,6 +194,13 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
             self.agenda, "cp_ProceedMethod",
                 (self.optCreateAgenda, self.optMakeChanges), True).updateUI()
 
+    def saveConfiguration(self):
+        self.topicsControl.saveTopics(self.agenda)
+        root = Configuration.getConfigurationRoot(
+            self.xMSF, "/org.openoffice.Office.Writer/Wizards/Agenda", True)
+        self.agenda.writeConfiguration(root, "cp_")
+        root.commitChanges()
+
     '''
     read the available agenda wizard templates.
     '''
@@ -231,6 +240,14 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
         title = Helper.getUnoPropertyValue(getModel(txtTemplateName), "Text")
         self.agendaTemplate.setTemplateTitle(title)
 
+    def checkBoxItemChanged(self):
+        try:
+            AgendaTemplate.xTextDocument.lockControllers()
+            AgendaTemplate.redraw(FILLIN_READ)
+            AgendaTemplate.xTextDocument.unlockControllers()
+        except Exception:
+            traceback.print_exc()
+
     '''
     convenience method.
     instead of creating a FileAccess object every time
@@ -302,11 +319,11 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
 
     def finishWizard(self):
         bSaveSuccess = False
-        # pesimistic :(
+        endWizard = True
         try:
-            fileAccess = FileAccess.FileAccess_unknown(xMSF)
+            fileAccess = FileAccess(self.xMSF)
             self.sPath = self.myPathSelection.getSelectedPath()
-            if self.sPath.equals(""):
+            if self.sPath == "":
                 self.myPathSelection.triggerPathPicker()
                 self.sPath = self.myPathSelection.getSelectedPath()
 
@@ -317,48 +334,46 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
             if not self.filenameChanged:
                 if fileAccess.exists(self.sPath, True):
                     answer = SystemDialog.showMessageBox(
-                        xMSF, xControl.Peer, "MessBox",
-                        VclWindowPeerAttribute.YES_NO + \
-                            VclWindowPeerAttribute.DEF_NO,
-                        resources.resFileExists)
-                    if (answer == 3):
-                    # user said: no, do not overwrite....
+                        self.xMSF, "MessBox", YES_NO + DEF_NO,
+                        self.resources.resFileExists,
+                        self.xUnoDialog.Peer)
+                    if answer == 3:
+                        # user said: no, do not overwrite
+                        endWizard = False
                         return False
 
             self.agendaTemplate.xTextDocument.lockControllers()
             xTextDocument = self.agendaTemplate.document
             bSaveSuccess = OfficeDocument.store(
-                xMSF, xTextDocument, self.sPath, "writer8_template", False)
+                self.xMSF, AgendaTemplate.xTextDocument, self.sPath,
+                "writer8_template")
         except Exception, e:
+            traceback.print_exc()
             SystemDialog.showMessageBox(
-                xMSF, xControl.Peer, "ErrBox", VclWindowPeerAttribute.OK,
-                resources.resErrSaveTemplate)
+                self.xMSF, "ErrBox", OK,
+                self.resources.resErrSaveTemplate, self.xUnoDialog.Peer)
 
         if bSaveSuccess:
             try:
-                self.topicsControl.saveTopics(self.agenda)
-                root = Configuration.getConfigurationRoot(
-                    xMSF, "/org.openoffice.Office.Writer/Wizards/Agenda", True)
-                self.agenda.writeConfiguration(root, "cp_")
-                Configuration.commit(root)
+                self.saveConfiguration()
 
-                self.agendaTemplate.finish(self.topicsControl.getTopicsData())
-                xStoreable = self.agendaTemplate.document
-                xStoreable.store()
+                self.agendaTemplate.finish(self.topicsControl.scrollfields)
 
-                self.agendaTemplate.xTextDocument.unlockControllers()
+                AgendaTemplate.xTextDocument.unlockControllers()
                 loadValues = range(2)
-                loadValues[0] = PropertyValue.PropertyValue()
+                loadValues[0] = uno.createUnoStruct( \
+                    'com.sun.star.beans.PropertyValue')
                 loadValues[0].Name = "AsTemplate"
                 if self.agenda.cp_ProceedMethod == 1:
-                    loadValues[0].Value = Boolean.TRUE
+                    loadValues[0].Value = True
                 else:
-                    loadValues[0].Value = Boolean.FALSE
+                    loadValues[0].Value = False
 
-                loadValues[1] = PropertyValue.PropertyValue()
+                loadValues[1] = uno.createUnoStruct( \
+                    'com.sun.star.beans.PropertyValue')
                 loadValues[1].Name = "InteractionHandler"
 
-                xIH = xMSF.createInstance(
+                xIH = self.xMSF.createInstance(
                     "com.sun.star.comp.uui.UUIInteractionHandler")
                 loadValues[1].Value = xIH
 
@@ -367,15 +382,16 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
                     self.sPath, "_default", loadValues)
                 myViewHandler = ViewHandler(self.xMSF, oDoc)
                 myViewHandler.setViewSetting("ZoomType", OPTIMAL)
-            except Exception, ex:
+            except Exception:
                 traceback.print_exc()
 
         else:
-            self.agendaTemplate.xTextDocument.unlockControllers()
+            AgendaTemplate.xTextDocument.unlockControllers()
             return False
 
-        self.xUnoDialog.endExecute()
-        self.running = False
+        if endWizard:
+            self.xUnoDialog.endExecute()
+            self.running = False
         return True
 
     def closeDocument(self):
diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.py b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
index 75c77e6..08b1fa4 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.py
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
@@ -6,6 +6,7 @@ from common.Properties import Properties
 import traceback
 import inspect
 from common.HelpIds import HelpIds
+from CGTopic import CGTopic
 
 '''
 @author rpiterman
@@ -152,12 +153,9 @@ class TopicsControl(ControlScroller):
     '''
 
     def saveTopics(self, agenda):
-        ControlScroller.ControlScroller_body()
         agenda.cp_Topics.clear()
-        i = 0
-        while i < len(scrollfields) - 1:
-            agenda.cp_Topics.add(i, CGTopic(scrollfields.get(i)))
-            i += 1
+        for i in xrange(len(ControlScroller.scrollfields) - 1):
+            agenda.cp_Topics.add(i, CGTopic(ControlScroller.scrollfields[i]))
 
     '''
     overrides the parent class method to also enable the
@@ -174,7 +172,7 @@ class TopicsControl(ControlScroller):
     '''
 
     def removeLastRow(self):
-        l = len(scrollfields)
+        l = len(ControlScroller.scrollfields)
         # if we should scroll up...
         if (l - TopicsControl.nscrollvalue) >= 1 \
                 and (l - TopicsControl.nscrollvalue) <= self.nblockincrement \
@@ -232,13 +230,13 @@ class TopicsControl(ControlScroller):
 
     def enableButtons(self):
         UnoDialog.setEnabled(
-            getAD().btnInsert, self.lastFocusRow < len(scrollfields) - 1)
+            getAD().btnInsert, self.lastFocusRow < len(ControlScroller.scrollfields) - 1)
         UnoDialog.setEnabled(
-            getAD().btnRemove, self.lastFocusRow < len(scrollfields) - 1)
+            getAD().btnRemove, self.lastFocusRow < len(ControlScroller.scrollfields) - 1)
         UnoDialog.setEnabled(
             getAD().btnUp, self.lastFocusRow > 0)
         UnoDialog.setEnabled(
-            getAD().btnDown, self.lastFocusRow < len(scrollfields) - 1)
+            getAD().btnDown, self.lastFocusRow < len(ControlScroller.scrollfields) - 1)
 
     '''
     Removes the current row.
@@ -249,9 +247,9 @@ class TopicsControl(ControlScroller):
     def removeRow(self):
         lockDoc()
         i = self.lastFocusRow
-        while i < len(scrollfields) - 1:
-            pv1 = scrollfields.get(i)
-            pv2 = scrollfields.get(i + 1)
+        while i < len(ControlScroller.scrollfields) - 1:
+            pv1 = ControlScroller.scrollfields.get(i)
+            pv2 = ControlScroller.scrollfields.get(i + 1)
             pv1[1].Value = pv2[1].Value
             pv1[2].Value = pv2[2].Value
             pv1[3].Value = pv2[3].Value
@@ -276,10 +274,10 @@ class TopicsControl(ControlScroller):
     def insertRow(self):
         lockDoc()
         insertRowAtEnd()
-        i = len(scrollfields) - 2
+        i = len(ControlScroller.scrollfields) - 2
         while i > self.lastFocusRow:
-            pv1 = scrollfields.get(i)
-            pv2 = scrollfields.get(i - 1)
+            pv1 = ControlScroller.scrollfields.get(i)
+            pv2 = ControlScroller.scrollfields.get(i - 1)
             pv1[1].Value = pv2[1].Value
             pv1[2].Value = pv2[2].Value
             pv1[3].Value = pv2[3].Value
@@ -290,7 +288,7 @@ class TopicsControl(ControlScroller):
             i -= 1
         # after rotating all the properties from this row on,
         # we clear the row, so it is practically a new one...
-        pv1 = scrollfields.get(self.lastFocusRow)
+        pv1 = ControlScroller.scrollfields.get(self.lastFocusRow)
         pv1[1].Value = ""
         pv1[2].Value = ""
         pv1[3].Value = ""
@@ -401,18 +399,18 @@ class TopicsControl(ControlScroller):
                     delete the last row...
                     '''
                     if (guiRow + TopicsControl.nscrollvalue) \
-                            == len(scrollfields) - 2:
+                            == len(ControlScroller.scrollfields) - 2:
                         removeLastRow()
                         '''now consequentially check the last two rows,
                         and remove the last one if they are both empty.
                         (actually I check always the "before last" row,
                         because the last one is always empty...
                         '''
-                        while len(scrollfields) > 1 \
-                                and isRowEmpty(len(scrollfields) - 2):
+                        while len(ControlScroller.scrollfields) > 1 \
+                                and isRowEmpty(len(ControlScroller.scrollfields) - 2):
                             removeLastRow()
                         cr = self.ControlGroupVector[
-                            scrollfields.size - TopicsControl.nscrollvalue - 1]
+                            ControlScroller.scrollfields.size - TopicsControl.nscrollvalue - 1]
                         # if a remove was performed, set focus
                         #to the last row with some data in it...
                         focus(getControl(cr, column))
@@ -423,7 +421,7 @@ class TopicsControl(ControlScroller):
                     # row contains data
                     # is this the last row?
                     if (guiRow + TopicsControl.nscrollvalue + 1) \
-                            == len(scrollfields):
+                            == len(ControlScroller.scrollfields):
                         insertRowAtEnd()
 
             except Exception, e:
@@ -436,8 +434,8 @@ class TopicsControl(ControlScroller):
     '''
 
     def getTopicData(self, topic):
-        if topic < len(scrollfields):
-            return scrollfields.get(topic)
+        if topic < len(ControlScroller.scrollfields):
+            return ControlScroller.scrollfields.get(topic)
         else:
             return None
 
@@ -452,7 +450,7 @@ class TopicsControl(ControlScroller):
         if event.KeyCode == Key.TAB and event.Modifiers == 0:
             # if there is another row...
             if (self.nblockincrement + TopicsControl.nscrollvalue) \
-                    < len(scrollfields):
+                    < len(ControlScroller.scrollfields):
                 setScrollValue(TopicsControl.nscrollvalue + 1)
                 #focus(firstTopic);
                 focus(getControl(self.ControlGroupVector[4], 1))
@@ -495,7 +493,7 @@ class TopicsControl(ControlScroller):
             control = self.lastFocusControl
         # only perform if this is not the last row.
         actuallRow = guiRow + TopicsControl.nscrollvalue
-        if actuallRow + 1 < len(scrollfields):
+        if actuallRow + 1 < len(ControlScroller.scrollfields):
             # get the current selection
             selection = getSelection(control)
             # the last row should scroll...
@@ -574,7 +572,7 @@ class TopicsControl(ControlScroller):
         # is this the last full row ?
         actuallRow = guiRow + TopicsControl.nscrollvalue
         #if this is the last row, exit
-        if actuallRow == len(scrollfields) - 1:
+        if actuallRow == len(ControlScroller.scrollfields) - 1:
             return
             # the first row should scroll...
 
@@ -596,8 +594,8 @@ class TopicsControl(ControlScroller):
     '''
 
     def switchRows(self, row1, row2):
-        o1 = scrollfields.get(row1 + TopicsControl.nscrollvalue)
-        o2 = scrollfields.get(row2 + TopicsControl.nscrollvalue)
+        o1 = ControlScroller.scrollfields.get(row1 + TopicsControl.nscrollvalue)
+        o2 = ControlScroller.scrollfields.get(row2 + TopicsControl.nscrollvalue)
         temp = None
         i = 1
         while i < o1.length:
@@ -612,8 +610,8 @@ class TopicsControl(ControlScroller):
         '''
         if we changed the last row, add another one...
         '''
-        if (row1 + TopicsControl.nscrollvalue + 1 == len(scrollfields)) \
-                or (row2 + TopicsControl.nscrollvalue + 1 == len(scrollfields)):
+        if (row1 + TopicsControl.nscrollvalue + 1 == len(ControlScroller.scrollfields)) \
+                or (row2 + TopicsControl.nscrollvalue + 1 == len(ControlScroller.scrollfields)):
             insertRowAtEnd()
             '''
             if we did not change the last row but
@@ -623,9 +621,9 @@ class TopicsControl(ControlScroller):
             '''
         elif (row1 + TopicsControl.nscrollvalue) + \
                 (row2 + TopicsControl.nscrollvalue) \
-                == (len(scrollfields) * 2 - 5):
-            if isRowEmpty(len(scrollfields) - 2) \
-                    and isRowEmpty(len(scrollfields) - 1):
+                == (len(ControlScroller.scrollfields) * 2 - 5):
+            if isRowEmpty(len(ControlScroller.scrollfields) - 2) \
+                    and isRowEmpty(len(ControlScroller.scrollfields) - 1):
                 removeLastRow()
                 reduceDocumentToTopics()
 
@@ -741,7 +739,7 @@ class TopicsControl(ControlScroller):
 
     def reduceDocumentToTopics(self):
         try:
-            ControlScroller.CurUnoDialog.agendaTemplate.topics.reduceDocumentTo(len(scrollfields) - 1)
+            ControlScroller.CurUnoDialog.agendaTemplate.topics.reduceDocumentTo(len(ControlScroller.scrollfields) - 1)
         except Exception, ex:
             traceback.print_exc()
 
diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.java b/wizards/com/sun/star/wizards/common/ConfigSet.java
index 84f589a..fc849f5 100644
--- a/wizards/com/sun/star/wizards/common/ConfigSet.java
+++ b/wizards/com/sun/star/wizards/common/ConfigSet.java
@@ -148,7 +148,7 @@ public class ConfigSet implements ConfigNode, XMLProvider, ListModel
     public void readConfiguration(Object configurationView, Object param)
     {
         String[] names = Configuration.getChildrenNames(configurationView);
-
+        System.out.println(names.length);
         if (ConfigNode.class.isAssignableFrom(childClass))
         {
 
diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.py b/wizards/com/sun/star/wizards/common/ConfigSet.py
index 8da07a6..4ce2059 100644
--- a/wizards/com/sun/star/wizards/common/ConfigSet.py
+++ b/wizards/com/sun/star/wizards/common/ConfigSet.py
@@ -1,5 +1,6 @@
 import traceback
 from ConfigNode import *
+from Configuration import Configuration
 
 class ConfigSet(ConfigNode):
     '''
@@ -22,7 +23,8 @@ class ConfigSet(ConfigNode):
         if isinstance(name, int):
             i = name
             self.childrenList.insert(i, o)
-            self.fireListDataListenerIntervalAdded(i, i)
+            #COMMENTED
+            #self.fireListDataListenerIntervalAdded(i, i)
         else:
             i = o.cp_Index
             oldSize = self.getSize()
@@ -39,26 +41,25 @@ class ConfigSet(ConfigNode):
             #self.fireListDataListenerIntervalAdded(oldSize, i)
 
     def writeConfiguration(self, configView, param):
-        names = self.childrenMap.keySet().toArray()
+        names = self.childrenMap.keys()
         if isinstance(self.childClass, ConfigNode):
             #first I remove all the children from the configuration.
-            children = Configuration.getChildrenNames(configView)
-            i = 0
-            while i < children.length:
-                try:
-                    Configuration.removeNode(configView, children[i])
-                except Exception, ex:
-                    ex.printStackTrace()
+            children = configView.ElementNames
+            if children:
+                for i in children:
+                    try:
+                        Configuration.removeNode(configView, i)
+                    except Exception:
+                        traceback.print_exc()
 
                 # and add them new.
-                i += 1
             for i in names:
                 try:
-                    child = getElement(i)
-                    childView = Configuration.addConfigNode(configView, i)
+                    child = self.getElement(i)
+                    childView = configView.getByName(i)
                     child.writeConfiguration(childView, param)
-                except Exception, ex:
-                    ex.printStackTrace()
+                except Exception:
+                    traceback.print_exc()
         else:
             raise AttributeError (
             "Unable to write primitive sets to configuration (not implemented)")
@@ -66,15 +67,16 @@ class ConfigSet(ConfigNode):
     def readConfiguration(self, configurationView, param):
         names = configurationView.ElementNames
         if isinstance(self.childClass, ConfigNode):
-            for i in names:
-                try:
-                    child = type(self.childClass)()
-                    child.setRoot(self.root)
-                    child.readConfiguration(
-                        configurationView.getByName(i), param)
-                    self.add(i, child)
-                except Exception, ex:
-                     traceback.print_exc()
+            if names:
+                for i in names:
+                    try:
+                        child = type(self.childClass)()
+                        child.setRoot(self.root)
+                        child.readConfiguration(
+                            configurationView.getByName(i), param)
+                        self.add(i, child)
+                    except Exception, ex:
+                         traceback.print_exc()
             #remove any nulls from the list
             if self.noNulls:
                 i = 0
@@ -148,24 +150,6 @@ class ConfigSet(ConfigNode):
     def setRoot(self, newRoot):
         self.root = newRoot
 
-    '''
-    Notifies all registered listeners about the event.
-    @param event The event to be fired
-    '''
-
-    def fireListDataListenerIntervalAdded(self, i0, i1):
-        event = ListDataEvent(self, ListDataEvent.INTERVAL_ADDED, i0, i1)
-        if self.listenerList == None:
-            return
-
-        listeners = self.listenerList.getListenerList()
-        i = listeners.length - 2
-        while i >= 0:
-            if listeners[i] == javax.swing.event.ListDataListener:
-                (listeners[i + 1]).intervalAdded(event)
-
-            i -= 2
-
     def getElementAt(self, i):
         return self.childrenList[i]
 
diff --git a/wizards/com/sun/star/wizards/common/Configuration.py b/wizards/com/sun/star/wizards/common/Configuration.py
index 0e3abe1..9f768e9 100644
--- a/wizards/com/sun/star/wizards/common/Configuration.py
+++ b/wizards/com/sun/star/wizards/common/Configuration.py
@@ -90,11 +90,18 @@ class Configuration(object):
             return None
 
     @classmethod
-    def removeNode(self, configView, name):
+    def removeNode(self, configView, name, xmsf=None):
+        commitChanges = False
+        if xmsf is not None:
+            configView = self.getConfigurationRoot(xmsf, path, True)
+            commit = True
 
         if configView.hasByName(name):
             configView.removeByName(name)
 
+        if commitChanges:
+            configView.commitChanges()
+
     @classmethod
     def updateConfiguration(self, xmsf, path, name, node, param):
         view = self.getConfigurationRoot(xmsf, path, True)
@@ -103,12 +110,6 @@ class Configuration(object):
         view.commitChanges()
 
     @classmethod
-    def removeNode(self, xmsf, path, name):
-        view = self.getConfigurationRoot(xmsf, path, True)
-        removeNode(view, name)
-        view.commitChanges()
-
-    @classmethod
     def getNodeDisplayNames(self, _xNameAccessNode):
         snames = None
         return getNodeChildNames(_xNameAccessNode,
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index c047589..a00ace4 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -149,7 +149,8 @@ class FaxWizardDialogImpl(FaxWizardDialog):
                 if fileAccess.exists(self.sPath, True):
                     answer = SystemDialog.showMessageBox(
                         self.xMSF, "MessBox", YES_NO + DEF_NO,
-                        self.resources.resOverwriteWarning, self.xUnoDialog.Peer)
+                        self.resources.resOverwriteWarning,
+                        self.xUnoDialog.Peer)
                     if answer == 3:
                         # user said: no, do not overwrite...
                         endWizard = False
diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.py b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
index 80e1abd..465a19e 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.py
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
@@ -81,7 +81,7 @@ class TextFieldHandler(object):
                     oTextField = xEnum.nextElement()
                     TextFieldHandler.arrayTextFields.append(oTextField)
                     xPropertySet = oTextField.TextFieldMaster
-                    if len(xPropertySet.Name) is not 0:
+                    if xPropertySet.Name:
                         TextFieldHandler.dictTextFields[xPropertySet.Name] = \
                             oTextField
         except Exception, e:
diff --git a/wizards/com/sun/star/wizards/text/TextSectionHandler.py b/wizards/com/sun/star/wizards/text/TextSectionHandler.py
index faca9ec..d9f1018 100644
--- a/wizards/com/sun/star/wizards/text/TextSectionHandler.py
+++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.py
@@ -56,12 +56,11 @@ class TextSectionHandler(object):
 
     def removeAllTextSections(self):
         try:
-            TextSectionCount = self.xTextDocument.TextSections.getCount()
-            i = TextSectionCount - 1
-            while i >= 0:
+            TextSectionCount = self.xTextDocument.TextSections.Count
+            xAllTextSections = self.xTextDocument.TextSections
+            for i in xrange(TextSectionCount - 1, -1, -1):
                 xTextContentTextSection = xAllTextSections.getByIndex(i)
                 self.xText.removeTextContent(xTextContentTextSection)
-                i -= 1
         except Exception, exception:
             traceback.print_exc()
 


More information about the Libreoffice-commits mailing list