[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GUI design of 0.7 - one more thing...
From: |
Bernhard Herzog |
Subject: |
Re: GUI design of 0.7 - one more thing... |
Date: |
Mon, 15 Nov 2004 18:32:19 +0100 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
Pieter Edelman <address@hidden> writes:
> Good! Er...how do I get scripts to run in the 0.7 series?
It's similar to 0.6. The following code in ~/.devsketch/userhooks.py
would create a new menu in the context menu called "My Own Menu" with a
command "My Command" that does nothing:
import Sketch
def my_command(context):
pass
Sketch.Editor.Add(Sketch.Editor.Command("my_command", "My Command",
my_command))
Sketch.UI.skapp.main_menu.AddItem(("My Own Menu",), "my_command")
The context parameter to the function implementing the command is
basically the same as in 0.6. The main difference from a script
author's point of view is that Skencil distinguishes between an editor
and the document now. The editor implements the interaction with the
document and manages the selection among other things.
The boiler-plate code at the end to create a command object, add it to
the registry and create a menu item is a bit repetitive but there'll be
more convenience functions later to handle the most common setups.
Bernhard
--
Intevation GmbH http://intevation.de/
Skencil http://skencil.org/
Thuban http://thuban.intevation.org/
- Re: GUI design of 0.7, (continued)
Re: GUI design of 0.7, Joel Biddier, 2004/11/08