summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2012-11-15 20:35:57 +0100
committerXisco Fauli <anistenis@gmail.com>2012-11-21 01:07:59 +0100
commit34fbbe1af85c8120a2e76b37497d6282e87c1af6 (patch)
treebbfcd4daa4fac8a0f31ebf994999cbd61f85d115 /wizards
parentbb16e912760df54dd77ffc216cc5dee68a48e140 (diff)
pyfax: exceptions are python3 compatible
Change-Id: Ife2a935b25928db154756494798a5e9b619f902a
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/common/Desktop.py8
-rw-r--r--wizards/com/sun/star/wizards/common/FileAccess.py214
-rw-r--r--wizards/com/sun/star/wizards/common/Helper.py16
-rw-r--r--wizards/com/sun/star/wizards/common/NumberFormatter.py8
-rw-r--r--wizards/com/sun/star/wizards/common/Resource.py6
-rw-r--r--wizards/com/sun/star/wizards/common/SystemDialog.py18
-rw-r--r--wizards/com/sun/star/wizards/document/OfficeDocument.py23
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py18
-rw-r--r--wizards/com/sun/star/wizards/text/TextDocument.py15
-rw-r--r--wizards/com/sun/star/wizards/text/TextFieldHandler.py35
-rw-r--r--wizards/com/sun/star/wizards/text/TextSectionHandler.py14
-rw-r--r--wizards/com/sun/star/wizards/text/ViewHandler.py6
-rw-r--r--wizards/com/sun/star/wizards/ui/PathSelection.py4
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog.py37
-rw-r--r--wizards/com/sun/star/wizards/ui/WizardDialog.py28
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAware.py3
16 files changed, 106 insertions, 347 deletions
diff --git a/wizards/com/sun/star/wizards/common/Desktop.py b/wizards/com/sun/star/wizards/common/Desktop.py
index 1876bfd716b9..49880ac82643 100644
--- a/wizards/com/sun/star/wizards/common/Desktop.py
+++ b/wizards/com/sun/star/wizards/common/Desktop.py
@@ -31,10 +31,10 @@ class Desktop(object):
if xMSF is not None:
try:
xDesktop = xMSF.createInstance( "com.sun.star.frame.Desktop")
- except Exception, exception:
+ except Exception:
traceback.print_exc()
else:
- print "Can't create a desktop. null pointer !"
+ print ("Can't create a desktop. null pointer !")
return xDesktop
@@ -55,7 +55,7 @@ class Desktop(object):
oURLArray[0] = oURL
xDispatch = xFrame.queryDispatch(oURLArray[0], _stargetframe, ALL)
return xDispatch
- except Exception, e:
+ except Exception:
traceback.print_exc()
return None
@@ -99,7 +99,7 @@ class Desktop(object):
aResult = ocharservice.parsePredefinedToken(KParseType.IDENTNAME,
_sString, 0, _aLocale, nStartFlags, "", nStartFlags, " ")
return aResult.EndPos
- except Exception, e:
+ except Exception:
traceback.print_exc()
return -1
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py
index 49acdeb063ce..157cee873294 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.py
+++ b/wizards/com/sun/star/wizards/common/FileAccess.py
@@ -87,7 +87,7 @@ class FileAccess(object):
ResultPath = str(Helper.getUnoPropertyValue(xInterface, sPath))
ResultPath = self.deleteLastSlashfromUrl(ResultPath)
return ResultPath
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return ""
@@ -139,7 +139,7 @@ class FileAccess(object):
break
ResultPath = self.deleteLastSlashfromUrl(ResultPath)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
ResultPath = ""
@@ -149,115 +149,13 @@ class FileAccess(object):
return ResultPath
@classmethod
- def getOfficePaths(self, xMSF, _sPath, sType, sSearchDir):
- #This method currently only works with sPath="Template"
- aPathList = []
- Template_writable = ""
- try:
- xPathInterface = xMSF.createInstance(
- "com.sun.star.util.PathSettings")
- Template_writable = xPathInterface.getPropertyValue(
- _sPath + "_writable")
- Template_internal = xPathInterface.getPropertyValue(
- _sPath + "_internal")
- Template_user = xPathInterface.getPropertyValue(_sPath + "_user")
- i = 0
- for i in Template_internal:
- if i.startsWith("vnd."):
- # if there exists a language in the directory,
- # we try to add the right language
- sPathToExpand = sPath.substring(len("vnd.sun.star.Expand:"))
- xExpander = Helper.getMacroExpander(xMSF)
- sPath = xExpander.expandMacros(sPathToExpand)
-
- sPath = checkIfLanguagePathExists(xMSF, sPath)
- aPathList.add(sPath)
- i += 1
- i = 0
- while i < Template_user.length:
- aPathList.add(Template_user[i])
- i += 1
- aPathList.add(Template_writable)
-
- except Exception, exception:
- traceback.print_exc()
- return aPathList
-
- @classmethod
- def checkIfLanguagePathExists(self, _xMSF, _sPath):
- try:
- defaults = _xMSF.createInstance("com.sun.star.text.Defaults")
- aLocale = Helper.getUnoStructValue(defaults, "CharLocale")
- if aLocale == None:
- java.util.Locale.getDefault()
- aLocale = com.sun.star.lang.Locale.Locale()
- aLocale.Country = java.util.Locale.getDefault().getCountry()
- aLocale.Language = java.util.Locale.getDefault().getLanguage()
- aLocale.Variant = java.util.Locale.getDefault().getVariant()
-
- sLanguage = aLocale.Language
- sCountry = aLocale.Country
- sVariant = aLocale.Variant
- # de-DE-Bayrisch
- aLocaleAll = StringBuffer.StringBuffer()
- aLocaleAll.append(sLanguage).append('-').append(sCountry).append('-').append(sVariant)
- sPath = _sPath + "/" + aLocaleAll.toString()
- xInterface = _xMSF.createInstance(
- "com.sun.star.ucb.SimpleFileAccess")
- if xInterface.exists(sPath):
- # de-DE
- return sPath
-
- aLocaleLang_Country = StringBuffer.StringBuffer()
- aLocaleLang_Country.append(sLanguage).append('-').append(sCountry)
- sPath = _sPath + "/" + aLocaleLang_Country.toString()
- if xInterface.exists(sPath):
- # de
- return sPath
-
- aLocaleLang = StringBuffer.StringBuffer()
- aLocaleLang.append(sLanguage)
- sPath = _sPath + "/" + aLocaleLang.toString()
- if xInterface.exists(sPath):
- # the absolute default is en-US or en
- return sPath
-
- sPath = _sPath + "/en-US"
- if xInterface.exists(sPath):
- return sPath
-
- sPath = _sPath + "/en"
- if xInterface.exists(sPath):
- return sPath
-
- except com.sun.star.uno.Exception, e:
- pass
-
- return _sPath
-
- @classmethod
- def combinePaths2(self, xMSF, _aFirstPath, _sSecondPath):
- i = 0
- while i < _aFirstPath.size():
- sOnePath = _aFirstPath.get(i)
- sOnePath = addPath(sOnePath, _sSecondPath)
- if isPathValid(xMSF, sOnePath):
- _aFirstPath.add(i, sOnePath)
- _aFirstPath.remove(i + 1)
- else:
- _aFirstPath.remove(i)
- i -= 1
-
- i += 1
-
- @classmethod
def isPathValid(self, xMSF, _sPath):
bExists = False
try:
xUcbInterface = xMSF.createInstance(
"com.sun.star.ucb.SimpleFileAccess")
bExists = xUcbInterface.exists(_sPath)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return bExists
@@ -271,7 +169,7 @@ class FileAccess(object):
"com.sun.star.ucb.SimpleFileAccess")
ReturnPath = _sFirstPath + _sSecondPath
bexists = xUcbInterface.exists(ReturnPath)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return ""
@@ -281,32 +179,6 @@ class FileAccess(object):
return ReturnPath
@classmethod
- def createSubDirectory(self, xMSF, xSimpleFileAccess, Path):
- sNoDirCreation = ""
- try:
- oResource = Resource.Resource_unknown(xMSF, "ImportWizard", "imp")
- if oResource != None:
- sNoDirCreation = oResource.getResText(1050)
- sMsgDirNotThere = oResource.getResText(1051)
- sQueryForNewCreation = oResource.getResText(1052)
- OSPath = JavaTools.convertfromURLNotation(Path)
- sQueryMessage = JavaTools.replaceSubString(sMsgDirNotThere,
- OSPath, "%1")
- sQueryMessage = sQueryMessage + (char)
- 13 + sQueryForNewCreation
- icreate = SystemDialog.showMessageBox(xMSF, "QueryBox",
- YES_NO, sQueryMessage)
- if icreate == 2:
- xSimpleFileAccess.createFolder(Path)
- return True
-
- return False
- except Exception:
- sMsgNoDir = JavaTools.replaceSubString(sNoDirCreation, Path, "%1")
- SystemDialog.showMessageBox(xMSF, "ErrorBox", OK, sMsgNoDir)
- return False
-
- @classmethod
def getFolderTitles(self, xMSF, FilterName, FolderName, resDict=None):
#Returns and ordered dict containing the template's name and path
@@ -336,7 +208,7 @@ class FileAccess(object):
title = xDocInterface.Title
LocLayoutFiles[title] = i
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return OrderedDict(sorted(LocLayoutFiles.items(), key=lambda t: t[0]))
@@ -353,25 +225,6 @@ class FileAccess(object):
return sNewPath
@classmethod
- def getPathFromList(self, xMSF, _aList, _sFile):
- sFoundFile = ""
- try:
- xInterface = xMSF.createInstance(
- "com.sun.star.ucb.SimpleFileAccess")
- i = 0
- while i < _aList.size():
- sPath = _aList.get(i)
- sPath = addPath(sPath, _sFile)
- if xInterface.exists(sPath):
- sFoundFile = sPath
-
- i += 1
- except Exception, e:
- pass
-
- return sFoundFile
-
- @classmethod
def getTitle(self, xMSF, _sFile):
sTitle = ""
try:
@@ -380,7 +233,7 @@ class FileAccess(object):
noArgs = []
xDocInterface.loadFromMedium(_sFile, noArgs)
sTitle = xDocInterface.getTitle()
- except Exception, e:
+ except Exception:
traceback.print_exc()
return sTitle
@@ -599,12 +452,6 @@ class FileAccess(object):
return name + stringI + stringExt
- def getSize(self, url):
- try:
- return self.fileAccess.getSize(url)
- except Exception, ex:
- return -1
-
@classmethod
def connectURLs(self, urlFolder, urlFilename):
stringFolder = ""
@@ -614,52 +461,3 @@ class FileAccess(object):
if urlFilename.startswith("/"):
stringFileName = urlFilename[1:]
return urlFolder + stringFolder + stringFileName
-
- @classmethod
- def getDataFromTextFile(self, _xMSF, _filepath):
- sFileData = None
- try:
- oDataVector = []
- oSimpleFileAccess = _xMSF.createInstance(
- "com.sun.star.ucb.SimpleFileAccess")
- if oSimpleFileAccess.exists(_filepath):
- xInputStream = oSimpleFileAccess.openFileRead(_filepath)
- oTextInputStream = _xMSF.createInstance(
- "com.sun.star.io.TextInputStream")
- oTextInputStream.setInputStream(xInputStream)
- while not oTextInputStream.isEOF():
- oDataVector.addElement(oTextInputStream.readLine())
- oTextInputStream.closeInput()
- sFileData = [oDataVector.size()]
- oDataVector.toArray(sFileData)
-
- except Exception, e:
- traceback.print_exc()
-
- return sFileData
-
- '''
- shortens a filename to a user displayable representation.
- @param path
- @param maxLength
- @return
- '''
-
- @classmethod
- def getShortFilename(self, path, maxLength):
- firstPart = 0
- if path.length() > maxLength:
- if path.startsWith("/"):
- # unix
- nextSlash = path.indexOf("/", 1) + 1
- firstPart = Math.min(nextSlash, (maxLength - 3) / 2)
- else:
- #windows
- firstPart = Math.min(10, (maxLength - 3) / 2)
-
- s1 = path.substring(0, firstPart)
- s2 = path.substring(path.length() - (maxLength - (3 + firstPart)))
- return s1 + "..." + s2
- else:
- return path
-
diff --git a/wizards/com/sun/star/wizards/common/Helper.py b/wizards/com/sun/star/wizards/common/Helper.py
index c77652ee0f4b..3a19e64fef6d 100644
--- a/wizards/com/sun/star/wizards/common/Helper.py
+++ b/wizards/com/sun/star/wizards/common/Helper.py
@@ -31,7 +31,7 @@ class Helper(object):
setattr(xPSet, PropertyName, PropertyValue)
except AttributeError:
- raise AttributeError, "No Such Property: '%s'" % PropertyName
+ raise AttributeError( "No Such Property: '%s'" % PropertyName)
except Exception:
traceback.print_exc()
@@ -43,7 +43,7 @@ class Helper(object):
else:
raise RuntimeException()
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return None
@@ -64,7 +64,7 @@ class Helper(object):
return oObject
return None
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return None
@@ -76,7 +76,7 @@ class Helper(object):
if isinstance(oObject,list):
return getArrayValue(oObject)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return None
@@ -90,7 +90,7 @@ class Helper(object):
return oObject
return None
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return None
@@ -128,7 +128,7 @@ class Helper(object):
else:
return oPropList
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return None
@@ -137,13 +137,13 @@ class Helper(object):
#try to add the path to the class loader
aHelper = PropertySetHelper(_xMSF);
aDefaultContext = aHelper.getPropertyValueAsObject("DefaultContext")
- return aDefaultContext;
+ return aDefaultContext
def getMacroExpander(_xMSF):
xComponentContext = self.getComponentContext(_xMSF);
aSingleton = xComponentContext.getValueByName(
"/singletons/com.sun.star.util.theMacroExpander")
- return aSingleton;
+ return aSingleton
class DateUtils(object):
diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.py b/wizards/com/sun/star/wizards/common/NumberFormatter.py
index 5a9bb158dad3..316659f01244 100644
--- a/wizards/com/sun/star/wizards/common/NumberFormatter.py
+++ b/wizards/com/sun/star/wizards/common/NumberFormatter.py
@@ -102,7 +102,7 @@ class NumberFormatter(object):
_FormatString, self.aLocale)
return NewFormatKey
- except Exception, e:
+ except Exception:
traceback.print_exc()
return -1
@@ -122,7 +122,7 @@ class NumberFormatter(object):
_FormatString, _aLocale)
return NewFormatKey
- except Exception, e:
+ except Exception:
traceback.print_exc()
return -1
@@ -147,7 +147,7 @@ class NumberFormatter(object):
# TODO: throws a exception in a try catch environment, very helpful?
raise Exception
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def getNullDateCorrection(self):
@@ -174,7 +174,7 @@ class NumberFormatter(object):
self.iLogicalFormatKey = self.xNumberFormats.addNew(
FormatString, self.aLocale)
- except Exception, e:
+ except Exception:
#MalformedNumberFormat
traceback.print_exc()
self.iLogicalFormatKey = self.xNumberFormats.getStandardFormat(
diff --git a/wizards/com/sun/star/wizards/common/Resource.py b/wizards/com/sun/star/wizards/common/Resource.py
index fc607ea3a826..52eb40f826e7 100644
--- a/wizards/com/sun/star/wizards/common/Resource.py
+++ b/wizards/com/sun/star/wizards/common/Resource.py
@@ -37,14 +37,14 @@ class Resource(object):
if self.xStringIndexAccess is None:
raise Exception ("could not initialize xStringIndexAccess")
- except Exception, exception:
+ except Exception:
traceback.print_exc()
self.showCommonResourceError(self.xMSF)
def getResText(self, nID):
try:
return self.xStringIndexAccess.getByIndex(nID)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
raise ValueError("Resource with ID not " + str(nID) + " not found")
@@ -56,7 +56,7 @@ class Resource(object):
ResArray[i] = getResText(nID + i)
i += 1
return ResArray
- except Exception, exception:
+ except Exception:
traceback.print_exc()
raise ValueError("Resource with ID not" + str(nID) + " not found")
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.py b/wizards/com/sun/star/wizards/common/SystemDialog.py
index 6030d572099b..9d7e84b3a23f 100644
--- a/wizards/com/sun/star/wizards/common/SystemDialog.py
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.py
@@ -40,7 +40,7 @@ class SystemDialog(object):
if self.systemDialog is not None:
self.systemDialog.initialize((Type,))
- except Exception, exception:
+ except Exception:
traceback.print_exc()
@classmethod
@@ -68,7 +68,7 @@ class SystemDialog(object):
try:
s = self.xStringSubstitution.substituteVariables(path, False)
return s
- except Exception, ex:
+ except Exception:
traceback.print_exc()
return path
@@ -85,7 +85,7 @@ class SystemDialog(object):
sPathList = self.systemDialog.getFiles()
self.sStorePath = sPathList[0]
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return self.sStorePath
@@ -94,7 +94,7 @@ class SystemDialog(object):
try:
self.systemDialog.setDisplayDirectoryxPropertyValue(
subst(displayDir))
- except IllegalArgumentException, iae:
+ except IllegalArgumentException as iae:
traceback.print_exc()
raise AttributeError(iae.getMessage());
@@ -115,7 +115,7 @@ class SystemDialog(object):
if self.execute(self.systemDialog):
return self.systemDialog.getFiles()
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return None
@@ -127,7 +127,7 @@ class SystemDialog(object):
pattern = "*." + sExtension
#add the filter
self.addFilter(uiName, pattern, setToDefault)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def addFilter(self, uiName, pattern, setToDefault):
@@ -136,7 +136,7 @@ class SystemDialog(object):
if setToDefault:
self.systemDialog.setCurrentFilter(uiName)
- except Exception, ex:
+ except Exception:
traceback.print_exc()
'''
@@ -157,7 +157,7 @@ class SystemDialog(object):
raise NullPointerException(
"UIName property not found for Filter " + filterName);
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return None
@@ -221,6 +221,6 @@ class SystemDialog(object):
xPathSubst = xMSF.createInstance(
"com.sun.star.util.PathSubstitution")
return xPathSubst
- except Exception, e:
+ except Exception:
traceback.print_exc()
return None
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.py b/wizards/com/sun/star/wizards/document/OfficeDocument.py
index 418479498ee9..9c443ef05e66 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.py
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.py
@@ -59,7 +59,7 @@ class OfficeDocument(object):
uno.invoke(xComponent.Events, "replaceByName",
(EventName, uno.Any("[]com.sun.star.beans.PropertyValue",
tuple(oEventProperties))))
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def dispose(self, xMSF, xComponent):
@@ -71,7 +71,7 @@ class OfficeDocument(object):
Desktop.dispatchURL(xMSF, ".uno:CloseDoc", xFrame)
- except PropertyVetoException, exception:
+ except PropertyVetoException:
traceback.print_exc()
'''
@@ -132,7 +132,7 @@ class OfficeDocument(object):
xToolkit = None
try:
xToolkit = xMSF.createInstance("com.sun.star.awt.Toolkit")
- except Exception, e:
+ except Exception:
# TODO Auto-generated catch block
traceback.print_exc()
@@ -156,8 +156,7 @@ class OfficeDocument(object):
xPeer = None
try:
xPeer = xToolkit.createWindow(aDescriptor)
- except IllegalArgumentException, e:
- # TODO Auto-generated catch block
+ except IllegalArgumentException:
traceback.print_exc()
#define some further properties of the frame window
@@ -167,8 +166,7 @@ class OfficeDocument(object):
xFrame = None
try:
xFrame = xMSF.createInstance("com.sun.star.frame.Frame")
- except Exception, e:
- # TODO Auto-generated catch block
+ except Exception:
traceback.print_exc()
xFrame.initialize(xPeer)
@@ -187,7 +185,7 @@ class OfficeDocument(object):
try:
xComponent = xInterface.loadComponentFromURL(
sURL, sFrame, 0, tuple(xValues))
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return xComponent
@@ -223,9 +221,8 @@ class OfficeDocument(object):
return True
except ErrorCodeIOException:
return True
- #There's a bug here, fix later
pass
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return False
@@ -235,8 +232,8 @@ class OfficeDocument(object):
try:
xComponent.close(True)
bState = True
- except com.sun.star.util.CloseVetoException, exCloseVeto:
- print "could not close doc"
+ except com.sun.star.util.CloseVetoException:
+ print ("could not close doc")
bState = False
else:
@@ -256,7 +253,7 @@ class OfficeDocument(object):
(rowcount + ypos) - 1)
xNewRange.setDataArray(datalist)
- except Exception, e:
+ except Exception:
traceback.print_exc()
@classmethod
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index a044484283ea..c084938aa389 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -134,7 +134,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
self.removeTerminateListener()
self.closeDocument()
self.running = False
- except Exception, exception:
+ except Exception:
self.removeTerminateListener()
traceback.print_exc()
self.running = False
@@ -213,7 +213,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
pass
#TODO: Error Handling
- except Exception, e:
+ except Exception:
traceback.print_exc()
finally:
if endWizard:
@@ -225,7 +225,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
def closeDocument(self):
try:
self.myFaxDoc.xFrame.close(False)
- except CloseVetoException, e:
+ except CloseVetoException:
traceback.print_exc()
def drawConstants(self):
@@ -265,9 +265,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
"Template", "share", "/wizard")
self.UserTemplatePath = FileAccess.getOfficePath2(self.xMSF,
"Template", "user", "")
- self.sBitmapPath = FileAccess.combinePaths(self.xMSF,
- self.sTemplatePath, "/../wizard/bitmap")
- except NoValidPathException, e:
+ except NoValidPathException:
traceback.print_exc()
def initializeTemplates(self, xMSF):
@@ -287,7 +285,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
self.setControlProperty("lstBusinessStyle", "SelectedItems", (0,))
self.setControlProperty("lstPrivateStyle", "SelectedItems" , (0,))
return True
- except NoValidPathException, e:
+ except NoValidPathException:
traceback.print_exc()
return False
@@ -395,7 +393,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
"cp_TemplateName", self.txtTemplateName, True).updateUI()
UnoDataAware.attachEditControl(cgl, "cp_TemplatePath",
self.myPathSelection.xSaveTextBox, True).updateUI()
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def saveConfiguration(self):
@@ -404,7 +402,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
"/org.openoffice.Office.Writer/Wizards/Fax", True)
self.myConfig.writeConfiguration(root, "cp_")
root.commitChanges()
- except Exception, e:
+ except Exception:
traceback.print_exc()
def setConfiguration(self):
@@ -617,7 +615,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
FaxWizardDialogImpl.RM_FOOTER)
Helper.setUnoPropertyValue(BPaperItem,
PropertyNames.PROPERTY_ENABLED, bFooterPossible)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def chkFooterNextPagesItemChanged(self):
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.py b/wizards/com/sun/star/wizards/text/TextDocument.py
index 31357ab5b763..7190bc0768e1 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.py
+++ b/wizards/com/sun/star/wizards/text/TextDocument.py
@@ -95,7 +95,7 @@ class TextDocument(object):
"private:object", "_blank", 0, loadArgs)
# remember some things for later usage
self.xFrame = self.xTextDocument.CurrentController.Frame
- except Exception, e:
+ except Exception:
traceback.print_exc()
elif _textDocument is not None:
@@ -148,7 +148,7 @@ class TextDocument(object):
try:
myViewHandler.setViewSetting(
"ZoomType", ENTIRE_PAGE)
- except Exception, e:
+ except Exception:
traceback.print_exc()
myFieldHandler = TextFieldHandler(self.xMSF, self.xTextDocument)
myFieldHandler.updateDocInfoFields()
@@ -160,7 +160,7 @@ class TextDocument(object):
xPageStyleCollection = xNameAccess.getByName("PageStyles")
xPageStyle = xPageStyleCollection.getByName("First Page")
return Helper.getUnoPropertyValue(xPageStyle, "Size")
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return None
@@ -207,14 +207,7 @@ class TextDocument(object):
description = description.replace("<wizard_name>", WizardName)
description = description.replace("<current_date>", myDate)
xDocProps2.Description = description
- except NoSuchElementException, e:
- # TODO Auto-generated catch block
- traceback.print_exc()
- except WrappedTargetException, e:
- # TODO Auto-generated catch block
- traceback.print_exc()
- except Exception, e:
- # TODO Auto-generated catch block
+ except Exception:
traceback.print_exc()
'''
diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.py b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
index 25c3703b1820..5bb96a181ce6 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.py
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
@@ -30,12 +30,12 @@ class TextFieldHandler(object):
'''
xTextFieldsSupplierAux = None
- arrayTextFields = None
- dictTextFields = None
def __init__(self, xMSF, xTextDocument):
self.xMSFDoc = xMSF
self.xTextFieldsSupplier = xTextDocument
+ self.arrayTextFields = {}
+ self.dictTextFields = []
if TextFieldHandler.xTextFieldsSupplierAux is not \
self.xTextFieldsSupplier:
self.__getTextFields()
@@ -56,7 +56,7 @@ class TextFieldHandler(object):
UserFieldContent = xMaster.getPropertyValue("Content")
return UserFieldContent
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return ""
@@ -76,7 +76,7 @@ class TextFieldHandler(object):
xField.attachTextFieldMaster(xPSet)
xTextCursor.getText().insertTextContent(
xTextCursor, xField, False)
- except com.sun.star.uno.Exception, exception:
+ except Exception:
traceback.print_exc()
def createUserField(self, FieldName, FieldTitle):
@@ -89,25 +89,22 @@ class TextFieldHandler(object):
def __getTextFields(self):
try:
if self.xTextFieldsSupplier.TextFields.hasElements():
- TextFieldHandler.dictTextFields = {}
- TextFieldHandler.arrayTextFields = []
xEnum = \
self.xTextFieldsSupplier.TextFields.createEnumeration()
while xEnum.hasMoreElements():
oTextField = xEnum.nextElement()
- TextFieldHandler.arrayTextFields.append(oTextField)
+ self.arrayTextFields.append(oTextField)
xPropertySet = oTextField.TextFieldMaster
if xPropertySet.Name:
- TextFieldHandler.dictTextFields[xPropertySet.Name] = \
+ self.dictTextFields[xPropertySet.Name] = \
oTextField
- except Exception, e:
- #TODO Auto-generated catch block
+ except Exception:
traceback.print_exc()
def __getTextFieldsByProperty(
self, _PropertyName, _aPropertyValue):
try:
- xProperty = TextFieldHandler.dictTextFields[_aPropertyValue]
+ xProperty = self.dictTextFields[_aPropertyValue]
xPropertySet = xProperty.TextFieldMaster
if xPropertySet.PropertySetInfo.hasPropertyByName(
_PropertyName):
@@ -117,7 +114,7 @@ class TextFieldHandler(object):
if sValue == _aPropertyValue:
return xProperty
return None
- except KeyError, e:
+ except KeyError:
return None
def changeUserFieldContent(self, _FieldName, _FieldContent):
@@ -129,7 +126,7 @@ class TextFieldHandler(object):
def updateDocInfoFields(self):
try:
- for i in TextFieldHandler.arrayTextFields:
+ for i in self.arrayTextFields:
if i.supportsService(
"com.sun.star.text.TextField.ExtendedUser"):
i.update()
@@ -138,7 +135,7 @@ class TextFieldHandler(object):
"com.sun.star.text.TextField.User"):
i.update()
- except Exception, e:
+ except Exception:
traceback.print_exc()
def updateDateFields(self):
@@ -149,23 +146,23 @@ class TextFieldHandler(object):
dt.Year = time.strftime("%Y", now)
dt.Month = time.strftime("%m", now)
dt.Month += 1
- for i in TextFieldHandler.arrayTextFields:
+ for i in self.arrayTextFields:
if i.supportsService(
"com.sun.star.text.TextField.DateTime"):
i.setPropertyValue("IsFixed", False)
i.setPropertyValue("DateTimeValue", dt)
- except Exception, e:
+ except Exception:
traceback.print_exc()
def fixDateFields(self, _bSetFixed):
try:
- for i in TextFieldHandler.arrayTextFields:
+ for i in self.arrayTextFields:
if i.supportsService(
"com.sun.star.text.TextField.DateTime"):
i.setPropertyValue("IsFixed", _bSetFixed)
- except Exception, e:
+ except Exception:
traceback.print_exc()
def removeUserFieldByContent(self, _FieldContent):
@@ -178,5 +175,5 @@ class TextFieldHandler(object):
xDependentTextFields[i].dispose()
i += 1
- except Exception, e:
+ except Exception:
traceback.print_exc()
diff --git a/wizards/com/sun/star/wizards/text/TextSectionHandler.py b/wizards/com/sun/star/wizards/text/TextSectionHandler.py
index 8d8c52d1a7b6..7e3c6e64477f 100644
--- a/wizards/com/sun/star/wizards/text/TextSectionHandler.py
+++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.py
@@ -35,7 +35,7 @@ class TextSectionHandler(object):
self.removeTextSection(oTextSection)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def hasTextSectionByName(self, SectionName):
@@ -48,13 +48,13 @@ class TextSectionHandler(object):
oTextSection = xAllTextSections.getByIndex(
xAllTextSections.getCount() - 1)
self.removeTextSection(oTextSection)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def removeTextSection(self, _oTextSection):
try:
self.xText.removeTextContent(_oTextSection)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def removeInvisibleTextSections(self):
@@ -68,7 +68,7 @@ class TextSectionHandler(object):
self.xText.removeTextContent(xTextContentTextSection)
i -= 1
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def removeAllTextSections(self):
@@ -78,7 +78,7 @@ class TextSectionHandler(object):
for i in xrange(TextSectionCount - 1, -1, -1):
xTextContentTextSection = xAllTextSections.getByIndex(i)
self.xText.removeTextContent(xTextContentTextSection)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def breakLinkOfTextSection(self, oTextSection):
@@ -120,7 +120,7 @@ class TextSectionHandler(object):
xSecondTextCursor = self.xText.createTextCursor()
xSecondTextCursor.gotoEnd(False)
insertTextSection(GroupName, TemplateName, xSecondTextCursor)
- except IllegalArgumentException, e:
+ except IllegalArgumentException:
traceback.print_exc()
def insertTextSection(self, sectionName, templateName, position):
@@ -135,6 +135,6 @@ class TextSectionHandler(object):
position, xTextSection, False)
linkSectiontoTemplate(xTextSection, templateName, sectionName)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
diff --git a/wizards/com/sun/star/wizards/text/ViewHandler.py b/wizards/com/sun/star/wizards/text/ViewHandler.py
index c50283b7b825..1609acb8eaa4 100644
--- a/wizards/com/sun/star/wizards/text/ViewHandler.py
+++ b/wizards/com/sun/star/wizards/text/ViewHandler.py
@@ -41,10 +41,10 @@ class ViewHandler(object):
xViewTextCursor.gotoRange(xHeaderRange, False)
xViewTextCursor.collapseToStart()
else:
- print "No Headertext available"
+ print ("No Headertext available")
- except com.sun.star.uno.Exception, exception:
- exception.printStackTrace(System.out)
+ except Exception:
+ traceback.print_exc()
def setViewSetting(self, Setting, Value):
self.xTextViewCursorSupplier.ViewSettings.setPropertyValue(Setting, Value)
diff --git a/wizards/com/sun/star/wizards/ui/PathSelection.py b/wizards/com/sun/star/wizards/ui/PathSelection.py
index b468004a0d91..47159a59fccc 100644
--- a/wizards/com/sun/star/wizards/ui/PathSelection.py
+++ b/wizards/com/sun/star/wizards/ui/PathSelection.py
@@ -99,7 +99,7 @@ class PathSelection(object):
myFA.getPath(self.sDefaultDirectory + \
"/" + \
self.sDefaultName, None))
- except Exception, e:
+ except Exception:
traceback.print_exc()
def triggerPathPicker(self):
@@ -130,7 +130,7 @@ class PathSelection(object):
elif iDialogType == DialogTypes.FILE:
#TODO: write code for picking a file for loading
return
- except Exception, e:
+ except Exception:
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 18f563c52d78..c33cbb13f985 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py
@@ -40,21 +40,9 @@ class UnoDialog(object):
self.xUnoDialog.setModel(self.xDialogModel)
self.m_oPeerConfig = None
self.xWindowPeer = None
- except Exception, e:
+ except Exception:
traceback.print_exc()
- def getControlKey(self, EventObject, ControlList):
- xControlModel = EventObject.getModel()
- try:
- sName = xControlModel.getPropertyValue(
- PropertyNames.PROPERTY_NAME)
- iKey = ControlList.get(sName).intValue()
- except com.sun.star.uno.Exception, exception:
- traceback.print_exc()
- iKey = 2000
-
- return iKey
-
def getPeerConfiguration(self):
if self.m_oPeerConfig is None:
self.m_oPeerConfig = PeerConfig(self)
@@ -68,7 +56,7 @@ class UnoDialog(object):
xPSet = self.xDialogModel.getByName(ControlName)
setattr(xPSet,PropertyName, PropertyValue)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def setControlProperties(
@@ -79,7 +67,7 @@ class UnoDialog(object):
try:
xPSet = self.xDialogModel.getByName(ControlName)
return xPSet.getPropertyValue(PropertyName)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return None
@@ -92,7 +80,7 @@ class UnoDialog(object):
while i < allProps.length:
sName = allProps[i].Name
i += 1
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def getMAPConversionFactor(self, ControlName):
@@ -168,7 +156,7 @@ class UnoDialog(object):
controlname, PropertyNames.PROPERTY_STEP,
UIConsts.INVISIBLESTEP)
- except com.sun.star.uno.Exception, exception:
+ except Exception:
traceback.print_exc()
# repaints the currentDialogStep
@@ -181,7 +169,7 @@ class UnoDialog(object):
self.xDialogModel, PropertyNames.PROPERTY_STEP, 99)
Helper.setUnoPropertyValue(
self.xDialogModel, PropertyNames.PROPERTY_STEP, ncurstep)
- except com.sun.star.uno.Exception, exception:
+ except Exception:
traceback.print_exc()
def insertControlModel(
@@ -193,7 +181,7 @@ class UnoDialog(object):
self.xDialogModel.insertByName(componentName, xControlModel)
Helper.setUnoPropertyValue(xControlModel,
PropertyNames.PROPERTY_NAME, componentName)
- except Exception, ex:
+ except Exception:
traceback.print_exc()
aObj = self.xUnoDialog.getControl(componentName)
@@ -203,17 +191,6 @@ class UnoDialog(object):
oFocusControl = self.xUnoDialog.getControl(ControlName)
oFocusControl.setFocus()
- def combineListboxList(self, sFirstEntry, MainList):
- try:
- FirstList = [sFirstEntry]
- ResultList = [MainList.length + 1]
- System.arraycopy(FirstList, 0, ResultList, 0, 1)
- System.arraycopy(MainList, 0, ResultList, 1, len(MainList))
- return ResultList
- except java.lang.Exception, jexception:
- traceback.print_exc()
- return None
-
def selectListBoxItem(self, xListBox, iFieldsSelIndex):
if iFieldsSelIndex > -1:
FieldCount = xListBox.getItemCount()
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py
index 85e295257d06..e23315f0c906 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.py
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py
@@ -77,7 +77,7 @@ class WizardDialog(UnoDialog2):
if self.nNewStep != self.nOldStep:
self.switchToStep()
- except IllegalArgumentException, exception:
+ except IllegalArgumentException:
traceback.print_exc()
def setRoadmapInteractive(self, _bInteractive):
@@ -89,7 +89,7 @@ class WizardDialog(UnoDialog2):
def isRoadmapComplete(self):
try:
return bool(Helper.getUnoPropertyValue(self.oRoadmap, "Complete"))
- except IllegalArgumentException, exception:
+ except IllegalArgumentException:
traceback.print_exc()
return False
@@ -103,7 +103,7 @@ class WizardDialog(UnoDialog2):
try:
return int(Helper.getUnoPropertyValue(
self.oRoadmap, "CurrentItemID"))
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return -1
@@ -135,9 +135,9 @@ class WizardDialog(UnoDialog2):
Helper.setUnoPropertyValue(
self.oRoadmap, "Text",
self.__oWizardResource.getResText(UIConsts.RID_COMMON + 16))
- except NoSuchMethodException, ex:
+ except NoSuchMethodException:
Resource.showCommonResourceError(xMSF)
- except Exception, jexception:
+ except Exception:
traceback.print_exc()
def setRMItemLabels(self, _oResource, StartResID):
@@ -155,7 +155,7 @@ class WizardDialog(UnoDialog2):
PropertyNames.PROPERTY_ENABLED, _bEnabled)
Helper.setUnoPropertyValue(oRoadmapItem, "ID", _CurItemID)
self.oRoadmap.insertByIndex(Index, oRoadmapItem)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def getRoadmapItemByID(self, _ID):
@@ -168,7 +168,7 @@ class WizardDialog(UnoDialog2):
return CurRoadmapItem
return None
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return None
@@ -303,7 +303,7 @@ class WizardDialog(UnoDialog2):
uno.Any("short",(curtabindex + 1)),
iButtonWidth), self)
self.setControlProperty("btnWizardNext", "DefaultButton", True)
- except Exception, exception:
+ except Exception:
traceback.print_exc()
def insertRoadMapItems(self, enabled, items):
@@ -356,7 +356,7 @@ class WizardDialog(UnoDialog2):
bIsEnabled = bool(Helper.getUnoPropertyValue(xRoadmapItem,
PropertyNames.PROPERTY_ENABLED))
return bIsEnabled
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return False
@@ -374,7 +374,7 @@ class WizardDialog(UnoDialog2):
if (self.nNewStep == 0):
self.nNewStep = self.nOldStep
self.switchToStep()
- except Exception, e:
+ except Exception:
traceback.print_exc()
#TODO discuss with rp
@@ -394,7 +394,7 @@ class WizardDialog(UnoDialog2):
self.nNewStep = self.getNextAvailableStep()
if self.nNewStep > -1:
self.switchToStep()
- except Exception, e:
+ except Exception:
traceback.print_exc()
@abstractmethod
@@ -415,7 +415,7 @@ class WizardDialog(UnoDialog2):
if success:
self.removeTerminateListener()
- except Exception, e:
+ except Exception:
traceback.print_exc()
def getMaximalStep(self):
@@ -425,7 +425,7 @@ class WizardDialog(UnoDialog2):
try:
return int(Helper.getUnoPropertyValue(self.xDialogModel,
PropertyNames.PROPERTY_STEP))
- except Exception, exception:
+ except Exception:
traceback.print_exc()
return -1
@@ -478,7 +478,7 @@ class WizardDialog(UnoDialog2):
try:
self.cancelWizard()
self.removeTerminateListener()
- except Exception,e:
+ except Exception:
traceback.print_exc()
def queryTermination(self):
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.py b/wizards/com/sun/star/wizards/ui/event/DataAware.py
index 781dc884031d..bc64aa769831 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/DataAware.py
@@ -79,9 +79,8 @@ class DataAware(object):
if data is not ui:
try:
self.setToUI(data)
- except Exception, ex:
+ except Exception:
traceback.print_exc()
- #TODO tell user...
self.enableControls(data)
'''