Kaydet (Commit) d03f2be8 authored tarafından Xisco Fauli's avatar Xisco Fauli

pyfax: adapt it to python3.3. it can be already launched

Change-Id: Id0c98e95d6b40dabe0dc07af232bda84989d1815
üst 7ce4ca1c
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 . # the License at http://www.apache.org/licenses/LICENSE-2.0 .
# #
import traceback import traceback
import types
from os import path as osPath from os import path as osPath
from .NoValidPathException import NoValidPathException from .NoValidPathException import NoValidPathException
...@@ -101,9 +100,9 @@ class FileAccess(object): ...@@ -101,9 +100,9 @@ class FileAccess(object):
sPath + "_internal") sPath + "_internal")
Template_user = xPathInterface.getPropertyValue( Template_user = xPathInterface.getPropertyValue(
sPath + "_user") sPath + "_user")
if type(Template_internal) is not types.InstanceType: if not hasattr(Template_internal, '__dict__'):
ReadPaths = ReadPaths + Template_internal 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_user
ReadPaths = ReadPaths + (Template_writable,) ReadPaths = ReadPaths + (Template_writable,)
if sType.lower() == "user": if sType.lower() == "user":
...@@ -125,7 +124,6 @@ class FileAccess(object): ...@@ -125,7 +124,6 @@ class FileAccess(object):
if not bexists: if not bexists:
raise NoValidPathException (xMSF, ""); raise NoValidPathException (xMSF, "");
return ResultPath return ResultPath
@classmethod @classmethod
......
...@@ -20,7 +20,7 @@ class NoValidPathException(Exception): ...@@ -20,7 +20,7 @@ class NoValidPathException(Exception):
def __init__(self, xMSF, _sText): def __init__(self, xMSF, _sText):
super(NoValidPathException,self).__init__(_sText) super(NoValidPathException,self).__init__(_sText)
# TODO: NEVER open a dialog in an exception # TODO: NEVER open a dialog in an exception
from SystemDialog import SystemDialog from .SystemDialog import SystemDialog
if xMSF: if xMSF:
SystemDialog.showErrorBox(xMSF, SystemDialog.showErrorBox(xMSF,
"dbwizres", "dbw", 521) #OfficePathnotavailable "dbwizres", "dbw", 521) #OfficePathnotavailable
......
...@@ -46,7 +46,7 @@ class OfficeDocument(object): ...@@ -46,7 +46,7 @@ class OfficeDocument(object):
@classmethod @classmethod
def attachEventCall(self, xComponent, EventName, EventType, EventURL): def attachEventCall(self, xComponent, EventName, EventType, EventURL):
try: try:
oEventProperties = range(2) oEventProperties = list(range(2))
oEventProperties[0] = uno.createUnoStruct( oEventProperties[0] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue') 'com.sun.star.beans.PropertyValue')
oEventProperties[0].Name = "EventType" oEventProperties[0].Name = "EventType"
...@@ -85,7 +85,7 @@ class OfficeDocument(object): ...@@ -85,7 +85,7 @@ class OfficeDocument(object):
@classmethod @classmethod
def createNewDocument(self, frame, sDocumentType, preview, readonly): def createNewDocument(self, frame, sDocumentType, preview, readonly):
loadValues = range(2) loadValues = list(range(2))
loadValues[0] = uno.createUnoStruct( loadValues[0] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue') 'com.sun.star.beans.PropertyValue')
loadValues[0].Name = "ReadOnly" loadValues[0].Name = "ReadOnly"
...@@ -194,7 +194,7 @@ class OfficeDocument(object): ...@@ -194,7 +194,7 @@ class OfficeDocument(object):
def store(self, xMSF, xComponent, StorePath, FilterName): def store(self, xMSF, xComponent, StorePath, FilterName):
try: try:
if len(FilterName): if len(FilterName):
oStoreProperties = range(2) oStoreProperties = list(range(2))
oStoreProperties[0] = uno.createUnoStruct( oStoreProperties[0] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue') 'com.sun.star.beans.PropertyValue')
oStoreProperties[0].Name = "FilterName" oStoreProperties[0].Name = "FilterName"
...@@ -205,7 +205,7 @@ class OfficeDocument(object): ...@@ -205,7 +205,7 @@ class OfficeDocument(object):
oStoreProperties[1].Value = xMSF.createInstance( oStoreProperties[1].Value = xMSF.createInstance(
"com.sun.star.comp.uui.UUIInteractionHandler") "com.sun.star.comp.uui.UUIInteractionHandler")
else: else:
oStoreProperties = range(0) oStoreProperties = list(range(0))
if StorePath.startswith("file://"): if StorePath.startswith("file://"):
#Unix #Unix
...@@ -260,7 +260,7 @@ class OfficeDocument(object): ...@@ -260,7 +260,7 @@ class OfficeDocument(object):
def getFileMediaDecriptor(self, xmsf, url): def getFileMediaDecriptor(self, xmsf, url):
typeDetect = xmsf.createInstance( typeDetect = xmsf.createInstance(
"com.sun.star.document.TypeDetection") "com.sun.star.document.TypeDetection")
mediaDescr = range(1) mediaDescr = list(range(1))
mediaDescr[0] = uno.createUnoStruct( mediaDescr[0] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue') 'com.sun.star.beans.PropertyValue')
mediaDescr[0].Name = "URL" mediaDescr[0].Name = "URL"
......
...@@ -151,7 +151,6 @@ class FaxWizardDialogImpl(FaxWizardDialog): ...@@ -151,7 +151,6 @@ class FaxWizardDialogImpl(FaxWizardDialog):
try: try:
fileAccess = FileAccess(self.xMSF) fileAccess = FileAccess(self.xMSF)
self.sPath = self.myPathSelection.getSelectedPath() self.sPath = self.myPathSelection.getSelectedPath()
print os.path.exists(self.sPath)
if not self.sPath or not os.path.exists(self.sPath): if not self.sPath or not os.path.exists(self.sPath):
self.myPathSelection.triggerPathPicker() self.myPathSelection.triggerPathPicker()
self.sPath = self.myPathSelection.getSelectedPath() self.sPath = self.myPathSelection.getSelectedPath()
...@@ -184,7 +183,7 @@ class FaxWizardDialogImpl(FaxWizardDialog): ...@@ -184,7 +183,7 @@ class FaxWizardDialogImpl(FaxWizardDialog):
self.saveConfiguration() self.saveConfiguration()
xIH = self.xMSF.createInstance( \ xIH = self.xMSF.createInstance( \
"com.sun.star.comp.uui.UUIInteractionHandler") "com.sun.star.comp.uui.UUIInteractionHandler")
loadValues = range(4) loadValues = list(range(4))
loadValues[0] = uno.createUnoStruct( \ loadValues[0] = uno.createUnoStruct( \
'com.sun.star.beans.PropertyValue') 'com.sun.star.beans.PropertyValue')
loadValues[0].Name = "AsTemplate" loadValues[0].Name = "AsTemplate"
......
...@@ -120,7 +120,7 @@ class TextDocument(object): ...@@ -120,7 +120,7 @@ class TextDocument(object):
self.xProgressBar.setValue(5) self.xProgressBar.setValue(5)
def loadAsPreview(self, sDefaultTemplate, asTemplate): def loadAsPreview(self, sDefaultTemplate, asTemplate):
loadValues = range(3) loadValues = list(range(3))
# open document in the Preview mode # open document in the Preview mode
loadValues[0] = uno.createUnoStruct( loadValues[0] = uno.createUnoStruct(
'com.sun.star.beans.PropertyValue') 'com.sun.star.beans.PropertyValue')
...@@ -244,7 +244,7 @@ class TextDocument(object): ...@@ -244,7 +244,7 @@ class TextDocument(object):
auxList = [] auxList = []
allItems = self.xTextDocument.findAll(sd) allItems = self.xTextDocument.findAll(sd)
for i in xrange(allItems.Count): for i in range(allItems.Count):
auxList.append(allItems.getByIndex(i)) auxList.append(allItems.getByIndex(i))
return auxList return auxList
...@@ -161,7 +161,7 @@ class WizardDialog(UnoDialog2): ...@@ -161,7 +161,7 @@ class WizardDialog(UnoDialog2):
def getRoadmapItemByID(self, _ID): def getRoadmapItemByID(self, _ID):
try: try:
getByIndex = self.oRoadmap.getByIndex getByIndex = self.oRoadmap.getByIndex
for i in xrange(self.oRoadmap.Count): for i in range(self.oRoadmap.Count):
CurRoadmapItem = getByIndex(i) CurRoadmapItem = getByIndex(i)
CurID = int(Helper.getUnoPropertyValue(CurRoadmapItem, "ID")) CurID = int(Helper.getUnoPropertyValue(CurRoadmapItem, "ID"))
if CurID == _ID: if CurID == _ID:
...@@ -339,7 +339,7 @@ class WizardDialog(UnoDialog2): ...@@ -339,7 +339,7 @@ class WizardDialog(UnoDialog2):
def enablefromStep(self, _iStep, _bDoEnable): def enablefromStep(self, _iStep, _bDoEnable):
if _iStep <= self.nMaxStep: if _iStep <= self.nMaxStep:
for i in xrange(_iStep, self.nMaxStep): for i in range(_iStep, self.nMaxStep):
self.setStepEnabled(i, _bDoEnable) self.setStepEnabled(i, _bDoEnable)
enableFinishButton(_bDoEnable) enableFinishButton(_bDoEnable)
if not _bDoEnable: if not _bDoEnable:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment