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

pywizards: Fix "Finish Wizard" on Windows

Change-Id: I7ed2cef99e989aba387917fdeb16a82debd1053f
üst cc18d924
......@@ -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 "":
......
......@@ -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:
......
......@@ -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.
......
......@@ -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,
......
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