[Python-checkins] r65471 - sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py

guilherme.polo python-checkins at python.org
Mon Aug 4 03:29:42 CEST 2008


Author: guilherme.polo
Date: Mon Aug  4 03:29:42 2008
New Revision: 65471

Log:
When clicking on menu items, generate events in the active text widget

Modified:
   sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py	Mon Aug  4 03:29:42 2008
@@ -687,7 +687,6 @@
         self.reset_help_menu_entries()
 
     def _fill_menus(self, menudefs=None, keydefs=None):
-        # XXX depends on self.text
         """Add appropriate entries to the menus and submenus
 
         Menus that are absent or None in self.menudict are ignored.
@@ -697,7 +696,6 @@
         if keydefs is None:
             keydefs = Bindings.default_keydefs
         menudict = self.menudict
-        text = self.text
         for mname, entrylist in menudefs:
             menu = menudict.get(mname)
             if not menu:
@@ -712,8 +710,8 @@
                         label = label[1:]
                     underline, label = prepstr(label)
                     accelerator = get_accelerator(keydefs, eventname)
-                    def command(text=text, eventname=eventname):
-                        text.event_generate(eventname)
+                    def command(eventname=eventname):
+                        self.text.event_generate(eventname)
                     if checkbutton:
                         var = self.get_var_obj(eventname, BooleanVar)
                         menu.add_checkbutton(label=label, underline=underline,
@@ -721,8 +719,7 @@
                             variable=var)
                     else:
                         menu.add_command(label=label, underline=underline,
-                                         command=command,
-                                         accelerator=accelerator)
+                            command=command, accelerator=accelerator)
 
     def __recent_file_callback(self, file_name):
         def open_recent_file(fn_closure=file_name):


More information about the Python-checkins mailing list