Re: swapping shapes



On Sat, 9 Jun 2012 09:59:12 +0200, vwf <vwf vulkor net> wrote:

On Sat, Jun 09, 2012 at 09:20:41AM +0200, Edheldil wrote:

I compiled 0.97.2 from source but the confuration reported no
Python support
make sure you have python-dev package installed before
configuring/building

Got this part working: Dialog appeared, with "Python Console" and "Dia
Group Properties".  Probably a typo on my side prevented correct
configuration. 

As a first one I tried group-props.py but this script does not work for
me. Is this script working or is it broken?

Don't know.
 
Is there a debug-mechanism for python scripts? 

Well, there's the classic 'print' command. You can place a:

    print "Debug: " + str(variable_of_interest)

anywhere in the script and you'll see the output on the console from
where you've started dia. Also dia will output diagnostics to the
console if it can't execute a script or has any other problems.

In a previous example you asked about how to get started. Here's a
hello world plugin:

   # From http://dia-installer.de/howto/python_win32/index.html
   
   import dia
   
   def hello_callback(data, flags):
      dia.message(2, "Hello, World!\n")
            
   dia.register_callback("Hello World", "<Display>/Tools/Hello",
hello_callback)

also, this post by Hand Breuer was useful for me:

   https://mail.gnome.org/archives/dia-list/2001-July/msg00054.html

When coding python keep the dia class reference handy: Help->PyDia Docs
and Help->Dia Object Types

Mind you, you can test everything interactively first in Dia's python
console, which is very useful.
 
I hope that gets you started. Scripting Dia through the Python console
and plugins is a lot of fun (at least for my taste).

Greets,
*t



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