[Idle-dev] RV: help on Idle extension
Hernan Martinez Foffani
hernan@orgmf.com.ar
Thu, 16 Aug 2001 17:03:15 +0200
Sorry, don't mind...
menudefs = [
('Python _Shelf', '<<documents-event>>'),
^^^^^^^------- here!!
And NOW I'm embarrased!
Regards,
-Hernan
-----Mensaje original-----
De: Hernan Martinez Foffani [mailto:hernan@orgmf.com.ar]
Enviado el: jueves, 16 de agosto de 2001 1:12
Para: idle-dev@python.org
Asunto: help on Idle extension
Hi,
Before I give up, can anybody help me with this extension,
please? I'm a bit embarrased to ask because this is so
simple that it has to work.
With the following class a new menu option "Python Shelf"
does show up, but when I click it nothing happens.
Apparently, the method documents_event is not being dispatch
by Idle. Don't know why. Running the test standalone does
what I want, ie: a notepad window is opened.
FYI, there is an empty section [ContextHelp] at config.txt
I bet I'm missing something very obvious here.
Thanks in advance,
-Hernan
Win2000, Python 2.2a1, idle 0.8 and idlefork 0.8.x
---8<---8<--- ContextHelp.py ---8<---8<---
import webbrowser
class ContextHelp:
menudefs = [ ('help', [
None, # Separator
('Python _Shelf', '<<documents-event>>'),
]) ]
windows_keydefs = { '<<documents-event>>': ['<Alt-F9>'], }
unix_keydefs = { '<<documents-event>>': ['<Alt-F9>'], }
def __init__(self, editwin):
self.editwin = editwin
def documents_event(self, event):
webbrowser.open( "c:/pepe.txt") # whatever
def test():
a = ContextHelp(None)
a.documents_event(None)
if __name__ == '__main__':
test()