[Python-checkins] python/dist/src/Mac/Lib FrameWork.py,1.49,1.50
jackjansen@users.sourceforge.net
jackjansen@users.sourceforge.net
Thu, 29 Aug 2002 15:04:18 -0700
- Previous message: [Python-checkins] python/dist/src/Mac/Modules/help _Helpmodule.c,1.6,1.7 helpscan.py,1.6,1.7 helpsupport.py,1.5,1.6
- Next message: [Python-checkins] python/nondist/peps pep-0256.txt,1.3,1.4 pep-0257.txt,1.5,1.6 pep-0258.txt,1.3,1.4 pep-0287.txt,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Mac/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv22648
Modified Files:
FrameWork.py
Log Message:
Added support for the help menu. Application.gethelpmenu() will return
it.
Also fixed menu IDs to be signed in do_menudispatch. this is an incompatible
change, but I don't think it'll hurt anyone.
Index: FrameWork.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Lib/FrameWork.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** FrameWork.py 4 Feb 2002 12:52:44 -0000 1.49
--- FrameWork.py 29 Aug 2002 22:04:15 -0000 1.50
***************
*** 14,17 ****
--- 14,18 ----
from Carbon.Evt import *
from Carbon.Events import *
+ from Carbon.Help import *
from Carbon.Menu import *
from Carbon.Menus import *
***************
*** 112,115 ****
--- 113,117 ----
else:
self.makemenubar()
+ self._helpmenu = None
def __del__(self):
***************
*** 126,129 ****
--- 128,136 ----
self.filemenu = m = Menu(self.menubar, "File")
self._quititem = MenuItem(m, "Quit", "Q", self._quit)
+
+ def gethelpmenu(self):
+ if self._helpmenu == None:
+ self._helpmenu = HelpMenu(self.menubar)
+ return self._helpmenu
def _quit(self, *args):
***************
*** 298,301 ****
--- 305,310 ----
result = MenuSelect(where)
id = (result>>16) & 0xffff # Hi word
+ if id >= 0x8000:
+ id = -65536 + id
item = result & 0xffff # Lo word
self.do_rawmenu(id, item, window, event)
***************
*** 716,719 ****
--- 725,740 ----
name = self.menu.GetMenuItemText(item)
OpenDeskAcc(name)
+
+ class HelpMenu(Menu):
+ def __init__(self, bar):
+ # Note we don't call Menu.__init__, we do the necessary things by hand
+ self.bar = bar
+ self.menu, index = HMGetHelpMenu()
+ self.id = self.menu.GetMenuID()
+ bar.menus[self.id] = self
+ # The next line caters for the entries the system already handles for us
+ self.items = [None]*(index-1)
+ self._parent = None
+
class Window:
***************
*** 1067,1070 ****
--- 1088,1094 ----
self.opt3 = CheckItem(mm, "Complaints", (kMenuOptionModifier|kMenuNoCommandModifier, "A"))
Separator(m)
+ self.itemeh = MenuItem(m, "Enable Help", None, self.enablehelp)
+ self.itemdbg = MenuItem(m, "Debug", None, self.debug)
+ Separator(m)
self.quititem = MenuItem(m, "Quit", "Q", self.quit)
***************
*** 1074,1077 ****
--- 1098,1112 ----
def quit(self, *args):
raise self
+
+ def enablehelp(self, *args):
+ hm = self.gethelpmenu()
+ self.nohelpitem = MenuItem(hm, "There isn't any", None, self.nohelp)
+
+ def nohelp(self, *args):
+ print "I told you there isn't any!"
+
+ def debug(self, *args):
+ import pdb
+ pdb.set_trace()
- Previous message: [Python-checkins] python/dist/src/Mac/Modules/help _Helpmodule.c,1.6,1.7 helpscan.py,1.6,1.7 helpsupport.py,1.5,1.6
- Next message: [Python-checkins] python/nondist/peps pep-0256.txt,1.3,1.4 pep-0257.txt,1.5,1.6 pep-0258.txt,1.3,1.4 pep-0287.txt,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]