From 4e63e4ba815ea61d0d4c28dae0117ce9890e2b5e Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 29 Oct 2012 20:16:52 +0100 Subject: pyagenda: Add callwizard Change-Id: Icbceb222d400652f4e8757a9aa2967bee60bc09e --- .../com/sun/star/wizards/agenda/AgendaTemplate.py | 1 - .../star/wizards/agenda/AgendaWizardDialogImpl.py | 8 ++-- wizards/com/sun/star/wizards/agenda/CallWizard.py | 50 ++++++++++++++++++++++ 3 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 wizards/com/sun/star/wizards/agenda/CallWizard.py (limited to 'wizards') diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py index ce0a3fe212f3..bb85bcc3b484 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py +++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py @@ -21,7 +21,6 @@ from threading import RLock from ..text.TextDocument import * from ..common.FileAccess import FileAccess from ..text.TextSectionHandler import TextSectionHandler -from .TopicsControl import TopicsControl from datetime import date as dateTimeObject diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py index 73e47c4b6fb5..e1e07655e7f5 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py @@ -18,8 +18,9 @@ import traceback from .AgendaWizardDialog import AgendaWizardDialog from .AgendaWizardDialogConst import HID -from .AgendaTemplate import AgendaTemplate, TopicsControl, FileAccess -from CGAgenda import CGAgenda +from .AgendaTemplate import AgendaTemplate, FileAccess +from .TopicsControl import TopicsControl +from .CGAgenda import CGAgenda from ..ui.PathSelection import PathSelection from ..ui.event.UnoDataAware import UnoDataAware from ..ui.event.RadioDataAware import RadioDataAware @@ -48,7 +49,6 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): def leaveStep(self, OldStep, NewStep): pass - @classmethod def main(self): #Call the wizard remotely(see README) @@ -63,7 +63,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): " message " + str(e) + " args " + str(e.args) + traceback.format_exc()) - def startWizard(self): + def startWizard(self, xMSF): self.running = True try: #Number of steps on WizardDialog diff --git a/wizards/com/sun/star/wizards/agenda/CallWizard.py b/wizards/com/sun/star/wizards/agenda/CallWizard.py new file mode 100644 index 000000000000..5c76249d4c7f --- /dev/null +++ b/wizards/com/sun/star/wizards/agenda/CallWizard.py @@ -0,0 +1,50 @@ +# +# 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 unohelper +import traceback + +from .AgendaWizardDialogImpl import AgendaWizardDialogImpl + +from com.sun.star.task import XJobExecutor + +# implement a UNO component by deriving from the standard unohelper.Base class +# and from the interface(s) you want to implement. +class CallWizard(unohelper.Base, XJobExecutor): + def __init__(self, ctx): + # store the component context for later use + self.ctx = ctx + + def trigger(self, args): + try: + fw = AgendaWizardDialogImpl(self.ctx.ServiceManager) + fw.startWizard(self.ctx.ServiceManager) + 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() + +g_ImplementationHelper.addImplementation( \ + CallWizard, # UNO object class + "com.sun.star.wizards.agenda.CallWizard", # implemenation name + ("com.sun.star.task.Job",),) # list of implemented services + # (the only service) + +# vim:set shiftwidth=4 softtabstop=4 expandtab: -- cgit