From ecd6dd04b6a3241aeaffbad4e0d7664e63115564 Mon Sep 17 00:00:00 2001 From: Stephen Watson Date: Sat, 5 Nov 2005 12:00:30 +0000 Subject: [PATCH] Changed the doc string in Menu.py to prefer the new MenuItem based method of defining menus not the old tuple method (Stephen Watson). git-svn-id: https://rox.svn.sourceforge.net/svnroot/rox/trunk/ROX-Lib2@4217 66de3db3-b00d-0410-b41b-f4738ad19bea --- Help/Changes | 5 +++++ python/rox/Menu.py | 41 +++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/Help/Changes b/Help/Changes index 2a33fd6..61d265d 100644 --- a/Help/Changes +++ b/Help/Changes @@ -3,6 +3,11 @@ by Thomas Leonard http://rox.sourceforge.net +05-Nov-2005 +~~~~~~~~~~~ +Changed the doc string in Menu.py to prefer the new MenuItem based method +of defining menus not the old tuple method (Stephen Watson). + 22-Oct-2005 ~~~~~~~~~~~ Added Hungarian translation (Andras Mohari). diff --git a/python/rox/Menu.py b/python/rox/Menu.py index 628c8c9..ea24dc2 100644 --- a/python/rox/Menu.py +++ b/python/rox/Menu.py @@ -4,32 +4,33 @@ each Menu once, and attach it to windows as required. Example: -from rox.Menu import Menu, set_save_name +from rox.Menu import Menu, set_save_name, Action, Separator, SubMenu set_save_name('Edit') menu = Menu('main', [ - ('/File', '', ''), - ('/File/Save', 'save', ''), - ('/File/Open Parent', 'up', ''), - ('/File/Close', 'close', ''), - ('/File/', '', ''), - ('/File/New', 'new', ''), - ('/Edit', '', ''), - ('/Edit/Undo', 'undo', ''), - ('/Edit/Redo', 'redo', ''), - ('/Edit/', '', ''), - ('/Edit/Search...', 'search', ''), - ('/Edit/Goto line...', 'goto', ''), - ('/Edit/', '', ''), - ('/Edit/Process...', 'process', ''), - ('/Options', 'show_options', ''), - ('/Help', 'help', '', 'F1', g.STOCK_HELP), + SubMenu('File', Menu([ + Action('Save', 'save'), + Action('Open Parent', 'up'), + Action('Close', 'close'), + Separator(), + Action('New', 'new') + ])), + SubMenu('/Edit', Menu([ + Action('Undo', 'undo'), + Action('Redo', 'redo'), + Separator(), + Action('Search...', 'search'), + Action('Goto line...', 'goto'), + Separator(), + Action('Process...', 'process'), + ])), + Action('Options', 'show_options'), + Action('Quit', 'show_options', 'F1', stock=g.STOCK_HELP), ]) -There is also a new syntax, supported from 1.9.13, where you pass instances of MenuItem -instead of tuples to the Menu constructor. Be sure to require version 1.9.13 if -using this feature. +There is also an older syntax, where you pass tuples of strings +to the Menu constructor. This has not been required since 1.9.13. """ from __future__ import generators -- 2.11.4.GIT