How do I use dia.message() to indicate different messages?



Hi -

Whenever I try to use dia.message() in a python plug-in, it seems to 'latch' on the first message.



I've installed the following two python scripts into the .dia/python directory and then started up Dia 0.97.2:

hello.py:
----------------------------------------------------------------------------
import dia

def hello_callback(data, flags):
    dia.message(2, "Hello, World")

dia.register_callback("Hello World", "<Display>/Tools/Hello", hello_callback)
----------------------------------------------------------------------------

and goodbye.py:
----------------------------------------------------------------------------
import dia

def goodbye_callback(data, flags):
    dia.message(1, "Goodbye, Cruel World")

dia.register_callback(
    "Goodbye World", "<Display>/Tools/Goodbye", goodbye_callback)
----------------------------------------------------------------------------

When I start up Dia, the two commands show up in the Tools directory.  So far, so good.


If I run the 'Hello World' command I see the expected message "Hello, World" pop up in a box.  
But if I then dismiss the "Hello World" message box (by hitting the Close button) and run the "Goodbye World"
command, I see a box which says "Hello, World" and some additional things:  "There is one similar message." 
and a pair of checkboxes ("Show repeated messages" and "Don't show this message again." in addition to 
the expected Close button.  Not the "Goodbye, Cruel World" message I was expecting.

If I restart Dia and run the commands in the reverse order, it's the "Goodbye, Cruel World" message that gets "latched" and displays even if I run the "Hello World" command.

I see this behavior on both Windows7 (with Python 2.3.5) and Linux (with Python 2.7.3), so I'm guessing that it's not an OS-specific or python-version-specific thing.

Am I missing something in how dia.message() works?  (Some kind of 'flush' or 'reset'?)  How do I pop up different messages?

Thanks!

Dan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]