From 9ed87bd9a4011fab10c69739884e60e30731481f Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 26 Nov 2012 21:56:32 +0100 Subject: pyagenda: adapt exceptions to python3.3 Change-Id: I87865aa01b1c05f46d39ab98279d3dc67df23c78 --- .../com/sun/star/wizards/agenda/AgendaTemplate.py | 24 +++++++++++----------- .../sun/star/wizards/agenda/AgendaWizardDialog.py | 6 +++--- .../star/wizards/agenda/AgendaWizardDialogImpl.py | 6 +++--- wizards/com/sun/star/wizards/agenda/CGAgenda.py | 6 +++--- .../com/sun/star/wizards/agenda/TopicsControl.py | 14 ++++++------- wizards/com/sun/star/wizards/common/ConfigSet.py | 4 ++-- wizards/com/sun/star/wizards/ui/ControlScroller.py | 22 ++++++++------------ 7 files changed, 39 insertions(+), 43 deletions(-) (limited to 'wizards') diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py index 5009e6513796..b6d00651df34 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 c7c0d30e6e01..a84a28a92f1c 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 5fc58146b0d5..30d516555e89 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 07f1bdacf243..571e70a08a57 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 9a18ec710821..67b4ad34a60b 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 00b333168cad..e1a899b3aae0 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 c38a4ba86fbc..a17ee172b7fe 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 -- cgit v1.2.3