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_Startup.py \
WWHID.py \
WebWizard.py \
WebWizardConst.py \
WebWizardDialog.py \
WebWizardDialogResources.py \

View File

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

View File

@@ -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:

View File

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

View File

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

View File

@@ -18,7 +18,7 @@
import unohelper
import traceback
from .FaxWizardDialogImpl import FaxWizardDialogImpl
from .FaxWizardDialogImpl import FaxWizardDialogImpl, 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 = 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()

View File

@@ -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:

View File

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

View File

@@ -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:

View File

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

View File

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

View File

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

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,8 +31,14 @@ 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(