[Libreoffice-commits] core.git: wizards/com wizards/Pyuno_web.mk

Xisco Fauli anistenis at gmail.com
Fri Jan 24 13:52:12 PST 2014


 wizards/Pyuno_web.mk                                          |    1 
 wizards/com/sun/star/wizards/README                           |    5 -
 wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py |   14 ---
 wizards/com/sun/star/wizards/agenda/CallWizard.py             |   16 +++
 wizards/com/sun/star/wizards/common/Resource.py               |    3 
 wizards/com/sun/star/wizards/fax/CallWizard.py                |   18 +++-
 wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py       |   14 ---
 wizards/com/sun/star/wizards/letter/CallWizard.py             |   16 +++
 wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py |   14 ---
 wizards/com/sun/star/wizards/ui/WizardDialog.py               |    2 
 wizards/com/sun/star/wizards/web/CallWizard.py                |   17 +++
 wizards/com/sun/star/wizards/web/WWD_Events.py                |   12 --
 wizards/com/sun/star/wizards/web/WebWizard.py                 |   43 ----------
 wizards/com/sun/star/wizards/web/WebWizardDialogResources.py  |   12 ++
 14 files changed, 74 insertions(+), 113 deletions(-)

New commits:
commit 574773ac298153b97237b3432b601a83938eaf6b
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Fri Jan 24 22:40:45 2014 +0100

    pywizards: update callRemote methods
    
    Change-Id: Id4a335b19f48738d0f2a02e3660e57701bbc7ef2

diff --git a/wizards/Pyuno_web.mk b/wizards/Pyuno_web.mk
index 6b56a4d..a8e1519 100644
--- a/wizards/Pyuno_web.mk
+++ b/wizards/Pyuno_web.mk
@@ -29,7 +29,6 @@ $(eval $(call gb_Pyuno_add_files,web,wizards/web,\
 	WWD_General.py \
 	WWD_Startup.py \
 	WWHID.py \
-	WebWizard.py \
 	WebWizardConst.py \
 	WebWizardDialog.py \
 	WebWizardDialogResources.py \
diff --git a/wizards/com/sun/star/wizards/README b/wizards/com/sun/star/wizards/README
index 473282f..c0351e9 100644
--- a/wizards/com/sun/star/wizards/README
+++ b/wizards/com/sun/star/wizards/README
@@ -14,6 +14,5 @@ To call a wizard remotely you need to:
       
 -> Launch the wizard from wizards parent folder:
     python
-    #Fax wizard
-    from wizards.fax.FaxWizardDialogImpl import FaxWizardDialogImpl
-    FaxWizardDialogImpl.main()
+    from wizards.[Wizard's folder].CallWizard import CallWizard
+    CallWizard.callRemote()
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
index 8b21e7e..014159e 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
@@ -53,20 +53,6 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
     def leaveStep(self, OldStep, NewStep):
         pass
 
-    @classmethod
-    def main(self):
-        #Call the wizard remotely(see README)
-        try:
-            ConnectStr = \
-                "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
-            xLocMSF = Desktop.connect(ConnectStr)
-            lw = AgendaWizardDialogImpl(xLocMSF)
-            lw.startWizard(xLocMSF)
-        except Exception as e:
-            print ("Wizard failure exception " + str(type(e)) +
-                   " message " + str(e) + " args " + str(e.args) +
-                   traceback.format_exc())
-
     def startWizard(self, xMSF):
         self.running = True
         try:
diff --git a/wizards/com/sun/star/wizards/agenda/CallWizard.py b/wizards/com/sun/star/wizards/agenda/CallWizard.py
index 5c76249..9ca75f1 100644
--- a/wizards/com/sun/star/wizards/agenda/CallWizard.py
+++ b/wizards/com/sun/star/wizards/agenda/CallWizard.py
@@ -18,7 +18,7 @@
 import unohelper
 import traceback
 
-from .AgendaWizardDialogImpl import AgendaWizardDialogImpl
+from .AgendaWizardDialogImpl import AgendaWizardDialogImpl, Desktop
 
 from com.sun.star.task import XJobExecutor
 
@@ -38,6 +38,20 @@ class CallWizard(unohelper.Base, XJobExecutor):
                    " message " + str(e) + " args " + str(e.args) +
                    traceback.format_exc())
 
+    @classmethod
+    def callRemote(self):
+        #Call the wizard remotely(see README)
+        try:
+            ConnectStr = \
+                "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
+            xLocMSF = Desktop.connect(ConnectStr)
+            lw = AgendaWizardDialogImpl(xLocMSF)
+            lw.startWizard(xLocMSF)
+        except Exception as e:
+            print ("Wizard failure exception " + str(type(e)) +
+                   " message " + str(e) + " args " + str(e.args) +
+                   traceback.format_exc())
+
 # pythonloader looks for a static g_ImplementationHelper variable
 g_ImplementationHelper = unohelper.ImplementationHelper()
 
diff --git a/wizards/com/sun/star/wizards/common/Resource.py b/wizards/com/sun/star/wizards/common/Resource.py
index e35820c..472f054 100644
--- a/wizards/com/sun/star/wizards/common/Resource.py
+++ b/wizards/com/sun/star/wizards/common/Resource.py
@@ -16,7 +16,8 @@
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 #
 import traceback
-
+#import uno before importing from VclWindowPeerAttribute
+import uno
 from com.sun.star.awt.VclWindowPeerAttribute import OK
 
 class Resource(object):
diff --git a/wizards/com/sun/star/wizards/fax/CallWizard.py b/wizards/com/sun/star/wizards/fax/CallWizard.py
index b779885..f9f07ff 100644
--- a/wizards/com/sun/star/wizards/fax/CallWizard.py
+++ b/wizards/com/sun/star/wizards/fax/CallWizard.py
@@ -18,7 +18,7 @@
 import unohelper
 import traceback
 
-from .FaxWizardDialogImpl import FaxWizardDialogImpl
+from .FaxWizardDialogImpl import FaxWizardDialogImpl, Desktop
 
 from com.sun.star.task import XJobExecutor
 
@@ -36,8 +36,22 @@ class CallWizard(unohelper.Base, XJobExecutor):
         except Exception as e:
             print ("Wizard failure exception " + str(type(e)) +
                    " message " + str(e) + " args " + str(e.args) +
-                   traceback.format_exc())
+                   traceback.format_exc())              
 
+    @classmethod
+    def callRemote(self):
+        #Call the wizard remotely(see README)
+        try:
+            ConnectStr = \
+                "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
+            xLocMSF = Desktop.connect(ConnectStr)
+            lw = FaxWizardDialogImpl(xLocMSF)
+            lw.startWizard(xLocMSF)
+        except Exception as e:
+            print ("Wizard failure exception " + str(type(e)) +
+                   " message " + str(e) + " args " + str(e.args) +
+                   traceback.format_exc())
+                   
 # pythonloader looks for a static g_ImplementationHelper variable
 g_ImplementationHelper = unohelper.ImplementationHelper()
 
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
index bbc281c..a2c3f67 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.py
@@ -61,20 +61,6 @@ class FaxWizardDialogImpl(FaxWizardDialog):
         self.bSaveSuccess = False
         self.filenameChanged = False
 
-    @classmethod
-    def main(self):
-        #Call the wizard remotely(see README)
-        try:
-            ConnectStr = \
-                "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
-            xLocMSF = Desktop.connect(ConnectStr)
-            lw = FaxWizardDialogImpl(xLocMSF)
-            lw.startWizard(xLocMSF)
-        except Exception as e:
-            print ("Wizard failure exception " + str(type(e)) +
-                   " message " + str(e) + " args " + str(e.args) +
-                   traceback.format_exc())
-
     def startWizard(self, xMSF):
         self.running = True
         try:
diff --git a/wizards/com/sun/star/wizards/letter/CallWizard.py b/wizards/com/sun/star/wizards/letter/CallWizard.py
index f2b071e..52b274e 100644
--- a/wizards/com/sun/star/wizards/letter/CallWizard.py
+++ b/wizards/com/sun/star/wizards/letter/CallWizard.py
@@ -18,7 +18,7 @@
 import unohelper
 import traceback
 
-from .LetterWizardDialogImpl import LetterWizardDialogImpl
+from .LetterWizardDialogImpl import LetterWizardDialogImpl, Desktop
 
 from com.sun.star.task import XJobExecutor
 
@@ -38,6 +38,20 @@ class CallWizard(unohelper.Base, XJobExecutor):
                    " message " + str(e) + " args " + str(e.args) +
                    traceback.format_exc())
 
+    @classmethod
+    def callRemote(self):
+        #Call the wizard remotely(see README)
+        try:
+            ConnectStr = \
+                "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
+            xLocMSF = Desktop.connect(ConnectStr)
+            lw = LetterWizardDialogImpl(xLocMSF)
+            lw.startWizard(xLocMSF)
+        except Exception as e:
+            print ("Wizard failure exception " + str(type(e)) +
+                   " message " + str(e) + " args " + str(e.args) +
+                   traceback.format_exc())
+                   
 # pythonloader looks for a static g_ImplementationHelper variable
 g_ImplementationHelper = unohelper.ImplementationHelper()
 
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
index 6560e52..879a4d3 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.py
@@ -67,20 +67,6 @@ class LetterWizardDialogImpl(LetterWizardDialog):
         self.BusCompanyAddressReceiver = None
         self.BusFooter = None
 
-    @classmethod
-    def main(self):
-        #Call the wizard remotely(see README)
-        try:
-            ConnectStr = \
-                "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
-            xLocMSF = Desktop.connect(ConnectStr)
-            lw = LetterWizardDialogImpl(xLocMSF)
-            lw.startWizard(xLocMSF)
-        except Exception as e:
-            print ("Wizard failure exception " + str(type(e)) +
-                   " message " + str(e) + " args " + str(e.args) +
-                   traceback.format_exc())
-
     def startWizard(self, xMSF):
         self.running = True
         try:
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.py b/wizards/com/sun/star/wizards/ui/WizardDialog.py
index cd1d921..fdc1bc0 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.py
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.py
@@ -59,8 +59,6 @@ class WizardDialog(UnoDialog2):
         self.nMaxStep = 1
         self.__bTerminateListenermustberemoved = True
         self.__oWizardResource = Resource(xMSF, "dbw")
-        self.sMsgEndAutopilot = self.__oWizardResource.getResText(
-            UIConsts.RID_DB_COMMON + 33)
         self.oRoadmap = None
         self.terminateListener = None
 
diff --git a/wizards/com/sun/star/wizards/web/CallWizard.py b/wizards/com/sun/star/wizards/web/CallWizard.py
index 1a98a31..2f199f5 100644
--- a/wizards/com/sun/star/wizards/web/CallWizard.py
+++ b/wizards/com/sun/star/wizards/web/CallWizard.py
@@ -18,7 +18,8 @@
 import unohelper
 import traceback
 
-from .WebWizard import WebWizard
+from .WWD_Events import WWD_Events
+from ..common.Desktop import Desktop
 
 from com.sun.star.task import XJobExecutor
 
@@ -31,7 +32,7 @@ class CallWizard(unohelper.Base, XJobExecutor):
 
     def trigger(self, args):
         try:
-            ww = WebWizard(self.ctx.ServiceManager)
+            ww = WWD_Events(self.ctx.ServiceManager)
             ww.show()
             ww.cleanup()
         except Exception as e:
@@ -39,6 +40,18 @@ class CallWizard(unohelper.Base, XJobExecutor):
                    " message " + str(e) + " args " + str(e.args) +
                    traceback.format_exc())
 
+    @classmethod
+    def callRemote(self):
+        ConnectStr = \
+            "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
+        try:
+            xmsf = Desktop.connect(ConnectStr)
+            ww = WWD_Events(xmsf)
+            ww.show()
+            ww.cleanup()
+        except Exception:
+            traceback.print_exc()
+
 # pythonloader looks for a static g_ImplementationHelper variable
 g_ImplementationHelper = unohelper.ImplementationHelper()
 
diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.py b/wizards/com/sun/star/wizards/web/WWD_Events.py
index d9ceec7..72b393e 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Events.py
+++ b/wizards/com/sun/star/wizards/web/WWD_Events.py
@@ -65,18 +65,6 @@ class WWD_Events(WWD_Startup):
         self.iconsDialog = None
         self.docPreview = None
 
-    @classmethod
-    def main(self, args):
-        ConnectStr = \
-            "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
-        try:
-            xmsf = Desktop.connect(ConnectStr)
-            ww = WWD_Events(xmsf)
-            ww.show()
-            ww.cleanup()
-        except Exception:
-            traceback.print_exc()
-
     def leaveStep(self, nOldStep, nNewStep):
         pass
 
diff --git a/wizards/com/sun/star/wizards/web/WebWizard.py b/wizards/com/sun/star/wizards/web/WebWizard.py
deleted file mode 100644
index a576ea8..0000000
--- a/wizards/com/sun/star/wizards/web/WebWizard.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-#   Licensed to the Apache Software Foundation (ASF) under one or more
-#   contributor license agreements. See the NOTICE file distributed
-#   with this work for additional information regarding copyright
-#   ownership. The ASF licenses this file to you under the Apache
-#   License, Version 2.0 (the "License"); you may not use this file
-#   except in compliance with the License. You may obtain a copy of
-#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-import traceback
-
-from ..common.Desktop import Desktop
-from .WWD_Events import WWD_Events
-
-# The last class in the WebWizard Dialog class hirarchy.
-# Has no functionality, is just nice to have it instanciated.
-class WebWizard(WWD_Events):
-
-    def __init__(self, xmsf):
-        super(WebWizard, self).__init__(xmsf)
-
-    @classmethod
-    def main(self):
-        #Call the wizard remotely(see README)
-        try:
-            ConnectStr = \
-                "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
-            xLocMSF = Desktop.connect(ConnectStr)
-            ww = WebWizard(xLocMSF)
-            ww.show()
-            ww.cleanup()
-        except Exception as e:
-            print ("Wizard failure exception " + str(type(e)) +
-                   " message " + str(e) + " args " + str(e.args) +
-                   traceback.format_exc())
diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialogResources.py b/wizards/com/sun/star/wizards/web/WebWizardDialogResources.py
index ea45660..4d851b2 100644
--- a/wizards/com/sun/star/wizards/web/WebWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/web/WebWizardDialogResources.py
@@ -31,9 +31,15 @@ class WebWizardDialogResources(Resource):
     def __init__(self, xmsf):
         super(WebWizardDialogResources,self).__init__(xmsf,
             WebWizardDialogResources.MODULE_NAME)
-        self.resbtnDocUp_value = chr(8743)
-        self.resbtnDocDown_value = chr(8744)
-
+        try:
+            #python 3
+            self.resbtnDocUp_value = chr(8743)
+            self.resbtnDocDown_value = chr(8744)
+        except ValueError:
+            #python 2
+            self.resbtnDocUp_value = unichr(8743)
+            self.resbtnDocDown_value = unichr(8744) 
+                    
         #Delete the String, uncomment the getResText method
         self.resWebWizardDialog_title = self.getResText(
             WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 1)


More information about the Libreoffice-commits mailing list