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

guilherme.polo python-checkins at python.org
Sat Aug 2 15:21:38 CEST 2008


Author: guilherme.polo
Date: Sat Aug  2 15:21:37 2008
New Revision: 65407

Log:
Removed more dependencies of self.text. Now when changing tabs, the text widget is focused

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	Sat Aug  2 15:21:37 2008
@@ -325,27 +325,36 @@
         for page in self.text_notebook.pages.itervalues():
             page.editpage.reset_colorizer()
 
-    def ResetFont(self): # XXX depends on self.text
+    def ResetFont(self):
         "Update the text widgets' font if it is changed"
         # Called from configDialog.py
         fontWeight = 'normal'
         if idleConf.GetOption('main', 'EditorPage', 'font-bold', type='bool'):
             fontWeight = 'bold'
-        self.text.config(font=(idleConf.GetOption('main', 'EditorPage', 'font'),
+
+        for page in self.text_notebook.pages.itervalues():
+            text = page.editpage.text
+            text.config(font=(idleConf.GetOption('main', 'EditorPage', 'font'),
                 idleConf.GetOption('main', 'EditorPage', 'font-size'),
                 fontWeight))
 
-    def RemoveKeybindings(self): # XXX depends on self.text
+    def RemoveKeybindings(self):
         "Remove the keybindings before they are changed."
         # Called from configDialog.py
         Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet()
-        for event, keylist in keydefs.items():
-            self.text.event_delete(event, *keylist)
+
+        for page in self.text_notebook.pages.itervalues():
+            text = page.editpage.text
+            for event, keylist in keydefs.items():
+                text.event_delete(event, *keylist)
+
         for extensionName in self.get_standard_extension_names():
             xkeydefs = idleConf.GetExtensionBindings(extensionName)
             if xkeydefs:
-                for event, keylist in xkeydefs.items():
-                    self.text.event_delete(event, *keylist)
+                for page in self.text_notebook.pages.itervalues():
+                    text = page.editpage.text
+                    for event, keylist in xkeydefs.items():
+                        text.event_delete(event, *keylist)
 
     def ApplyKeybindings(self):
         "Update the keybindings after they are changed"
@@ -509,7 +518,7 @@
     def get_standard_extension_names(self):
         return idleConf.GetExtensions(editor_only=True)
 
-    def load_extension(self, name): # XXX depends on self.text
+    def load_extension(self, name):
         try:
             mod = __import__(name, globals(), locals(), [])
         except ImportError:
@@ -530,8 +539,10 @@
                 while methodname[-1:] == '>':
                     methodname = methodname[:-1]
                 methodname = methodname + "_event"
-                if hasattr(ins, methodname):
-                    self.text.bind(vevent, getattr(ins, methodname))
+                for page in self.text_notebook.pages.itervalues():
+                    text = page.editpage.text
+                    if hasattr(ins, methodname):
+                        text.bind(vevent, getattr(ins, methodname))
 
     def apply_bindings(self, keydefs=None):
         if keydefs is None:
@@ -615,6 +626,8 @@
     # Private methods
 
     def _update_controls(self, event):
+        print self.short_title(), "<<"
+        self.current_page.text.focus_set()
         self.io = self.current_page.io
         self.set_line_and_column()
 


More information about the Python-checkins mailing list