pywizards: update callRemote methods

Change-Id: Id4a335b19f48738d0f2a02e3660e57701bbc7ef2
This commit is contained in:
Xisco Fauli
2014-01-24 22:40:45 +01:00
parent acdfb25935
commit 574773ac29
14 changed files with 74 additions and 113 deletions

View File

@@ -29,7 +29,6 @@ $(eval $(call gb_Pyuno_add_files,web,wizards/web,\
WWD_General.py \ WWD_General.py \
WWD_Startup.py \ WWD_Startup.py \
WWHID.py \ WWHID.py \
WebWizard.py \
WebWizardConst.py \ WebWizardConst.py \
WebWizardDialog.py \ WebWizardDialog.py \
WebWizardDialogResources.py \ WebWizardDialogResources.py \

View File

@@ -14,6 +14,5 @@ To call a wizard remotely you need to:
-> Launch the wizard from wizards parent folder: -> Launch the wizard from wizards parent folder:
python python
#Fax wizard from wizards.[Wizard's folder].CallWizard import CallWizard
from wizards.fax.FaxWizardDialogImpl import FaxWizardDialogImpl CallWizard.callRemote()
FaxWizardDialogImpl.main()

View File

@@ -53,20 +53,6 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
def leaveStep(self, OldStep, NewStep): def leaveStep(self, OldStep, NewStep):
pass 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): def startWizard(self, xMSF):
self.running = True self.running = True
try: try:

View File

@@ -18,7 +18,7 @@
import unohelper import unohelper
import traceback import traceback
from .AgendaWizardDialogImpl import AgendaWizardDialogImpl from .AgendaWizardDialogImpl import AgendaWizardDialogImpl, Desktop
from com.sun.star.task import XJobExecutor from com.sun.star.task import XJobExecutor
@@ -38,6 +38,20 @@ class CallWizard(unohelper.Base, XJobExecutor):
" message " + str(e) + " args " + str(e.args) + " 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 = 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 # pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper = unohelper.ImplementationHelper() g_ImplementationHelper = unohelper.ImplementationHelper()

View File

@@ -16,7 +16,8 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 . # the License at http://www.apache.org/licenses/LICENSE-2.0 .
# #
import traceback import traceback
#import uno before importing from VclWindowPeerAttribute
import uno
from com.sun.star.awt.VclWindowPeerAttribute import OK from com.sun.star.awt.VclWindowPeerAttribute import OK
class Resource(object): class Resource(object):

View File

@@ -18,7 +18,7 @@
import unohelper import unohelper
import traceback import traceback
from .FaxWizardDialogImpl import FaxWizardDialogImpl from .FaxWizardDialogImpl import FaxWizardDialogImpl, Desktop
from com.sun.star.task import XJobExecutor from com.sun.star.task import XJobExecutor
@@ -36,8 +36,22 @@ class CallWizard(unohelper.Base, XJobExecutor):
except Exception as e: except Exception as e:
print ("Wizard failure exception " + str(type(e)) + print ("Wizard failure exception " + str(type(e)) +
" message " + str(e) + " args " + str(e.args) + " 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 # pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper = unohelper.ImplementationHelper() g_ImplementationHelper = unohelper.ImplementationHelper()

View File

@@ -61,20 +61,6 @@ class FaxWizardDialogImpl(FaxWizardDialog):
self.bSaveSuccess = False self.bSaveSuccess = False
self.filenameChanged = 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): def startWizard(self, xMSF):
self.running = True self.running = True
try: try:

View File

@@ -18,7 +18,7 @@
import unohelper import unohelper
import traceback import traceback
from .LetterWizardDialogImpl import LetterWizardDialogImpl from .LetterWizardDialogImpl import LetterWizardDialogImpl, Desktop
from com.sun.star.task import XJobExecutor from com.sun.star.task import XJobExecutor
@@ -38,6 +38,20 @@ class CallWizard(unohelper.Base, XJobExecutor):
" message " + str(e) + " args " + str(e.args) + " 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 = 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 # pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper = unohelper.ImplementationHelper() g_ImplementationHelper = unohelper.ImplementationHelper()

View File

@@ -67,20 +67,6 @@ class LetterWizardDialogImpl(LetterWizardDialog):
self.BusCompanyAddressReceiver = None self.BusCompanyAddressReceiver = None
self.BusFooter = 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): def startWizard(self, xMSF):
self.running = True self.running = True
try: try:

View File

@@ -59,8 +59,6 @@ class WizardDialog(UnoDialog2):
self.nMaxStep = 1 self.nMaxStep = 1
self.__bTerminateListenermustberemoved = True self.__bTerminateListenermustberemoved = True
self.__oWizardResource = Resource(xMSF, "dbw") self.__oWizardResource = Resource(xMSF, "dbw")
self.sMsgEndAutopilot = self.__oWizardResource.getResText(
UIConsts.RID_DB_COMMON + 33)
self.oRoadmap = None self.oRoadmap = None
self.terminateListener = None self.terminateListener = None

View File

@@ -18,7 +18,8 @@
import unohelper import unohelper
import traceback import traceback
from .WebWizard import WebWizard from .WWD_Events import WWD_Events
from ..common.Desktop import Desktop
from com.sun.star.task import XJobExecutor from com.sun.star.task import XJobExecutor
@@ -31,7 +32,7 @@ class CallWizard(unohelper.Base, XJobExecutor):
def trigger(self, args): def trigger(self, args):
try: try:
ww = WebWizard(self.ctx.ServiceManager) ww = WWD_Events(self.ctx.ServiceManager)
ww.show() ww.show()
ww.cleanup() ww.cleanup()
except Exception as e: except Exception as e:
@@ -39,6 +40,18 @@ class CallWizard(unohelper.Base, XJobExecutor):
" message " + str(e) + " args " + str(e.args) + " message " + str(e) + " args " + str(e.args) +
traceback.format_exc()) 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 # pythonloader looks for a static g_ImplementationHelper variable
g_ImplementationHelper = unohelper.ImplementationHelper() g_ImplementationHelper = unohelper.ImplementationHelper()

View File

@@ -65,18 +65,6 @@ class WWD_Events(WWD_Startup):
self.iconsDialog = None self.iconsDialog = None
self.docPreview = 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): def leaveStep(self, nOldStep, nNewStep):
pass pass

View File

@@ -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())

View File

@@ -31,9 +31,15 @@ class WebWizardDialogResources(Resource):
def __init__(self, xmsf): def __init__(self, xmsf):
super(WebWizardDialogResources,self).__init__(xmsf, super(WebWizardDialogResources,self).__init__(xmsf,
WebWizardDialogResources.MODULE_NAME) WebWizardDialogResources.MODULE_NAME)
self.resbtnDocUp_value = chr(8743) try:
self.resbtnDocDown_value = chr(8744) #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 #Delete the String, uncomment the getResText method
self.resWebWizardDialog_title = self.getResText( self.resWebWizardDialog_title = self.getResText(
WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 1) WebWizardDialogResources.RID_WEBWIZARDDIALOG_START + 1)