[PythonCAD] menu creation via tables?

Art Haas ahaas at airmail.net
Tue Jun 13 02:11:40 CEST 2006


On Mon, Jun 12, 2006 at 05:12:18PM -0400, Russ Nelson wrote:
> Should menus be created via tables?  I suggest this because it will
> reduce the amount of code that people need to read.  The menu creation
> code is very structured.  The reason not to do it is because some day
> a menu entry (e.g. a "Recent Files" menu) may need to be computed
> rather than static.
> 
> I also think (and this is just my opinion) it would be simpler to add
> menu entries if they came from a table.  But, I may be wrong.

The menus in PythonCAD used to be defined in a file called
'Generic/menus.py'. This file contained various lists which were pulled
into 'gtkmenus.py' and used to build the menus. While this approach
worked, it was becoming difficult to handle as more menus were added,
and the switch to using the gtk.Action/gtk.ActionGroup approach
made me scrap the 'menus.py' file.

Much of the menu code is quite repetative, I agree, so there probably
are ways to simplify the code similar to the patch you sent in for
building the various selection menus.

Art
-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822


More information about the PythonCAD mailing list