[Libreoffice-commits] .: 8 commits - wizards/com

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Nov 26 14:41:06 PST 2012


 wizards/com/sun/star/wizards/agenda/AgendaTemplate.py              |  181 ++++------
 wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py          |    6 
 wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py     |    2 
 wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py      |    7 
 wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py |    2 
 wizards/com/sun/star/wizards/agenda/CGAgenda.py                    |    6 
 wizards/com/sun/star/wizards/agenda/CGTopic.py                     |    3 
 wizards/com/sun/star/wizards/agenda/TopicsControl.py               |  125 ++----
 wizards/com/sun/star/wizards/common/ConfigGroup.py                 |    4 
 wizards/com/sun/star/wizards/common/ConfigSet.py                   |    4 
 wizards/com/sun/star/wizards/common/Desktop.py                     |    2 
 wizards/com/sun/star/wizards/common/FileAccess.py                  |    6 
 wizards/com/sun/star/wizards/common/NoValidPathException.py        |    2 
 wizards/com/sun/star/wizards/common/Resource.py                    |    2 
 wizards/com/sun/star/wizards/document/OfficeDocument.py            |   10 
 wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py            |    3 
 wizards/com/sun/star/wizards/letter/LetterDocument.py              |    3 
 wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py      |   22 -
 wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py |    6 
 wizards/com/sun/star/wizards/text/TextDocument.py                  |    6 
 wizards/com/sun/star/wizards/text/TextFieldHandler.py              |   14 
 wizards/com/sun/star/wizards/ui/ControlScroller.py                 |   22 -
 wizards/com/sun/star/wizards/ui/WizardDialog.py                    |    9 
 wizards/com/sun/star/wizards/ui/event/CommonListener.py            |  104 ++---
 24 files changed, 242 insertions(+), 309 deletions(-)

New commits:
commit ea2bba59687f4d4dc5f729eb93149867e9fad3a1
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Nov 26 23:37:56 2012 +0100

    pywizards: don't set attribute when it's None
    
    Change-Id: Ic80b77f90635f58ab7e90da8b1c5e7d34a43d0f6

diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py
index 6b539b2..e4370a4 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py
@@ -15,7 +15,7 @@
 #   except in compliance with the License. You may obtain a copy of
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
-from wizards.common.HelpIds import HelpIds
+from ..common.HelpIds import HelpIds
 
 HID = 41051
 
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
index 30d5165..2dbcea7 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
@@ -73,6 +73,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
 
             # initialize the agenda template
             self.agenda = CGAgenda()
+            
             self.templateConsts = TemplateConsts
             self.agendaTemplate = AgendaTemplate(
                 self.xMSF, self.agenda, self.resources,
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
index ccff49d..a88b7f4 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
@@ -15,7 +15,7 @@
 #   except in compliance with the License. You may obtain a copy of
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
-from wizards.common.Resource import Resource
+from ..common.Resource import Resource
 
 class AgendaWizardDialogResources(Resource):
     
diff --git a/wizards/com/sun/star/wizards/agenda/CGAgenda.py b/wizards/com/sun/star/wizards/agenda/CGAgenda.py
index 571e70a..32d033e 100644
--- a/wizards/com/sun/star/wizards/agenda/CGAgenda.py
+++ b/wizards/com/sun/star/wizards/agenda/CGAgenda.py
@@ -15,9 +15,9 @@
 #   except in compliance with the License. You may obtain a copy of
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
-from .CGTopic import CGTopic
 from ..common.ConfigGroup import ConfigGroup
 from ..common.ConfigSet import ConfigSet
+from .CGTopic import CGTopic
 
 class CGAgenda(ConfigGroup):
     cp_AgendaType = int()
diff --git a/wizards/com/sun/star/wizards/agenda/CGTopic.py b/wizards/com/sun/star/wizards/agenda/CGTopic.py
index 8e60561..50ebc4d 100644
--- a/wizards/com/sun/star/wizards/agenda/CGTopic.py
+++ b/wizards/com/sun/star/wizards/agenda/CGTopic.py
@@ -15,7 +15,7 @@
 #   except in compliance with the License. You may obtain a copy of
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
-from wizards.common.ConfigGroup import *
+from ..common.ConfigGroup import ConfigGroup
 
 '''
 CGTopic means: Configuration Group Topic.
diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.py b/wizards/com/sun/star/wizards/common/ConfigGroup.py
index 44fc675..ae15e85 100644
--- a/wizards/com/sun/star/wizards/common/ConfigGroup.py
+++ b/wizards/com/sun/star/wizards/common/ConfigGroup.py
@@ -48,4 +48,6 @@ class ConfigGroup(ConfigNode):
             child.readConfiguration(configView.getByName(propertyName),
                 prefix)
         else:
-            setattr(self,field,configView.getByName(propertyName))
+            value = configView.getByName(propertyName)
+            if value is not None:
+                setattr(self,field, value)
commit 4024753450099e60f671e2c73c089a3b5e7e7648
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Nov 26 22:39:19 2012 +0100

    pyagenda: let's delete the locks and see what happens later on
    
    Change-Id: I6f878d454a264f2c5a9c450b09d690b0230fb89a

diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
index b6d0065..3dbcf63 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
@@ -17,7 +17,6 @@
 #
 import uno
 import traceback
-from threading import RLock
 from ..text.TextElement import TextElement
 from ..text.TextDocument import TextDocument
 from ..common.FileAccess import FileAccess
@@ -29,18 +28,6 @@ from datetime import date as dateTimeObject
 from com.sun.star.text.PlaceholderType import TEXT
 from com.sun.star.i18n.NumberFormatIndex import TIME_HHMM, DATE_SYSTEM_LONG
 
-def synchronized(lock):
-    ''' Synchronization decorator. '''
-    def wrap(f):
-        def newFunction(*args, **kw):
-            lock.acquire()
-            try:
-                return f(*args, **kw)
-            finally:
-                lock.release()
-        return newFunction
-    return wrap
-
 '''
 The classes here implement the whole document-functionality of the agenda wizard:
 the live-preview and the final "creation" of the document,
@@ -87,8 +74,6 @@ events fired too often.
 '''
 class AgendaTemplate(TextDocument):
 
-    lock = RLock()
-
     '''
     constructor. The document is *not* loaded here.
     only some formal members are set.
@@ -103,7 +88,6 @@ class AgendaTemplate(TextDocument):
         self.itemsMap = {}
         self.allItems = []
 
-    @synchronized(lock)
     def load(self, templateURL, topics):
         self.template = self.calcTemplateName(templateURL)
         self.loadAsPreview(templateURL, False)
@@ -148,7 +132,6 @@ class AgendaTemplate(TextDocument):
     The table is being found, in which the item is, and redrawn.
     '''
 
-    @synchronized(lock)
     def redraw(self, itemName):
         self.xTextDocument.lockControllers()
         try:
@@ -381,7 +364,6 @@ class AgendaTemplate(TextDocument):
     def getTable(self, name):
         return getattr(self.xTextDocument.TextTables, name)
 
-    @synchronized(lock)
     def redrawTitle(self, controlName):
         try:
             if controlName == "txtTitle":
@@ -435,7 +417,6 @@ class AgendaTemplate(TextDocument):
         return self.formatter.convertNumberToString(
             AgendaTemplate.timeFormat, t)
 
-    @synchronized(lock)
     def finish(self, topics):
         self.createMinutes(topics)
         self.deleteHiddenSections()
@@ -470,7 +451,6 @@ class AgendaTemplate(TextDocument):
     the values for the topics.
     '''
 
-    @synchronized(lock)
     def createMinutes(self, topicsData):
         # if the minutes section should be removed (the
         # user did not check "create minutes")
@@ -693,83 +673,82 @@ class ItemsTable(object):
     '''
 
     def write(self, dummy):
-        with AgendaTemplate.lock:
-            name = self.section.Name
-            # link and unlink the section to the template.
-            self.agenda.textSectionHandler.linkSectiontoTemplate(
-                self.agenda.template, name, self.section)
-            self.agenda.textSectionHandler.breakLinkOfTextSection(
-                self.section)
-            # we need to get a instance after linking.
-            ItemsTable.table = self.agenda.getTable(name)
-            self.section = self.agenda.getSection(name)
-            cursor = ItemsTable.table.createCursorByCellName("A1")
-            # should this section be visible?
-            visible = False
-            # write items
-            # ===========
-            cellName = ""
-            '''
-            now go through all items that belong to this
-            table. Check each one agains the model. If it should
-            be display, call it's write method.
-            All items are of type AgendaItem which means they write
-            two cells to the table: a title (text) and a placeholder.
-            see AgendaItem class below.
-            '''
-            for i in self.items:
-                if self.agenda.isShowItem(i.name):
-                    visible = True
-                    i.table = ItemsTable.table
-                    i.write(cursor)
-                    # I store the cell name which was last written...
-                    cellName = cursor.RangeName
-                    cursor.goRight(1, False)
-
-            if visible:
-                boolean = True
-            else:
-                boolean = False
-            Helper.setUnoPropertyValue(self.section, "IsVisible", boolean)
-            if not visible:
-                return
-                '''
-                remove obsolete rows
-                ====================
-                if the cell that was last written is the current cell,
-                it means this is the end of the table, so we end here.
-                (because after getting the cellName above,
-                I call the goRight method.
-                If it did not go right, it means its the last cell.
-                '''
-
-            if cellName == cursor.RangeName:
-                return
-                '''
-                if not, we continue and clear all cells until
-                we are at the end of the row.
-                '''
-
-            while not cellName == cursor.RangeName and \
-                    not cursor.RangeName.startswith("A"):
-                cell = ItemsTable.table.getCellByName(cursor.RangeName)
-                cell.String = ""
+        name = self.section.Name
+        # link and unlink the section to the template.
+        self.agenda.textSectionHandler.linkSectiontoTemplate(
+            self.agenda.template, name, self.section)
+        self.agenda.textSectionHandler.breakLinkOfTextSection(
+            self.section)
+        # we need to get a instance after linking.
+        ItemsTable.table = self.agenda.getTable(name)
+        self.section = self.agenda.getSection(name)
+        cursor = ItemsTable.table.createCursorByCellName("A1")
+        # should this section be visible?
+        visible = False
+        # write items
+        # ===========
+        cellName = ""
+        '''
+        now go through all items that belong to this
+        table. Check each one agains the model. If it should
+        be display, call it's write method.
+        All items are of type AgendaItem which means they write
+        two cells to the table: a title (text) and a placeholder.
+        see AgendaItem class below.
+        '''
+        for i in self.items:
+            if self.agenda.isShowItem(i.name):
+                visible = True
+                i.table = ItemsTable.table
+                i.write(cursor)
+                # I store the cell name which was last written...
                 cellName = cursor.RangeName
                 cursor.goRight(1, False)
 
+        if visible:
+            boolean = True
+        else:
+            boolean = False
+        Helper.setUnoPropertyValue(self.section, "IsVisible", boolean)
+        if not visible:
+            return
             '''
-            again: if we are at the end of the table, end here.
+            remove obsolete rows
+            ====================
+            if the cell that was last written is the current cell,
+            it means this is the end of the table, so we end here.
+            (because after getting the cellName above,
+            I call the goRight method.
+            If it did not go right, it means its the last cell.
             '''
-            if cellName == cursor.RangeName:
-                return
 
-            rowIndex = AgendaTemplate.getRowIndex(cursor)
-            rowsCount = AgendaTemplate.getRowCount(ItemsTable.table)
+        if cellName == cursor.RangeName:
+            return
             '''
-            now before deleteing i move the cursor up so it
-            does not disappear, because it will crash office.
+            if not, we continue and clear all cells until
+            we are at the end of the row.
             '''
-            cursor.gotoStart(False)
+
+        while not cellName == cursor.RangeName and \
+                not cursor.RangeName.startswith("A"):
+            cell = ItemsTable.table.getCellByName(cursor.RangeName)
+            cell.String = ""
+            cellName = cursor.RangeName
+            cursor.goRight(1, False)
+
+        '''
+        again: if we are at the end of the table, end here.
+        '''
+        if cellName == cursor.RangeName:
+            return
+
+        rowIndex = AgendaTemplate.getRowIndex(cursor)
+        rowsCount = AgendaTemplate.getRowCount(ItemsTable.table)
+        '''
+        now before deleteing i move the cursor up so it
+        does not disappear, because it will crash office.
+        '''
+        cursor.gotoStart(False)
 
 '''
 This class handles the preview of the topics table.
diff --git a/wizards/com/sun/star/wizards/agenda/CGTopic.py b/wizards/com/sun/star/wizards/agenda/CGTopic.py
index 88de171..8e60561 100644
--- a/wizards/com/sun/star/wizards/agenda/CGTopic.py
+++ b/wizards/com/sun/star/wizards/agenda/CGTopic.py
@@ -16,7 +16,6 @@
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
 from wizards.common.ConfigGroup import *
-from wizards.common.ConfigGroup import *
 
 '''
 CGTopic means: Configuration Group Topic.
diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.py b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
index 67b4ad3..e28fe6e 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.py
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
@@ -15,7 +15,6 @@
 #   except in compliance with the License. You may obtain a copy of
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
-from threading import RLock
 from .CGTopic import CGTopic
 from ..ui.ControlScroller import *
 from .AgendaWizardDialogConst import HID
@@ -82,21 +81,8 @@ This one is not synchronized "live", since it is unnecessary... instead, it is
 synchronized on call, before the settings should be saved.
 '''
 
-def synchronized(lock):
-    ''' Synchronization decorator. '''
-    def wrap(f):
-        def newFunction(*args, **kw):
-            lock.acquire()
-            try:
-                return f(*args, **kw)
-            finally:
-                lock.release()
-        return newFunction
-    return wrap
-
 class TopicsControl(ControlScroller):
 
-    lock = RLock()
     LABEL = "lblTopicCnt_"
     TOPIC = "txtTopicTopic_"
     RESP = "cbTopicResp_"
@@ -376,55 +362,54 @@ class TopicsControl(ControlScroller):
 
     @classmethod
     def fieldChanged(self, guiRow, column):
-        with TopicsControl.lock:
-            try:
-                # First, I update the document
-                data = self.getTopicData(guiRow + ControlScroller.nscrollvalue)
-                if data is None:
-                    return
-
-                dataValue = [i.Value for i in data]
-                if dataValue == TopicsControl.oldData:
-                    return
-                else:
-                    TopicsControl.oldData = dataValue
-
-                self.updateDocumentCell(
-                    guiRow + ControlScroller.nscrollvalue, column, data)
-                if self.isRowEmpty(guiRow + ControlScroller.nscrollvalue):
-                    '''
-                    if this is the row before the last one
-                    (the last row is always empty)
-                    delete the last row...
+        try:
+            # First, I update the document
+            data = self.getTopicData(guiRow + ControlScroller.nscrollvalue)
+            if data is None:
+                return
+
+            dataValue = [i.Value for i in data]
+            if dataValue == TopicsControl.oldData:
+                return
+            else:
+                TopicsControl.oldData = dataValue
+
+            self.updateDocumentCell(
+                guiRow + ControlScroller.nscrollvalue, column, data)
+            if self.isRowEmpty(guiRow + ControlScroller.nscrollvalue):
+                '''
+                if this is the row before the last one
+                (the last row is always empty)
+                delete the last row...
+                '''
+                if (guiRow + ControlScroller.nscrollvalue) \
+                        == len(ControlScroller.scrollfields) - 2:
+                    self.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...
                     '''
-                    if (guiRow + ControlScroller.nscrollvalue) \
-                            == len(ControlScroller.scrollfields) - 2:
-                        self.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(ControlScroller.scrollfields) > 1 \
-                                and self.isRowEmpty(len(ControlScroller.scrollfields) - 2):
-                            removeLastRow()
-                        cr = self.ControlGroupVector[
-                            ControlScroller.scrollfields.size - ControlScroller.nscrollvalue - 1]
-                        # if a remove was performed, set focus
-                        #to the last row with some data in it...
-                        self.focus(getControl(cr, column))
-                        # update the preview document.
-                        self.reduceDocumentToTopics()
+                    while len(ControlScroller.scrollfields) > 1 \
+                            and self.isRowEmpty(len(ControlScroller.scrollfields) - 2):
+                        removeLastRow()
+                    cr = self.ControlGroupVector[
+                        ControlScroller.scrollfields.size - ControlScroller.nscrollvalue - 1]
+                    # if a remove was performed, set focus
+                    #to the last row with some data in it...
+                    self.focus(getControl(cr, column))
+                    # update the preview document.
+                    self.reduceDocumentToTopics()
+
+            else:
+                # row contains data
+                # is this the last row?
+                if (guiRow + ControlScroller.nscrollvalue + 1) \
+                        == len(ControlScroller.scrollfields):
+                    self.insertRowAtEnd()
 
-                else:
-                    # row contains data
-                    # is this the last row?
-                    if (guiRow + ControlScroller.nscrollvalue + 1) \
-                            == len(ControlScroller.scrollfields):
-                        self.insertRowAtEnd()
-
-            except Exception:
-                traceback.print_exc()
+        except Exception:
+            traceback.print_exc()
 
     '''
     return the corresponding row data for the given index.
@@ -490,7 +475,6 @@ class TopicsControl(ControlScroller):
     @param control the control to gain focus after moving.
     '''
 
-    @synchronized(lock)
     def rowDown(self, guiRow=None, control=None):
         try:
             if guiRow is None and control is None:
@@ -523,7 +507,6 @@ class TopicsControl(ControlScroller):
     move the current row up
     '''
 
-    @synchronized(lock)
     def rowUp(self, guiRow=None, control=None):
         try:
             if guiRow is None and control is None:
@@ -554,7 +537,6 @@ class TopicsControl(ControlScroller):
     '''
 
     @classmethod
-    @synchronized(lock)
     def cursorUp(self, guiRow, control):
         # is this the last full row ?
         actuallRow = guiRow + ControlScroller.nscrollvalue
@@ -579,7 +561,6 @@ class TopicsControl(ControlScroller):
     '''
 
     @classmethod
-    @synchronized(lock)
     def cursorDown(self, guiRow, control):
         # is this the last full row ?
         actuallRow = guiRow + ControlScroller.nscrollvalue
commit 9ed87bd9a4011fab10c69739884e60e30731481f
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Nov 26 21:56:32 2012 +0100

    pyagenda: adapt exceptions to python3.3
    
    Change-Id: I87865aa01b1c05f46d39ab98279d3dc67df23c78

diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
index 5009e65..b6d0065 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py
@@ -134,7 +134,7 @@ class AgendaTemplate(TextDocument):
         for i in self.itemsTables:
             try:
                 i.write("")
-            except Exception, ex:
+            except Exception:
                 traceback.print_exc()
 
         self.redrawTitle("txtTitle")
@@ -156,7 +156,7 @@ class AgendaTemplate(TextDocument):
             itemsTable = self.itemsMap[itemName]
             # rewrite the table.
             itemsTable.write(None)
-        except Exception, e:
+        except Exception:
             traceback.print_exc()
         self.xTextDocument.unlockControllers()
 
@@ -364,7 +364,7 @@ class AgendaTemplate(TextDocument):
             try:
                 self.itemsTables.append(
                     ItemsTable(self.getSection(i), self.getTable(i), self))
-            except Exception, ex:
+            except Exception:
                 traceback.print_exc()
                 raise AttributeError (
                     "Fatal Error while initialilzing \
@@ -458,7 +458,7 @@ class AgendaTemplate(TextDocument):
                 if not visible:
                     self.section.Anchor.String = ""
 
-        except Exception, ex:
+        except Exception:
             traceback.print_exc()
 
     '''
@@ -480,7 +480,7 @@ class AgendaTemplate(TextDocument):
                 minutesAllSection = self.getSection(
                     self.templateConsts.SECTION_MINUTES_ALL)
                 minutesAllSection.Anchor.String = ""
-            except Exception, ex:
+            except Exception:
                 traceback.print_exc()
 
         # the user checked "create minutes"
@@ -541,7 +541,7 @@ class AgendaTemplate(TextDocument):
                             topicTime = 0
                             try:
                                 topicTime = topic[3].Value
-                            except Exception, ex:
+                            except Exception:
                                 pass
 
                             '''
@@ -565,7 +565,7 @@ class AgendaTemplate(TextDocument):
                             self.templateConsts.SECTION_MINUTES,
                             self.template, False)
 
-            except Exception, ex:
+            except Exception:
                 traceback.print_exc()
 
     '''given a text range and a text, fills the given
@@ -590,7 +590,7 @@ class AgendaTemplate(TextDocument):
                 try:
                     Range.Start.Text.insertTextContent(
                         Range.Start, placeHolder, True)
-                except Exception, ex:
+                except Exception:
                     traceback.print_exc()
 
     '''
@@ -602,7 +602,7 @@ class AgendaTemplate(TextDocument):
         try:
             placeHolder =  xmsf.createInstance(
                 "com.sun.star.text.TextField.JumpEdit")
-        except Exception, ex:
+        except Exception:
             traceback.print_exc()
             return None
 
@@ -819,7 +819,7 @@ class Topics(object):
         try:
             Topics.table = self.agenda.getTable(
                 self.agenda.templateConsts.SECTION_TOPICS)
-        except Exception, ex:
+        except Exception:
             traceback.print_exc()
             raise AttributeError (
                 "Fatal error while loading template: table " + \
@@ -1108,7 +1108,7 @@ class PlaceholderTextElement(TextElement):
                     self.xmsf, self.text, self.hint)
                 textRange.Text.insertTextContent(
                     textRange.Start, xTextContent, True)
-            except Exception, ex:
+            except Exception:
                 traceback.print_exc()
 
 '''
@@ -1130,7 +1130,7 @@ class PlaceholderElement(object):
                 self.textDocument, self.placeHolderText, self.hint)
             textRange.Text.insertTextContent(
                 textRange.Start, xTextContent, True)
-        except Exception, ex:
+        except Exception:
             traceback.print_exc()
 
 '''
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py
index c7c0d30..a84a28a 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py
@@ -15,10 +15,10 @@
 #   except in compliance with the License. You may obtain a copy of
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
-from wizards.ui.WizardDialog import WizardDialog, uno, Helper, UIConsts, \
+from ..ui.WizardDialog import WizardDialog, uno, Helper, UIConsts, \
     PropertyNames
-from AgendaWizardDialogConst import AgendaWizardDialogConst, HID
-from AgendaWizardDialogResources import AgendaWizardDialogResources
+from .AgendaWizardDialogConst import AgendaWizardDialogConst, HID
+from .AgendaWizardDialogResources import AgendaWizardDialogResources
 
 from com.sun.star.awt.FontUnderline import SINGLE
 
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
index 5fc5814..30d5165 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
@@ -115,7 +115,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
             self.removeTerminateListener()
             self.closeDocument()
             self.running = False
-        except Exception, ex:
+        except Exception:
             self.removeTerminateListener()
             traceback.print_exc()
             self.running = False
@@ -388,7 +388,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
             else:
                 pass
 
-        except Exception, e:
+        except Exception:
             traceback.print_exc()
         finally:
             if endWizard:
@@ -399,7 +399,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
     def closeDocument(self):
         try:
             xCloseable = self.agendaTemplate.xFrame.close(False)
-        except CloseVetoException, e:
+        except CloseVetoException:
             traceback.print_exc()
 
     def validatePath(self):
diff --git a/wizards/com/sun/star/wizards/agenda/CGAgenda.py b/wizards/com/sun/star/wizards/agenda/CGAgenda.py
index 07f1bda..571e70a 100644
--- a/wizards/com/sun/star/wizards/agenda/CGAgenda.py
+++ b/wizards/com/sun/star/wizards/agenda/CGAgenda.py
@@ -15,9 +15,9 @@
 #   except in compliance with the License. You may obtain a copy of
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
-from wizards.common.ConfigGroup import ConfigGroup
-from wizards.common.ConfigSet import ConfigSet
-from CGTopic import CGTopic
+from .CGTopic import CGTopic
+from ..common.ConfigGroup import ConfigGroup
+from ..common.ConfigSet import ConfigSet
 
 class CGAgenda(ConfigGroup):
     cp_AgendaType = int()
diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.py b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
index 9a18ec7..67b4ad3 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.py
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
@@ -140,7 +140,7 @@ class TopicsControl(ControlScroller):
 
     def initializeScrollFields(self, agenda):
         # create a row for each topic with the given values....
-        for i  in xrange(agenda.cp_Topics.getSize()):
+        for i  in range(agenda.cp_Topics.getSize()):
             row = self.newRow(i)
             agenda.cp_Topics.getElementAt(i).setDataToRow(row)
             # a parent class method
@@ -258,7 +258,7 @@ class TopicsControl(ControlScroller):
 
     def removeRow(self):
         try:
-            for i in xrange(TopicsControl.lastFocusRow,
+            for i in range(TopicsControl.lastFocusRow,
                     len(ControlScroller.scrollfields) - 1):
                 pv1 = ControlScroller.scrollfields[i]
                 pv2 = ControlScroller.scrollfields[i + 1]
@@ -288,7 +288,7 @@ class TopicsControl(ControlScroller):
     def insertRow(self):
         try:
             self.insertRowAtEnd()
-            for i in xrange(len(ControlScroller.scrollfields) - 2,
+            for i in range(len(ControlScroller.scrollfields) - 2,
                     TopicsControl.lastFocusRow, -1):
                 pv1 = ControlScroller.scrollfields[i]
                 pv2 = ControlScroller.scrollfields[i - 1]
@@ -609,7 +609,7 @@ class TopicsControl(ControlScroller):
         o1 = ControlScroller.scrollfields[row1 + ControlScroller.nscrollvalue]
         o2 = ControlScroller.scrollfields[row2 + ControlScroller.nscrollvalue]
         temp = None
-        for i in xrange(1, len(o1)):
+        for i in range(1, len(o1)):
             temp = o1[i].Value
             o1[i].Value = o2[i].Value
             o2[i].Value = temp
@@ -729,7 +729,7 @@ class TopicsControl(ControlScroller):
         try:
             ControlScroller.CurUnoDialog.agendaTemplate.topics.write(
                 row, data)
-        except Exception, ex:
+        except Exception:
             traceback.print_exc()
 
     '''
@@ -746,7 +746,7 @@ class TopicsControl(ControlScroller):
         try:
             ControlScroller.CurUnoDialog.agendaTemplate.topics.writeCell(
                 row, column, data)
-        except Exception, ex:
+        except Exception:
             traceback.print_exc()
 
     '''
@@ -759,7 +759,7 @@ class TopicsControl(ControlScroller):
         try:
             ControlScroller.CurUnoDialog.agendaTemplate.topics.reduceDocumentTo(
                 len(ControlScroller.scrollfields) - 1)
-        except Exception, ex:
+        except Exception:
             traceback.print_exc()
 
 '''
diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.py b/wizards/com/sun/star/wizards/common/ConfigSet.py
index 00b3331..e1a899b 100644
--- a/wizards/com/sun/star/wizards/common/ConfigSet.py
+++ b/wizards/com/sun/star/wizards/common/ConfigSet.py
@@ -91,7 +91,7 @@ class ConfigSet(ConfigNode):
                         child.readConfiguration(
                             configurationView.getByName(i), param)
                         self.add(i, child)
-                    except Exception, ex:
+                    except Exception:
                          traceback.print_exc()
             #remove any nulls from the list
             if self.noNulls:
@@ -107,7 +107,7 @@ class ConfigSet(ConfigNode):
                 try:
                     child = configurationView.getByName(i)
                     self.add(i, child)
-                except Exception, ex:
+                except Exception:
                     traceback.print_exc()
 
     def remove(self, obj):
diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.py b/wizards/com/sun/star/wizards/ui/ControlScroller.py
index c38a4ba..a17ee17 100644
--- a/wizards/com/sun/star/wizards/ui/ControlScroller.py
+++ b/wizards/com/sun/star/wizards/ui/ControlScroller.py
@@ -16,11 +16,11 @@
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
 import traceback
-from wizards.common.Desktop import Desktop
-from wizards.common.PropertyNames import PropertyNames
-from wizards.common.HelpIds import HelpIds
-from wizards.common.Helper import Helper
-from wizards.ui.UnoDialog import UnoDialog
+from .UnoDialog import UnoDialog
+from ..common.Desktop import Desktop
+from ..common.PropertyNames import PropertyNames
+from ..common.HelpIds import HelpIds
+from ..common.Helper import Helper
 
 from com.sun.star.awt.ScrollBarOrientation import HORIZONTAL, VERTICAL
 
@@ -84,7 +84,7 @@ class ControlScroller(object):
         ControlScroller.nscrollvalue = 0
         ControlScroller.ControlGroupVector = []
         ypos = self.iStartPosY + ControlScroller.SORELFIRSTPOSY
-        for i in xrange(ControlScroller.nblockincrement):
+        for i in range(ControlScroller.nblockincrement):
             self.insertControlGroup(i, ypos)
             ypos += self.linedistance
 
@@ -92,13 +92,9 @@ class ControlScroller(object):
         ControlScroller.CurUnoDialog.getPeerConfiguration().\
             setPeerProperties(self.oImgControl, "MouseTransparent", True)
 
-    def setScrollBarOrientationHorizontal(self):
-        Helper.setUnoPropertyValue(
-            ControlScroller.xScrollBar, "Orientation", HORIZONTAL)
-
     @classmethod
     def fillupControls(self, binitialize):
-        for i in xrange(ControlScroller.nblockincrement):
+        for i in range(ControlScroller.nblockincrement):
             if i < self.ncurfieldcount:
                 self.fillupControl(i)
 
@@ -241,6 +237,6 @@ class ControlScroller(object):
                 retproperties[i] = curproperties
                 i += 1
             return retproperties
-        except java.lang.Exception, ex:
-            ex.printStackTrace(System.out)
+        except Exception:
+            traceback.print_exc()
             return None
commit f835b7e321909dfaac925b1bfd7ccca35a59bd45
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Nov 26 21:34:43 2012 +0100

    pyletter: adapt this wizard to python3.3
    
    Change-Id: I6617478a335cf1b5b6b128f86148029dc7bd81af

diff --git a/wizards/com/sun/star/wizards/letter/LetterDocument.py b/wizards/com/sun/star/wizards/letter/LetterDocument.py
index ab29f7f..f8c1ced 100644
--- a/wizards/com/sun/star/wizards/letter/LetterDocument.py
+++ b/wizards/com/sun/star/wizards/letter/LetterDocument.py
@@ -32,6 +32,7 @@ from com.sun.star.text.TextContentAnchorType import AT_PAGE
 from com.sun.star.text.SizeType import FIX
 from com.sun.star.text.WrapTextMode import THROUGHT
 from com.sun.star.awt.FontWeight import BOLD
+from com.sun.star.beans import UnknownPropertyException
 
 class LetterDocument(TextDocument):
 
@@ -272,5 +273,7 @@ class BusinessPaperObject(object):
             try:
                 self.xTextDocument.Text.removeTextContent(
                     self.xFrame)
+            except UnknownPropertyException:
+                pass
             except Exception:
                 traceback.print_exc()
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index e8fe07a..c109b65 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -154,7 +154,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
             self.removeTerminateListener()
             self.closeDocument()
             self.running = False
-        except Exception, exception:
+        except Exception:
             self.removeTerminateListener()
             traceback.print_exc()
             self.running = False
@@ -218,7 +218,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
                 self.saveConfiguration()
                 xIH = self.xMSF.createInstance(
                     "com.sun.star.comp.uui.UUIInteractionHandler")
-                loadValues = range(4)
+                loadValues = list(range(4))
                 loadValues[0] = uno.createUnoStruct( \
                     'com.sun.star.beans.PropertyValue')
                 loadValues[0].Name = "AsTemplate"
@@ -247,7 +247,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
             else:
                 pass
 
-        except Exception, e:
+        except Exception:
             traceback.print_exc()
         finally:
             if endWizard:
@@ -260,7 +260,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
         try:
             xCloseable = self.myLetterDoc.xFrame
             xCloseable.close(False)
-        except CloseVetoException, e:
+        except CloseVetoException:
             traceback.print_exc()
 
     def optBusinessLetterItemChanged(self):
@@ -636,7 +636,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
                     and (self.chkUseLogo.State != 0)
                 self.myLetterDoc.switchElement(
                 "Company Logo", logostatus)
-        except IllegalArgumentException, e:
+        except IllegalArgumentException:
             traceback.print_exc()
 
     def chkUseAddressReceiverItemChanged(self):
@@ -650,7 +650,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
                 self.myLetterDoc.switchElement(
                     "Sender Address Repeated", rstatus)
 
-        except IllegalArgumentException, e:
+        except IllegalArgumentException:
             traceback.print_exc()
 
     def chkUseSignsItemChanged(self):
@@ -676,7 +676,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
             if self.chkFooterNextPages.State != 0:
                 self.myLetterDoc.switchFooter(
                     "First Page", False, self.chkFooterPageNumbers.State != 0,
-                    txtFooter.Text)
+                    self.txtFooter.Text)
                 self.myLetterDoc.switchFooter("Standard", bFooterPossible,
                     self.chkFooterPageNumbers.State != 0, self.txtFooter.Text)
             else:
@@ -691,7 +691,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
                 self.getRoadmapItemByID(LetterWizardDialogImpl.RM_FOOTER)
             Helper.setUnoPropertyValue(
                 BPaperItem, PropertyNames.PROPERTY_ENABLED, bFooterPossible)
-        except Exception, exception:
+        except Exception:
             traceback.print_exc()
 
     def chkFooterNextPagesItemChanged(self):
@@ -899,7 +899,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
                     self.xMSF, "Template", "share", "/wizard")
             self.sUserTemplatePath = \
                 FileAccess.getOfficePath2(self.xMSF, "Template", "user", "")
-        except NoValidPathException, e:
+        except NoValidPathException:
             traceback.print_exc()
 
     def initializeTemplates(self, xMSF):
@@ -1133,7 +1133,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
             UnoDataAware.attachEditControl(
                 cgl, "cp_TemplatePath", self.myPathSelection.xSaveTextBox,
                 True).updateUI()
-        except Exception, exception:
+        except Exception:
             traceback.print_exc()
 
     def saveConfiguration(self):
@@ -1142,7 +1142,7 @@ class LetterWizardDialogImpl(LetterWizardDialog):
                 "/org.openoffice.Office.Writer/Wizards/Letter", True)
             self.myConfig.writeConfiguration(root, "cp_")
             root.commitChanges()
-        except Exception, e:
+        except Exception:
             traceback.print_exc()
 
     def validatePath(self):
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
index 64b45f7..b884246 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
@@ -256,19 +256,19 @@ class LetterWizardDialogResources(Resource):
         self.loadGreetingResources()
 
     def loadRoadmapResources(self):       
-        for i in xrange(6):
+        for i in range(6):
             self.RoadmapLabels.append(self.getResText(
                 LetterWizardDialogResources.RID_LETTERWIZARDROADMAP_START + \
                 i + 1))
 
     def loadSalutationResources(self):
-        for i in xrange(3):
+        for i in range(3):
             self.SalutationLabels.append(self.getResText(
                 LetterWizardDialogResources.RID_LETTERWIZARDSALUTATION_START + \
                 i + 1))
 
     def loadGreetingResources(self):
-        for i in xrange(3):
+        for i in range(3):
             self.GreetingLabels.append(self.getResText(
                 LetterWizardDialogResources.RID_LETTERWIZARDGREETING_START + \
                 i + 1))
diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.py b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
index 22ebcae..5bb4c4a 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.py
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
@@ -21,6 +21,7 @@ from ..common.PropertyNames import PropertyNames
 
 from com.sun.star.util import DateTime
 from com.sun.star.uno import RuntimeException
+from com.sun.star.beans import UnknownPropertyException
 
 class TextFieldHandler(object):
 
@@ -102,7 +103,7 @@ class TextFieldHandler(object):
             xProperty = TextFieldHandler.dictTextFields[_aPropertyValue]
             try:
                 xPropertySet = xProperty.TextFieldMaster
-            except Exception:
+            except UnknownPropertyException:
                 return
             if xPropertySet.PropertySetInfo.hasPropertyByName(
                     _PropertyName):
commit 5b56643fd426f9e2369a2e78e62768567d65e589
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Nov 26 21:06:36 2012 +0100

    pyfax: make this wizard completely compatible with python3.3
    
    Change-Id: Ice2eaaa014ee4858658c5643b51b6f70faefa128

diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.py b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
index dfb4d0b..22ebcae 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.py
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
@@ -100,7 +100,10 @@ class TextFieldHandler(object):
             self, _PropertyName, _aPropertyValue):
         try:
             xProperty = TextFieldHandler.dictTextFields[_aPropertyValue]
-            xPropertySet = xProperty.TextFieldMaster
+            try:
+                xPropertySet = xProperty.TextFieldMaster
+            except Exception:
+                return
             if xPropertySet.PropertySetInfo.hasPropertyByName(
                     _PropertyName):
                 oValue = xPropertySet.getPropertyValue(_PropertyName)
@@ -115,7 +118,8 @@ class TextFieldHandler(object):
             DependentTextFields = self.__getTextFieldsByProperty(
                     PropertyNames.PROPERTY_NAME, _FieldName)
             if DependentTextFields is not None:
-                DependentTextFields.TextFieldMaster.setPropertyValue("Content", _FieldContent)
+                DependentTextFields.TextFieldMaster.setPropertyValue(
+                    "Content", _FieldContent)
                 self.refreshTextFields()
         except Exception:
             traceback.print_exc()
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py
index 370a4c3..7ccd2ce 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.py
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py
@@ -28,7 +28,6 @@ from ..document.OfficeDocument import OfficeDocument
 from ..text.TextDocument import TextDocument
 
 from com.sun.star.lang import NoSuchMethodException
-from com.sun.star.lang import IllegalArgumentException
 from com.sun.star.frame import TerminationVetoException
 from com.sun.star.awt.PushButtonType import HELP, STANDARD
 
@@ -77,7 +76,7 @@ class WizardDialog(UnoDialog2):
             if self.nNewStep != self.nOldStep:
                 self.switchToStep()
 
-        except IllegalArgumentException:
+        except Exception:
             traceback.print_exc()
 
     def setRoadmapInteractive(self, _bInteractive):
@@ -89,7 +88,7 @@ class WizardDialog(UnoDialog2):
     def isRoadmapComplete(self):
         try:
             return bool(Helper.getUnoPropertyValue(self.oRoadmap, "Complete"))
-        except IllegalArgumentException:
+        except Exception:
             traceback.print_exc()
             return False
 
diff --git a/wizards/com/sun/star/wizards/ui/event/CommonListener.py b/wizards/com/sun/star/wizards/ui/event/CommonListener.py
index 99b232d..4883a16 100644
--- a/wizards/com/sun/star/wizards/ui/event/CommonListener.py
+++ b/wizards/com/sun/star/wizards/ui/event/CommonListener.py
@@ -19,7 +19,7 @@ import unohelper
 
 from com.sun.star.awt import XActionListener
 class ActionListenerProcAdapter( unohelper.Base, XActionListener ):
-    def __init__( self, oProcToCall, tParams=() ):
+    def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
 
     def actionPerformed( self, oActionEvent ):
@@ -28,20 +28,19 @@ class ActionListenerProcAdapter( unohelper.Base, XActionListener ):
 
 from com.sun.star.awt import XItemListener
 class ItemListenerProcAdapter( unohelper.Base, XItemListener ):
-    def __init__( self, oProcToCall, tParams=() ):
+    def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
-        self.tParams = tParams
 
     def itemStateChanged( self, oItemEvent ):
         if callable( self.oProcToCall ):
             try:
                 self.oProcToCall()
             except:
-                self.oProcToCall((oItemEvent,) + self.tParams )
+                self.oProcToCall(oItemEvent)
 
 from com.sun.star.awt import XTextListener
 class TextListenerProcAdapter( unohelper.Base, XTextListener ):
-    def __init__( self, oProcToCall, tParams=() ):
+    def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
 
     def textChanged( self, oTextEvent ):
@@ -50,7 +49,7 @@ class TextListenerProcAdapter( unohelper.Base, XTextListener ):
 
 from com.sun.star.frame import XTerminateListener
 class TerminateListenerProcAdapter( unohelper.Base, XTerminateListener ):
-    def __init__( self, oProcToCall, tParams=() ):
+    def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
 
     def queryTermination(self, TerminateEvent):
@@ -61,7 +60,7 @@ class TerminateListenerProcAdapter( unohelper.Base, XTerminateListener ):
 
 from com.sun.star.awt import XWindowListener
 class WindowListenerProcAdapter( unohelper.Base, XWindowListener ):
-    def __init__( self, oProcToCall, tParams=() ):
+    def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
 
     def windowShown(self, TerminateEvent):
@@ -70,7 +69,7 @@ class WindowListenerProcAdapter( unohelper.Base, XWindowListener ):
 
 from com.sun.star.awt import XAdjustmentListener
 class AdjustmentListenerProcAdapter( unohelper.Base, XAdjustmentListener ):
-    def __init__( self, oProcToCall, tParams=() ):
+    def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
 
     def adjustmentValueChanged(self, TerminateEvent):
@@ -79,20 +78,18 @@ class AdjustmentListenerProcAdapter( unohelper.Base, XAdjustmentListener ):
 
 from com.sun.star.awt import XFocusListener
 class FocusListenerProcAdapter( unohelper.Base, XFocusListener ):
-    def __init__( self, oProcToCall, tParams=() ):
+    def __init__( self, oProcToCall):
         self.oProcToCall = oProcToCall
-        self.tParams = tParams
 
     def focusGained(self, FocusEvent):
         if callable( self.oProcToCall ):
-            self.oProcToCall((FocusEvent,) + self.tParams )
+            self.oProcToCall(FocusEvent)
 
 from com.sun.star.awt import XKeyListener
 class KeyListenerProcAdapter( unohelper.Base, XKeyListener ):
-    def __init__( self, oProcToCall, tParams=() ):
+    def __init__(self, oProcToCall):
         self.oProcToCall = oProcToCall
-        self.tParams = tParams
 
     def keyPressed(self, KeyEvent):
         if callable( self.oProcToCall ):
-            self.oProcToCall((KeyEvent,) + self.tParams )
+            self.oProcToCall(KeyEvent)
commit c279c575950b08e45f5f1d9c7935716a76d67139
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Nov 26 20:26:29 2012 +0100

    pywizards: No need to use unicodedata here
    
    Change-Id: I30eb17dd740978e2ce03ada0ec11a4db65205f41

diff --git a/wizards/com/sun/star/wizards/common/Desktop.py b/wizards/com/sun/star/wizards/common/Desktop.py
index 49880ac..6dfe1ee 100644
--- a/wizards/com/sun/star/wizards/common/Desktop.py
+++ b/wizards/com/sun/star/wizards/common/Desktop.py
@@ -51,7 +51,7 @@ class Desktop(object):
     @classmethod
     def getDispatcher(self, xMSF, xFrame, _stargetframe, oURL):
         try:
-            oURLArray = range(1)
+            oURLArray = list(range(1))
             oURLArray[0] = oURL
             xDispatch = xFrame.queryDispatch(oURLArray[0], _stargetframe, ALL)
             return xDispatch
diff --git a/wizards/com/sun/star/wizards/common/Resource.py b/wizards/com/sun/star/wizards/common/Resource.py
index 52eb40f..450565e 100644
--- a/wizards/com/sun/star/wizards/common/Resource.py
+++ b/wizards/com/sun/star/wizards/common/Resource.py
@@ -50,7 +50,7 @@ class Resource(object):
 
     def getResArray(self, nID, iCount):
         try:
-            ResArray = range(iCount)
+            ResArray = list(range(iCount))
             i = 0
             while i < iCount:
                 ResArray[i] = getResText(nID + i)
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.py b/wizards/com/sun/star/wizards/text/TextDocument.py
index 41d7fbf..da9761d 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.py
+++ b/wizards/com/sun/star/wizards/text/TextDocument.py
@@ -86,7 +86,7 @@ class TextDocument(object):
                     _moduleIdentifier.Identifier)
                 # load the document into a blank frame
                 xDesktop = Desktop.getDesktop(xMSF)
-                loadArgs = range(1)
+                loadArgs = list(range(1))
                 loadArgs[0] = "Model"
                 loadArgs[0] = -1
                 loadArgs[0] = self.xTextDocument
@@ -244,7 +244,7 @@ class TextDocument(object):
         
         auxList = []
         allItems = self.xTextDocument.findAll(sd)
-        for i in range(allItems.Count):
+        for i in list(range(allItems.Count)):
             auxList.append(allItems.getByIndex(i))
             
         return auxList
diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.py b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
index f6f251e..dfb4d0b 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.py
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
@@ -17,7 +17,6 @@
 #
 import traceback
 import time
-import unicodedata
 from ..common.PropertyNames import PropertyNames
 
 from com.sun.star.util import DateTime
@@ -105,9 +104,7 @@ class TextFieldHandler(object):
             if xPropertySet.PropertySetInfo.hasPropertyByName(
                     _PropertyName):
                 oValue = xPropertySet.getPropertyValue(_PropertyName)
-                sValue = unicodedata.normalize(
-                    'NFKD', oValue).encode('ascii','ignore')
-                if sValue == _aPropertyValue:
+                if oValue == _aPropertyValue:
                     return xProperty
             return None
         except KeyError:
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py
index c5f000c..370a4c3 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.py
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py
@@ -161,7 +161,7 @@ class WizardDialog(UnoDialog2):
     def getRoadmapItemByID(self, _ID):
         try:
             getByIndex = self.oRoadmap.getByIndex
-            for i in range(self.oRoadmap.Count):
+            for i in list(range(self.oRoadmap.Count)):
                 CurRoadmapItem = getByIndex(i)
                 CurID = int(Helper.getUnoPropertyValue(CurRoadmapItem, "ID"))
                 if CurID == _ID:
@@ -339,7 +339,7 @@ class WizardDialog(UnoDialog2):
 
     def enablefromStep(self, _iStep, _bDoEnable):
         if _iStep <= self.nMaxStep:
-            for i in range(_iStep, self.nMaxStep):
+            for i in list(range(_iStep, self.nMaxStep)):
                 self.setStepEnabled(i, _bDoEnable)
             enableFinishButton(_bDoEnable)
             if not _bDoEnable:
commit 944a7aa48aefdcafddcc75a5bfff68eeb6d4e343
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Nov 26 19:34:23 2012 +0100

    pywizards: adapt listener to python3.3
    
    Change-Id: I887ad72ce6ee4001ea2ac8731ffadaf196c0b5d7

diff --git a/wizards/com/sun/star/wizards/ui/event/CommonListener.py b/wizards/com/sun/star/wizards/ui/event/CommonListener.py
index f8f2a9b..99b232d 100644
--- a/wizards/com/sun/star/wizards/ui/event/CommonListener.py
+++ b/wizards/com/sun/star/wizards/ui/event/CommonListener.py
@@ -1,121 +1,98 @@
-#**********************************************************************
 #
-#   Danny.OOo.Listeners.ListenerProcAdapters.py
+# This file is part of the LibreOffice project.
 #
-#   A module to easily work with OpenOffice.org.
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
-#**********************************************************************
-#   Copyright (c) 2003-2004 Danny Brewer
-#   d29583 at groovegarden.com
+# This file incorporates work covered by the following license notice:
 #
-#   This library is free software; you can redistribute it and/or
-#   modify it under the terms of the GNU Lesser General Public
-#   License as published by the Free Software Foundation; either
-#   version 2.1 of the License, or (at your option) any later version.
-#
-#   This library is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#   Lesser General Public License for more details.
-#
-#   You should have received a copy of the GNU Lesser General Public
-#   License along with this library; if not, write to the Free Software
-#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#
-#   See:  http://www.gnu.org/licenses/lgpl.html
-#
-#**********************************************************************
-#   If you make changes, please append to the change log below.
-#
-#   Change Log
-#   Danny Brewer         Revised 2004-06-05-01
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements. See the NOTICE file distributed
+#   with this work for additional information regarding copyright
+#   ownership. The ASF licenses this file to you under the Apache
+#   License, Version 2.0 (the "License"); you may not use this file
+#   except in compliance with the License. You may obtain a copy of
+#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
 import unohelper
-from com.sun.star.awt import XActionListener
 
+from com.sun.star.awt import XActionListener
 class ActionListenerProcAdapter( unohelper.Base, XActionListener ):
     def __init__( self, oProcToCall, tParams=() ):
-        self.oProcToCall = oProcToCall # a python procedure
-        self.tParams = tParams # a tuple
+        self.oProcToCall = oProcToCall
 
-
-    # oActionEvent is a com.sun.star.awt.ActionEvent struct.
     def actionPerformed( self, oActionEvent ):
         if callable( self.oProcToCall ):
-            apply( self.oProcToCall )
+            self.oProcToCall()
 
 from com.sun.star.awt import XItemListener
 class ItemListenerProcAdapter( unohelper.Base, XItemListener ):
     def __init__( self, oProcToCall, tParams=() ):
-        self.oProcToCall = oProcToCall # a python procedure
-        self.tParams = tParams # a tuple
+        self.oProcToCall = oProcToCall
+        self.tParams = tParams
 
-    # oItemEvent is a com.sun.star.awt.ItemEvent struct.
     def itemStateChanged( self, oItemEvent ):
         if callable( self.oProcToCall ):
             try:
-                apply( self.oProcToCall)
+                self.oProcToCall()
             except:
-                apply( self.oProcToCall, (oItemEvent,) + self.tParams )
+                self.oProcToCall((oItemEvent,) + self.tParams )
 
 from com.sun.star.awt import XTextListener
 class TextListenerProcAdapter( unohelper.Base, XTextListener ):
     def __init__( self, oProcToCall, tParams=() ):
-        self.oProcToCall = oProcToCall # a python procedure
-        self.tParams = tParams # a tuple
+        self.oProcToCall = oProcToCall
 
-    # oTextEvent is a com.sun.star.awt.TextEvent struct.
     def textChanged( self, oTextEvent ):
         if callable( self.oProcToCall ):
-            apply( self.oProcToCall )
+            self.oProcToCall()
 
 from com.sun.star.frame import XTerminateListener
 class TerminateListenerProcAdapter( unohelper.Base, XTerminateListener ):
     def __init__( self, oProcToCall, tParams=() ):
-        self.oProcToCall = oProcToCall # a python procedure
-        self.tParams = tParams # a tuple
+        self.oProcToCall = oProcToCall
 
     def queryTermination(self, TerminateEvent):
         self.oProcToCall = getattr(self.oProcToCall,"queryTermination")
+
         if callable( self.oProcToCall ):
-            apply( self.oProcToCall )
+            self.oProcToCall()
 
 from com.sun.star.awt import XWindowListener
 class WindowListenerProcAdapter( unohelper.Base, XWindowListener ):
     def __init__( self, oProcToCall, tParams=() ):
-        self.oProcToCall = oProcToCall # a python procedure
-        self.tParams = tParams # a tuple
+        self.oProcToCall = oProcToCall
 
     def windowShown(self, TerminateEvent):
         if callable( self.oProcToCall ):
-            apply( self.oProcToCall )
+            self.oProcToCall()
 
 from com.sun.star.awt import XAdjustmentListener
 class AdjustmentListenerProcAdapter( unohelper.Base, XAdjustmentListener ):
     def __init__( self, oProcToCall, tParams=() ):
-        self.oProcToCall = oProcToCall # a python procedure
-        self.tParams = tParams # a tuple
+        self.oProcToCall = oProcToCall
 
     def adjustmentValueChanged(self, TerminateEvent):
         if callable( self.oProcToCall ):
-            apply( self.oProcToCall )
+            self.oProcToCall()
 
 from com.sun.star.awt import XFocusListener
 class FocusListenerProcAdapter( unohelper.Base, XFocusListener ):
     def __init__( self, oProcToCall, tParams=() ):
-        self.oProcToCall = oProcToCall # a python procedure
-        self.tParams = tParams # a tuple
+        self.oProcToCall = oProcToCall
+        self.tParams = tParams
 
     def focusGained(self, FocusEvent):
         if callable( self.oProcToCall ):
-            apply( self.oProcToCall, (FocusEvent,) + self.tParams )
+            self.oProcToCall((FocusEvent,) + self.tParams )
 
 from com.sun.star.awt import XKeyListener
 class KeyListenerProcAdapter( unohelper.Base, XKeyListener ):
     def __init__( self, oProcToCall, tParams=() ):
-        self.oProcToCall = oProcToCall # a python procedure
-        self.tParams = tParams # a tuple
+        self.oProcToCall = oProcToCall
+        self.tParams = tParams
 
     def keyPressed(self, KeyEvent):
         if callable( self.oProcToCall ):
-            apply( self.oProcToCall, (KeyEvent,) + self.tParams )
+            self.oProcToCall((KeyEvent,) + self.tParams )
commit d03f2be8e1b01e2c5504fac837240ea473a03c98
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Nov 26 02:23:06 2012 +0100

    pyfax: adapt it to python3.3. it can be already launched
    
    Change-Id: Id0c98e95d6b40dabe0dc07af232bda84989d1815

diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py
index 1a578c3..ae31c28 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.py
+++ b/wizards/com/sun/star/wizards/common/FileAccess.py
@@ -16,7 +16,6 @@
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
 import traceback
-import types
 from os import path as osPath
 from .NoValidPathException import NoValidPathException
 
@@ -101,9 +100,9 @@ class FileAccess(object):
                 sPath + "_internal")
             Template_user = xPathInterface.getPropertyValue(
                 sPath + "_user")
-            if type(Template_internal) is not types.InstanceType:
+            if not hasattr(Template_internal, '__dict__'):
                 ReadPaths = ReadPaths + Template_internal
-            if type(Template_user) is not types.InstanceType:
+            if not hasattr(Template_user, '__dict__'):
                 ReadPaths = ReadPaths + Template_user
             ReadPaths = ReadPaths + (Template_writable,)
             if sType.lower() == "user":
@@ -125,7 +124,6 @@ class FileAccess(object):
 
         if not bexists:
             raise NoValidPathException (xMSF, "");
-
         return ResultPath
 
     @classmethod
diff --git a/wizards/com/sun/star/wizards/common/NoValidPathException.py b/wizards/com/sun/star/wizards/common/NoValidPathException.py
index 73faf8e..861e273 100644
--- a/wizards/com/sun/star/wizards/common/NoValidPathException.py
+++ b/wizards/com/sun/star/wizards/common/NoValidPathException.py
@@ -20,7 +20,7 @@ class NoValidPathException(Exception):
     def __init__(self, xMSF, _sText):
         super(NoValidPathException,self).__init__(_sText)
         # TODO: NEVER open a dialog in an exception
-        from SystemDialog import SystemDialog
+        from .SystemDialog import SystemDialog
         if xMSF:
             SystemDialog.showErrorBox(xMSF,
                 "dbwizres", "dbw", 521) #OfficePathnotavailable
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.py b/wizards/com/sun/star/wizards/document/OfficeDocument.py
index bd138ca..69391bb 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.py
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.py
@@ -46,7 +46,7 @@ class OfficeDocument(object):
     @classmethod
     def attachEventCall(self, xComponent, EventName, EventType, EventURL):
         try:
-            oEventProperties = range(2)
+            oEventProperties = list(range(2))
             oEventProperties[0] = uno.createUnoStruct(
                 'com.sun.star.beans.PropertyValue')
             oEventProperties[0].Name = "EventType"
@@ -85,7 +85,7 @@ class OfficeDocument(object):
 
     @classmethod
     def createNewDocument(self, frame, sDocumentType, preview, readonly):
-        loadValues = range(2)
+        loadValues = list(range(2))
         loadValues[0] = uno.createUnoStruct(
             'com.sun.star.beans.PropertyValue')
         loadValues[0].Name = "ReadOnly"
@@ -194,7 +194,7 @@ class OfficeDocument(object):
     def store(self, xMSF, xComponent, StorePath, FilterName):
         try:
             if len(FilterName):
-                oStoreProperties = range(2)
+                oStoreProperties = list(range(2))
                 oStoreProperties[0] = uno.createUnoStruct(
                     'com.sun.star.beans.PropertyValue')
                 oStoreProperties[0].Name = "FilterName"
@@ -205,7 +205,7 @@ class OfficeDocument(object):
                 oStoreProperties[1].Value = xMSF.createInstance(
                     "com.sun.star.comp.uui.UUIInteractionHandler")
             else:
-                oStoreProperties = range(0)
+                oStoreProperties = list(range(0))
 
             if StorePath.startswith("file://"):
                 #Unix
@@ -260,7 +260,7 @@ class OfficeDocument(object):
     def getFileMediaDecriptor(self, xmsf, url):
         typeDetect = xmsf.createInstance(
             "com.sun.star.document.TypeDetection")
-        mediaDescr = range(1)
+        mediaDescr = list(range(1))
         mediaDescr[0] = uno.createUnoStruct(
             'com.sun.star.beans.PropertyValue')
         mediaDescr[0].Name = "URL"
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index d93100d..4f7352c 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -151,7 +151,6 @@ class FaxWizardDialogImpl(FaxWizardDialog):
         try:
             fileAccess = FileAccess(self.xMSF)
             self.sPath = self.myPathSelection.getSelectedPath()
-            print os.path.exists(self.sPath)
             if not self.sPath or not os.path.exists(self.sPath):
                 self.myPathSelection.triggerPathPicker()
                 self.sPath = self.myPathSelection.getSelectedPath()
@@ -184,7 +183,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
                 self.saveConfiguration()
                 xIH = self.xMSF.createInstance( \
                     "com.sun.star.comp.uui.UUIInteractionHandler")
-                loadValues = range(4)
+                loadValues = list(range(4))
                 loadValues[0] = uno.createUnoStruct( \
                     'com.sun.star.beans.PropertyValue')
                 loadValues[0].Name = "AsTemplate"
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.py b/wizards/com/sun/star/wizards/text/TextDocument.py
index 7190bc0..41d7fbf 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.py
+++ b/wizards/com/sun/star/wizards/text/TextDocument.py
@@ -120,7 +120,7 @@ class TextDocument(object):
         self.xProgressBar.setValue(5)
 
     def loadAsPreview(self, sDefaultTemplate, asTemplate):
-        loadValues = range(3)
+        loadValues = list(range(3))
         #      open document in the Preview mode
         loadValues[0] = uno.createUnoStruct(
             'com.sun.star.beans.PropertyValue')
@@ -244,7 +244,7 @@ class TextDocument(object):
         
         auxList = []
         allItems = self.xTextDocument.findAll(sd)
-        for i in xrange(allItems.Count):
+        for i in range(allItems.Count):
             auxList.append(allItems.getByIndex(i))
             
         return auxList
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py
index e23315f..c5f000c 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.py
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py
@@ -161,7 +161,7 @@ class WizardDialog(UnoDialog2):
     def getRoadmapItemByID(self, _ID):
         try:
             getByIndex = self.oRoadmap.getByIndex
-            for i in xrange(self.oRoadmap.Count):
+            for i in range(self.oRoadmap.Count):
                 CurRoadmapItem = getByIndex(i)
                 CurID = int(Helper.getUnoPropertyValue(CurRoadmapItem, "ID"))
                 if CurID == _ID:
@@ -339,7 +339,7 @@ class WizardDialog(UnoDialog2):
 
     def enablefromStep(self, _iStep, _bDoEnable):
         if _iStep <= self.nMaxStep:
-            for i in xrange(_iStep, self.nMaxStep):
+            for i in range(_iStep, self.nMaxStep):
                 self.setStepEnabled(i, _bDoEnable)
             enableFinishButton(_bDoEnable)
             if not _bDoEnable:


More information about the Libreoffice-commits mailing list