From 574773ac298153b97237b3432b601a83938eaf6b Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 24 Jan 2014 22:40:45 +0100 Subject: pywizards: update callRemote methods Change-Id: Id4a335b19f48738d0f2a02e3660e57701bbc7ef2 --- wizards/Pyuno_web.mk | 1 - wizards/com/sun/star/wizards/README | 5 +-- .../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 ++++++++- .../sun/star/wizards/fax/FaxWizardDialogImpl.py | 14 ------- wizards/com/sun/star/wizards/letter/CallWizard.py | 16 +++++++- .../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 ---------------------- .../star/wizards/web/WebWizardDialogResources.py | 12 ++++-- 14 files changed, 74 insertions(+), 113 deletions(-) delete mode 100644 wizards/com/sun/star/wizards/web/WebWizard.py (limited to 'wizards') diff --git a/wizards/Pyuno_web.mk b/wizards/Pyuno_web.mk index 6b56a4db76a9..a8e15194555a 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 473282f17dc8..c0351e910ce0 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 8b21e7eb754e..014159e9eaf2 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 5c76249d4c7f..9ca75f1a6b81 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 e35820cf5d8f..472f0543e7e2 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 b779885622a7..f9f07ff21ac8 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 bbc281cce9bc..a2c3f67abac3 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 f2b071e0cd1c..52b274e7de70 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 6560e52726d0..879a4d30fb2f 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 cd1d9217159f..fdc1bc07d852 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 1a98a313d83c..2f199f5516c5 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 d9ceec7e944e..72b393ec69f8 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 a576ea812319..000000000000 --- 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 ea456600b35a..4d851b246b0d 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) -- cgit