summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2012-12-16 20:04:34 +0100
committerXisco Fauli <anistenis@gmail.com>2012-12-16 20:06:45 +0100
commitce212151b4ff75c221e7fc7bbd6d146d7f5c6fb6 (patch)
treec041d0f27df9291dbf7aab6fa096b009aca2bdd2 /wizards
parentcc18d924d145abab9c503dad68aec3e1afe78786 (diff)
pywizards: Fix "Finish Wizard" on Windows
Change-Id: I7ed2cef99e989aba387917fdeb16a82debd1053f
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/common/FileAccess.py12
-rw-r--r--wizards/com/sun/star/wizards/document/OfficeDocument.py21
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py1
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py1
4 files changed, 10 insertions, 25 deletions
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py
index ae31c282a442..fd7a97cd9ca5 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
-from os import path as osPath
from .NoValidPathException import NoValidPathException
from com.sun.star.ucb import CommandAbortedException
@@ -213,17 +212,6 @@ class FileAccess(object):
return sTitle
- def getURL(self, path, childPath=None):
- try:
- f = open(path, 'w')
-
- r = self.filenameConverter.getFileURLFromSystemPath(path,
- osPath.abspath(path))
- return r
- except Exception:
- traceback.print_exc()
- return None
-
def getPath(self, parentURL, childURL):
string = ""
if childURL is not None and childURL is not "":
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.py b/wizards/com/sun/star/wizards/document/OfficeDocument.py
index 8abc1e1bfbf7..85c49bc4c2ff 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.py
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.py
@@ -17,7 +17,7 @@
#
import uno
import traceback
-import unohelper
+from unohelper import absolutize, systemPathToFileUrl
from ..ui.event.CommonListener import TerminateListenerProcAdapter
from ..common.Desktop import Desktop
@@ -105,7 +105,7 @@ class OfficeDocument(object):
xComponent = None
try:
xComponent = frame.loadComponentFromURL(
- sURL, "_self", 0, tuple(loadValues))
+ systemPathToFileUrl(sURL), "_self", 0, tuple(loadValues))
except Exception:
traceback.print_exc()
@@ -183,6 +183,8 @@ class OfficeDocument(object):
def load(self, xInterface, sURL, sFrame, xValues):
xComponent = None
try:
+ if not sURL.startswith("file://"):
+ sURL = systemPathToFileUrl(sURL)
xComponent = xInterface.loadComponentFromURL(
sURL, sFrame, 0, tuple(xValues))
except Exception:
@@ -205,21 +207,18 @@ class OfficeDocument(object):
oStoreProperties[1].Value = xMSF.createInstance(
"com.sun.star.comp.uui.UUIInteractionHandler")
else:
- oStoreProperties = list(range(0))
-
- if StorePath.startswith("file://"):
- #Unix
- StorePath = StorePath[7:]
+ oStoreProperties = list(range(0))
sPath = StorePath[:(StorePath.rfind("/") + 1)]
sFile = StorePath[(StorePath.rfind("/") + 1):]
xComponent.storeToURL(
- unohelper.absolutize(
- unohelper.systemPathToFileUrl(sPath),
- unohelper.systemPathToFileUrl(sFile)),
- tuple(oStoreProperties))
+ absolutize(systemPathToFileUrl(sPath), sFile),
+ tuple(oStoreProperties))
return True
except ErrorCodeIOException:
+ #Throw this exception when trying to save a file
+ #which is already opened in Libreoffice
+ #TODO: handle it properly
return True
pass
except Exception:
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index 8bfc6c47eb84..9aa2d7270b4e 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -155,7 +155,6 @@ class FaxWizardDialogImpl(FaxWizardDialog):
self.myPathSelection.triggerPathPicker()
self.sPath = self.myPathSelection.getSelectedPath()
- self.sPath = fileAccess.getURL(self.sPath)
#first, if the filename was not changed, thus
#it is coming from a saved session, check if the
# file exists and warn the user.
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index e9ace51b5bd9..7d5061966b6f 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -173,7 +173,6 @@ class LetterWizardDialogImpl(LetterWizardDialog):
self.myPathSelection.triggerPathPicker()
self.sPath = self.myPathSelection.getSelectedPath()
- self.sPath = fileAccess.getURL(self.sPath)
if not self.filenameChanged:
answer = SystemDialog.showMessageBox(
self.xMSF, "MessBox", YES_NO + DEF_NO,