def testMessageBox(self):
        msgbox = messagebox.MessageBox(self.unoObjs)
        displayText = "Hello there\n\n\tHow are you?\nFine, thank you\t"
        displayTitle = "An unimportant testing message"
        with self.assertRaises(testutil.MsgSentException) as contextMgr:
            msgbox.display(displayText, title=displayTitle)
        self.assertEqual(contextMgr.exception.msg, displayText)

        # The constructor should fail if we don't pass any unoObjs.
        self.assertRaises(AttributeError, messagebox.MessageBox, None)
Exemplo n.º 2
0
def aaa_del_sys_modules(dummy_int=0):
    """Normally it is necessary to restart Office in order to reload modules.
    To make a change to a lingt module without restarting, do the following:
    1. Run this function.
    2. Make the desired change to a module in lingt.
    [3. Make an arbitrary change to this file to cause it to reload.
        Running build/deploy_to_userdir.ps1 will update the modified timestamp,
        which makes it so that this step is not necessary.]
    (Steps 1-3 can be done in any order).
    4. Run build/deploy_to_userdir.ps1 to deploy the changes.
    5. Run the component again, which will now use the new changes.

    Note: "aaa_" prefix is just to move it up in the alphabetical list.
    """
    logManager.spacer()
    modules_count = 0
    for mod in list(sys.modules):
        if mod.startswith('lingt.') or mod.startswith('lingttest.'):
            del sys.modules[mod]
            modules_count += 1
    ctx = uno.getComponentContext()
    uno_objs = util.UnoObjs(ctx, util.UnoObjs.DOCTYPE_GENERIC)
    msgbox = messagebox.MessageBox(uno_objs)
    msgbox.display("Deleted " + str(modules_count) + " modules.")
Exemplo n.º 3
0
def aab_disp_sys_modules(dummy_int=0):
    logManager.spacer()
    ctx = uno.getComponentContext()
    uno_objs = util.UnoObjs(ctx)
    msgbox = messagebox.MessageBox(uno_objs)
    msgbox.display(sorted(sys.modules.keys()))