diff options
author | Xisco Fauli <anistenis@gmail.com> | 2011-06-20 14:20:37 +0200 |
---|---|---|
committer | Xisco Fauli <anistenis@gmail.com> | 2011-06-20 14:20:37 +0200 |
commit | 59115457ac2fa9735357c1c6d2fbd294f1c0ae96 (patch) | |
tree | 1b6a7c97a0b23eacd12f273e80647109a6925118 /wizards | |
parent | a bit of optimitation (diff) | |
download | core-59115457ac2fa9735357c1c6d2fbd294f1c0ae96.tar.gz core-59115457ac2fa9735357c1c6d2fbd294f1c0ae96.zip |
Footer checkbox works correctly now.
Others:
- Replace all UnoException by python Exception
Diffstat (limited to 'wizards')
-rw-r--r-- | wizards/com/sun/star/wizards/common/Configuration.py | 17 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/common/Desktop.py | 11 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/common/FileAccess.py | 9 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/common/Helper.py | 15 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/common/SystemDialog.py | 11 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/fax/FaxDocument.py | 17 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py | 21 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/ui/PathSelection.py | 5 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/ui/UnoDialog.py | 10 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/ui/WizardDialog.py | 15 |
10 files changed, 60 insertions, 71 deletions
diff --git a/wizards/com/sun/star/wizards/common/Configuration.py b/wizards/com/sun/star/wizards/common/Configuration.py index 88f853bbafe3..96385bfab88b 100644 --- a/wizards/com/sun/star/wizards/common/Configuration.py +++ b/wizards/com/sun/star/wizards/common/Configuration.py @@ -1,5 +1,4 @@ from PropertyNames import PropertyNames -from com.sun.star.uno import Exception as UnoException from Helper import * import traceback import uno @@ -73,7 +72,7 @@ class Configuration(object): "org.openoffice.Setup/Product", False) ProductName = Helper.getUnoObjectbyName(oProdNameAccess, "ooName") return ProductName - except UnoException: + except Exception: traceback.print_exc() return None @@ -86,7 +85,7 @@ class Configuration(object): "org.openoffice.Setup/L10N/", False) sLocale = (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale") - except UnoException, exception: + except Exception, exception: traceback.print_exc() return sLocale @@ -109,7 +108,7 @@ class Configuration(object): "org.openoffice.Setup/L10N/", False) sLinguistic = Helper.getUnoObjectbyName(oMasterKey, "ooLocale") return sLinguistic - except UnoException, exception: + except Exception, exception: traceback.print_exc() return None @@ -188,7 +187,7 @@ class Configuration(object): i += 1 return sdisplaynames - except UnoException, e: + except Exception, e: traceback.print_exc() return snames @@ -198,7 +197,7 @@ class Configuration(object): snames = _xNameAccess.getElementNames() oNode = _xNameAccess.getByName(snames[_index]) return oNode - except UnoException, e: + except Exception, e: traceback.print_exc() return None @@ -208,7 +207,7 @@ class Configuration(object): if _xNameAccessNode.hasByName(_SubNodeName): return _xNameAccessNode.getByName(_SubNodeName) - except UnoException, e: + except Exception, e: traceback.print_exc() return None @@ -235,7 +234,7 @@ class Configuration(object): return _xNameAccessNode.getByName(snames[i]) i += 1 - except UnoException, e: + except Exception, e: traceback.print_exc() return None @@ -263,7 +262,7 @@ class Configuration(object): return _xNameAccessNode.getByName(snames[i]) i += 1 - except UnoException, e: + except Exception, e: traceback.print_exc() return None diff --git a/wizards/com/sun/star/wizards/common/Desktop.py b/wizards/com/sun/star/wizards/common/Desktop.py index 81dab16877ec..0bdf9617e303 100644 --- a/wizards/com/sun/star/wizards/common/Desktop.py +++ b/wizards/com/sun/star/wizards/common/Desktop.py @@ -4,7 +4,6 @@ from com.sun.star.frame.FrameSearchFlag import ALL, PARENT from com.sun.star.util import URL from com.sun.star.i18n.KParseTokens import ANY_LETTER_OR_NUMBER, ASC_UNDERSCORE from NoValidPathException import * -from com.sun.star.uno import Exception as UnoException class Desktop(object): @@ -15,7 +14,7 @@ class Desktop(object): if xMSF is not None: try: xDesktop = xMSF.createInstance( "com.sun.star.frame.Desktop") - except UnoException, exception: + except Exception, exception: traceback.print_exc() else: print "Can't create a desktop. null pointer !" @@ -49,7 +48,7 @@ class Desktop(object): oURLArray[0] = oURL xDispatch = xFrame.queryDispatch(oURLArray[0], _stargetframe, ALL) return xDispatch - except UnoException, e: + except Exception, e: e.printStackTrace(System.out) return None @@ -64,7 +63,7 @@ class Desktop(object): oURL[0].Complete = _sURL xTransformer.parseStrict(oURL) return oURL[0] - except UnoException, e: + except Exception, e: e.printStackTrace(System.out) return None @@ -102,7 +101,7 @@ class Desktop(object): aResult = ocharservice.parsePredefinedToken(KParseType.IDENTNAME, _sString, 0, _aLocale, nStartFlags, "", nStartFlags, " ") return aResult.EndPos - except UnoException, e: + except Exception, e: e.printStackTrace(System.out) return -1 @@ -203,7 +202,7 @@ class Desktop(object): "com.sun.star.configuration.ConfigurationAccess", aNodePath) - except UnoException, exception: + except Exception, exception: exception.printStackTrace(System.out) return None diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py index 8c58091c75c9..8ac514ab6dc7 100644 --- a/wizards/com/sun/star/wizards/common/FileAccess.py +++ b/wizards/com/sun/star/wizards/common/FileAccess.py @@ -1,7 +1,6 @@ import traceback from NoValidPathException import * from com.sun.star.ucb import CommandAbortedException -from com.sun.star.uno import Exception as UnoException from com.sun.star.awt.VclWindowPeerAttribute import OK, YES_NO import types from os import path as osPath @@ -74,7 +73,7 @@ class FileAccess(object): ResultPath = str(Helper.getUnoPropertyValue(xInterface, sPath)) ResultPath = self.deleteLastSlashfromUrl(ResultPath) return ResultPath - except UnoException, exception: + except Exception, exception: traceback.print_exc() return "" @@ -126,7 +125,7 @@ class FileAccess(object): break ResultPath = self.deleteLastSlashfromUrl(ResultPath) - except UnoException, exception: + except Exception, exception: traceback.print_exc() ResultPath = "" @@ -167,7 +166,7 @@ class FileAccess(object): i += 1 aPathList.add(Template_writable) - except UnoException, exception: + except Exception, exception: traceback.print_exc() return aPathList @@ -293,7 +292,7 @@ class FileAccess(object): sMsgNoDir = JavaTools.replaceSubString(sNoDirCreation, Path, "%1") SystemDialog.showMessageBox(xMSF, "ErrorBox", OK, sMsgNoDir) return False - except com.sun.star.uno.Exception, unoexception: + except com.sun.star.uno.Exception, Exception: sMsgNoDir = JavaTools.replaceSubString(sNoDirCreation, Path, "%1") SystemDialog.showMessageBox(xMSF, "ErrorBox", OK, sMsgNoDir) return False diff --git a/wizards/com/sun/star/wizards/common/Helper.py b/wizards/com/sun/star/wizards/common/Helper.py index f2c6d69445cd..727f3f0778e9 100644 --- a/wizards/com/sun/star/wizards/common/Helper.py +++ b/wizards/com/sun/star/wizards/common/Helper.py @@ -1,7 +1,6 @@ import uno import traceback from datetime import date as DateTime -from com.sun.star.uno import Exception as UnoException from com.sun.star.uno import RuntimeException from NumberFormatter import NumberFormatter @@ -25,7 +24,7 @@ class Helper(object): selementnames = xPSet.getPropertySetInfo().getProperties() raise ValueError("No Such Property: '" + PropertyName + "'") - except UnoException, exception: + except Exception, exception: traceback.print_exc() @classmethod @@ -36,7 +35,7 @@ class Helper(object): else: raise RuntimeException(); - except UnoException, exception: + except Exception, exception: traceback.print_exc() return None @@ -63,7 +62,7 @@ class Helper(object): i += 1 return None - except UnoException, exception: + except Exception, exception: traceback.print_exc() return None @@ -76,7 +75,7 @@ class Helper(object): return oObject return None - except UnoException, exception: + except Exception, exception: traceback.print_exc() return None @@ -88,7 +87,7 @@ class Helper(object): if isinstance(oObject,list): return getArrayValue(oObject) - except UnoException, exception: + except Exception, exception: traceback.print_exc() return None @@ -102,7 +101,7 @@ class Helper(object): return oObject return None - except UnoException, exception: + except Exception, exception: traceback.print_exc() return None @@ -140,7 +139,7 @@ class Helper(object): else: return oPropList - except UnoException, exception: + except Exception, exception: traceback.print_exc() return None diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py b/wizards/com/sun/star/wizards/common/SystemDialog.py index 2da851dd9d02..324242674d94 100644 --- a/wizards/com/sun/star/wizards/common/SystemDialog.py +++ b/wizards/com/sun/star/wizards/common/SystemDialog.py @@ -9,7 +9,6 @@ from com.sun.star.ui.dialogs.TemplateDescription import FILESAVE_AUTOEXTENSION, from com.sun.star.ui.dialogs.ExtendedFilePickerElementIds import CHECKBOX_AUTOEXTENSION from com.sun.star.awt import WindowDescriptor from com.sun.star.awt.WindowClass import MODALTOP -from com.sun.star.uno import Exception as UnoException from com.sun.star.lang import IllegalArgumentException from com.sun.star.awt.VclWindowPeerAttribute import OK @@ -30,7 +29,7 @@ class SystemDialog(object): prova = uno.Any("[]short",(Type,)) #uno.invoke(prova, "initialize", (uno.Any("short",(Type,)),)) - except UnoException, exception: + except Exception, exception: traceback.print_exc() @classmethod @@ -81,7 +80,7 @@ class SystemDialog(object): sPathList = self.systemDialog.getFiles() self.sStorePath = sPathList[0] - except UnoException, exception: + except Exception, exception: traceback.print_exc() return self.sStorePath @@ -111,7 +110,7 @@ class SystemDialog(object): if self.execute(self.systemDialog): return self.systemDialog.getFiles() - except UnoException, exception: + except Exception, exception: traceback.print_exc() return None @@ -169,7 +168,7 @@ class SystemDialog(object): i += 1 raise NullPointerException( "UIName property not found for Filter " + filterName); - except UnoException, exception: + except Exception, exception: traceback.print_exc() return None @@ -233,6 +232,6 @@ class SystemDialog(object): xPathSubst = xMSF.createInstance( "com.sun.star.util.PathSubstitution") return xPathSubst - except UnoException, e: + except Exception, e: traceback.print_exc() return None diff --git a/wizards/com/sun/star/wizards/fax/FaxDocument.py b/wizards/com/sun/star/wizards/fax/FaxDocument.py index 8ff2e648b848..581b8e7ee80f 100644 --- a/wizards/com/sun/star/wizards/fax/FaxDocument.py +++ b/wizards/com/sun/star/wizards/fax/FaxDocument.py @@ -1,6 +1,5 @@ import uno from text.TextDocument import * -from com.sun.star.uno import Exception as UnoException from text.TextSectionHandler import TextSectionHandler from text.TextFieldHandler import TextFieldHandler from common.Configuration import Configuration @@ -26,7 +25,7 @@ class FaxDocument(TextDocument): oSection = \ mySectionHandler.xTextDocument.TextSections.getByName(sElement) Helper.setUnoPropertyValue(oSection, "IsVisible", bState) - except UnoException, exception: + except Exception, exception: traceback.print_exc() def updateDateFields(self): @@ -44,7 +43,7 @@ class FaxDocument(TextDocument): if bState: xPageStyle.setPropertyValue("FooterIsOn", True) - xFooterText = propertySet.getPropertyValue("FooterText") + xFooterText = Helper.getUnoPropertyValue(xPageStyle, "FooterText") xFooterText.String = sText if bPageNumber: @@ -55,11 +54,11 @@ class FaxDocument(TextDocument): PARAGRAPH_BREAK, False) myCursor.setPropertyValue("ParaAdjust", CENTER ) - xPageNumberField = xMSFDoc.createInstance( + xPageNumberField = self.xTextDocument.createInstance( "com.sun.star.text.TextField.PageNumber") - xPageNumberField.setPropertyValue( - "NumberingType", uno.Any("short",ARABIC)) xPageNumberField.setPropertyValue("SubType", CURRENT) + uno.invoke(xPageNumberField, "setPropertyValue", + ("NumberingType", uno.Any("short",ARABIC))) xFooterText.insertTextContent(xFooterText.End, xPageNumberField, False) else: @@ -67,7 +66,7 @@ class FaxDocument(TextDocument): False) self.xTextDocument.unlockControllers() - except UnoException, exception: + except Exception, exception: traceback.print_exc() def hasElement(self, sElement): @@ -105,7 +104,7 @@ class FaxDocument(TextDocument): myFieldHandler.changeUserFieldContent("Fax", Helper.getUnoObjectbyName(oUserDataAccess, "facsimiletelephonenumber")) - except UnoException, exception: + except Exception, exception: traceback.print_exc() def killEmptyUserFields(self): @@ -126,5 +125,5 @@ class FaxDocument(TextDocument): if xTF is not None: xTF.dispose() - except UnoException, e: + except Exception, e: traceback.print_exc() diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py index 32ce4b80859a..5abc8c03f567 100644 --- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py @@ -55,9 +55,6 @@ class FaxWizardDialogImpl(FaxWizardDialog): except RuntimeException, e: # TODO Auto-generated catch block traceback.print_exc() - except UnoException, e: - # TODO Auto-generated catch blocksetMaxStep - traceback.print_exc() except Exception, e: # TODO Auto-generated catch blocksetMaxStep traceback.print_exc() @@ -123,7 +120,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): self.removeTerminateListener() self.closeDocument() self.running = False - except UnoException, exception: + except Exception, exception: self.removeTerminateListener() traceback.print_exc() self.running = False @@ -207,7 +204,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): pass #TODO: Error Handling - except UnoException, e: + except Exception, e: traceback.print_exc() finally: if endWizard: @@ -413,7 +410,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): self.faxDA.append(UnoDataAware.attachEditControl(cgl, "cp_TemplatePath", self.myPathSelection.xSaveTextBox, None, True)) - except UnoException, exception: + except Exception, exception: traceback.print_exc() def saveConfiguration(self): @@ -422,7 +419,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): "/org.openoffice.Office.Writer/Wizards/Fax", True) self.myConfig.writeConfiguration(root, "cp_") Configuration.commit(root) - except UnoException, e: + except Exception, e: traceback.print_exc() def setConfiguration(self): @@ -620,7 +617,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): def chkUseFooterItemChanged(self): try: bFooterPossible = (self.chkUseFooter.State is not 0) \ - and bool(getControlProperty("chkUseFooter", + and bool(self.getControlProperty("chkUseFooter", PropertyNames.PROPERTY_ENABLED)) if self.chkFooterNextPages.State is not 0: self.myFaxDoc.switchFooter("First Page", False, @@ -642,17 +639,17 @@ class FaxWizardDialogImpl(FaxWizardDialog): FaxWizardDialogImpl.RM_FOOTER) Helper.setUnoPropertyValue(BPaperItem, PropertyNames.PROPERTY_ENABLED, bFooterPossible) - except UnoException, exception: + except Exception, exception: traceback.print_exc() def chkFooterNextPagesItemChanged(self): - chkUseFooterItemChanged() + self.chkUseFooterItemChanged() def chkFooterPageNumbersItemChanged(self): - chkUseFooterItemChanged() + self.chkUseFooterItemChanged() def txtFooterTextChanged(self): - chkUseFooterItemChanged() + self.chkUseFooterItemChanged() def chkUseSalutationItemChanged(self): self.myFaxDoc.switchUserField("Salutation", diff --git a/wizards/com/sun/star/wizards/ui/PathSelection.py b/wizards/com/sun/star/wizards/ui/PathSelection.py index b7ea23c48d38..bc2685431750 100644 --- a/wizards/com/sun/star/wizards/ui/PathSelection.py +++ b/wizards/com/sun/star/wizards/ui/PathSelection.py @@ -2,7 +2,6 @@ import traceback import uno from common.PropertyNames import * from common.FileAccess import * -from com.sun.star.uno import Exception as UnoException from common.SystemDialog import SystemDialog class PathSelection(object): @@ -84,7 +83,7 @@ class PathSelection(object): myFA.getPath(self.sDefaultDirectory + \ "/" + \ self.sDefaultName, None)) - except UnoException, e: + except Exception, e: traceback.print_exc() def triggerPathPicker(self): @@ -115,7 +114,7 @@ class PathSelection(object): elif iDialogType == DialogTypes.FILE: #TODO: write code for picking a file for loading return - except UnoException, e: + except Exception, e: traceback.print_exc() def callXPathSelectionListener(self): diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py index fc63ddbc41c6..6a79746f7b9e 100644 --- a/wizards/com/sun/star/wizards/ui/UnoDialog.py +++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py @@ -21,7 +21,7 @@ class UnoDialog(object): self.BisHighContrastModeActivated = None self.m_oPeerConfig = None self.xWindowPeer = None - except UnoException, e: + except Exception, e: traceback.print_exc() def getControlKey(self, EventObject, ControlList): @@ -85,9 +85,9 @@ class UnoDialog(object): def getControlProperty(self, ControlName, PropertyName): try: - xPSet = self.xDialogModel().getByName(ControlName) - oPropValuezxPSet.getPropertyValue(PropertyName) - except com.sun.star.uno.Exception, exception: + xPSet = self.xDialogModel.getByName(ControlName) + return xPSet.getPropertyValue(PropertyName) + except Exception, exception: traceback.print_exc() return None @@ -100,7 +100,7 @@ class UnoDialog(object): while i < allProps.length: sName = allProps[i].Name i += 1 - except UnoException, exception: + except Exception, exception: traceback.print_exc() def getMAPConversionFactor(self, ControlName): diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py index 377cffd7a2d6..18e3dc9ae1aa 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.py +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py @@ -2,7 +2,6 @@ from UnoDialog2 import * from common.Resource import Resource from abc import ABCMeta, abstractmethod from com.sun.star.lang import NoSuchMethodException -from com.sun.star.uno import Exception as UnoException from com.sun.star.lang import IllegalArgumentException from com.sun.star.frame import TerminationVetoException from common.HelpIds import * @@ -53,7 +52,7 @@ class WizardDialog(UnoDialog2): if self.xUnoDialog is not None: self.xUnoDialog.toFront() - except UnoException, ex: + except Exception, ex: pass # do nothing; @@ -93,7 +92,7 @@ class WizardDialog(UnoDialog2): try: return int(Helper.getUnoPropertyValue( self.oRoadmap, "CurrentItemID")) - except UnoException, exception: + except Exception, exception: traceback.print_exc() return -1 @@ -129,7 +128,7 @@ class WizardDialog(UnoDialog2): self.__oWizardResource.getResText(UIConsts.RID_COMMON + 16)) except NoSuchMethodException, ex: Resource.showCommonResourceError(xMSF) - except UnoException, jexception: + except Exception, jexception: traceback.print_exc() def setRMItemLabels(self, _oResource, StartResID): @@ -152,7 +151,7 @@ class WizardDialog(UnoDialog2): self.oRoadmap.insertByIndex(Index, oRoadmapItem) NextIndex = Index + 1 return NextIndex - except UnoException, exception: + except Exception, exception: traceback.print_exc() return -1 @@ -169,7 +168,7 @@ class WizardDialog(UnoDialog2): return CurRoadmapItem return None - except UnoException, exception: + except Exception, exception: traceback.print_exc() return None @@ -369,7 +368,7 @@ class WizardDialog(UnoDialog2): bIsEnabled = bool(Helper.getUnoPropertyValue(xRoadmapItem, PropertyNames.PROPERTY_ENABLED)) return bIsEnabled - except UnoException, exception: + except Exception, exception: traceback.print_exc() return False @@ -440,7 +439,7 @@ class WizardDialog(UnoDialog2): try: return int(Helper.getUnoPropertyValue(self.xDialogModel, PropertyNames.PROPERTY_STEP)) - except UnoException, exception: + except Exception, exception: traceback.print_exc() return -1 |