[Libreoffice-commits] .: Branch 'libreoffice-4-0' - wizards/com

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Dec 17 00:35:53 PST 2012


 wizards/com/sun/star/wizards/common/FileAccess.py             |   12 -----
 wizards/com/sun/star/wizards/document/OfficeDocument.py       |   21 ++++------
 wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py       |    1 
 wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py |    1 
 4 files changed, 10 insertions(+), 25 deletions(-)

New commits:
commit 6d4a55bf38a1c470c49f904dbbddf94eb2f6154c
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Sun Dec 16 20:04:34 2012 +0100

    pywizards: Fix "Finish Wizard" on Windows
    
    Change-Id: I7ed2cef99e989aba387917fdeb16a82debd1053f
    Reviewed-on: https://gerrit.libreoffice.org/1354
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/wizards/com/sun/star/wizards/common/FileAccess.py b/wizards/com/sun/star/wizards/common/FileAccess.py
index ae31c28..fd7a97c 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 69391bb..1211d0b 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 8bfc6c4..9aa2d72 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 29b802f..5bede1e 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,


More information about the Libreoffice-commits mailing list