Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi Timo,

On Sat, 2011-04-09 at 02:22 +0200, Timo wrote:
Is there a way to test the pythonfile within office? At the moment each
time i kill soffice, restart writer and click

        So - after a bit more digging; I got to here:

class MessageBox:
    def __init__(self, XParentWindow):
        try:
            if XParentWindow is None:
                frame = XSCRIPTCONTEXT.getDesktop().getCurrentFrame()
                XParentWindow = frame.getContainerWindow()
            self.Parent = XParentWindow
            self.Toolkit = XParentWindow.getToolkit()
        except:
            raise AttributeError, 'Did not get a valid parent window'

    def msgbox(self, message='', flag=0, title=''):
        '''Wrapper for com.sun.star.awt.XMessageBoxFactory.'''
        rect = uno.createUnoStruct('com.sun.star.awt.Rectangle')
        dlg = self.Toolkit.createMessageBox(self.Parent, rect, "errorbox", 1, title, message)
        dlg.execute()


        Which at least works for me, though I couldn't see why the
com.sun.star.awt.MessageBoxButtons set of constants wouldn't work nicely
for me.

        When I whack that into my system's TableSample.py and add:

    box = MessageBox(None)
    box.msgbox ("What is this ?")

        to createTable() - I get a nice message-box first :-) I bound running
that macro to F4 to make it quicker to loop iterate / check the code
 
        The UNO API is pretty fearsome to use, it can help to read the
interface comments in offapi/ but it is not for the faint hearted,
clearly :-)

        I guess, seeing how broken the C++ side is - with helpful comments
like:

    if(!bIsLoggedIn)
    {
        OSL_FAIL("create error message");
        return;
    }

        that simply don't create an error message, or do anything useful -
perhaps a chunk of the work needed is on the C++ side anyway.

        HTH,

                Michael.

-- 
 michael.meeks@novell.com  <><, Pseudo Engineer, itinerant idiot


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.