[Libreoffice-commits] .: 2 commits - wizards/com

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Dec 16 11:07:41 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 
 wizards/com/sun/star/wizards/text/TextFieldHandler.py         |    8 ++-
 5 files changed, 15 insertions(+), 28 deletions(-)

New commits:
commit ce212151b4ff75c221e7fc7bbd6d146d7f5c6fb6
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

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 8abc1e1..85c49bc 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 e9ace51..7d50619 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,
commit cc18d924d145abab9c503dad68aec3e1afe78786
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Sun Dec 16 18:54:41 2012 +0100

    pywizards: handle UnknownPropertyException
    
    Change-Id: I922d27f584ef39d543ee2bba997680dbea06d95f

diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.py b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
index 9af08be..379abb1 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.py
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.py
@@ -149,7 +149,6 @@ class TextFieldHandler(object):
                 if i.supportsService(
                     "com.sun.star.text.TextField.DateTime"):
                     i.IsFixed = _bSetFixed
-
         except Exception:
             traceback.print_exc()
 
@@ -158,8 +157,11 @@ class TextFieldHandler(object):
         try:
             xDependentTextFields = TextFieldHandler.dictTextFields.values()
             for i in xDependentTextFields:
-                if not i.TextFieldMaster.Content:
-                    i.dispose()
+                try:
+                    if not i.TextFieldMaster.Content:
+                        i.dispose()
+                except UnknownPropertyException:
+                    pass
 
         except Exception:
             traceback.print_exc()


More information about the Libreoffice-commits mailing list