[Python-checkins] r65167 - in sandbox/trunk/ttk-gsoc/src/idlelib: EditorWindow.py config-keys.def configHandler.py editorpage.py

guilherme.polo python-checkins at python.org
Mon Jul 21 14:11:05 CEST 2008


Author: guilherme.polo
Date: Mon Jul 21 14:11:04 2008
New Revision: 65167

Log:
Added bindings for moving to the next and previous tab

Modified:
   sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py
   sandbox/trunk/ttk-gsoc/src/idlelib/config-keys.def
   sandbox/trunk/ttk-gsoc/src/idlelib/configHandler.py
   sandbox/trunk/ttk-gsoc/src/idlelib/editorpage.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 Jul 21 14:11:04 2008
@@ -226,6 +226,20 @@
         self.flist.new(dirname)
         return "break"
 
+    def next_tab(self, event):
+        """Show next tab if not in the last tab already."""
+        index = self.text_notebook.index(self.text_notebook.select())
+        if index == len(self.text_notebook.tabs()) - 1:
+            return
+        self.text_notebook.select(index + 1)
+
+    def prev_tab(self, event):
+        """Show the previous tab if not in the first tab already."""
+        index = self.text_notebook.index(self.text_notebook.select())
+        if index == 0:
+            return
+        self.text_notebook.select(index - 1)
+
     def new_tab(self, event=None, filename=None):
         """Create a new EditorPage and insert it into the notebook."""
         page_title = "#%d" % (len(self.text_notebook.pages) + 1)

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/config-keys.def
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/config-keys.def	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/config-keys.def	Mon Jul 21 14:11:04 2008
@@ -8,6 +8,10 @@
 # configuration gui.
 
 [IDLE Classic Windows]
+close-tab=<Control-Key-w> <Control-Key-W>
+new-tab=<Control-Key-t> <Control-Key-T>
+next-tab=<Control-Key-Prior>
+prev-tab=<Control-Key-Next>
 copy=<Control-Key-c> <Control-Key-C>
 cut=<Control-Key-x> <Control-Key-X>
 paste=<Control-Key-v> <Control-Key-V>
@@ -15,7 +19,6 @@
 center-insert=<Control-Key-l> <Control-Key-L>
 close-all-windows=<Control-Key-q>
 close-window=<Alt-Key-F4> <Meta-Key-F4>
-close-tab=<Control-Key-w> <Control-Key-W>
 do-nothing=<Control-Key-F12>
 end-of-file=<Control-Key-d> <Control-Key-D>
 python-docs=<Key-F1>
@@ -28,7 +31,6 @@
 open-class-browser=<Alt-Key-c> <Meta-Key-c> <Alt-Key-C>
 open-module=<Alt-Key-m> <Meta-Key-m> <Alt-Key-M>
 open-new-window=<Control-Key-n> <Control-Key-N>
-new-tab=<Control-Key-t> <Control-Key-T>
 open-window-from-file=<Control-Key-o> <Control-Key-O>
 plain-newline-and-indent=<Control-Key-j> <Control-Key-J>
 print-window=<Control-Key-p> <Control-Key-P>
@@ -61,6 +63,10 @@
 del-word-right=<Control-Key-Delete>
 
 [IDLE Classic Unix]
+close-tab=<Alt-Key-w><Control-Key-w>
+new-tab=<Alt-Key-t><Control-Key-t>
+next-tab=<Control-Key-Prior>
+prev-tab=<Control-Key-Next>
 copy=<Alt-Key-w> <Meta-Key-w>
 cut=<Control-Key-w>
 paste=<Control-Key-y>
@@ -68,7 +74,6 @@
 center-insert=<Control-Key-l>
 close-all-windows=<Control-Key-x><Control-Key-c>
 close-window=<Control-Key-x><Control-Key-0>
-close-tab=<Alt-Key-w><Control-Key-w>
 do-nothing=<Control-Key-x>
 end-of-file=<Control-Key-d>
 history-next=<Alt-Key-n> <Meta-Key-n>
@@ -79,7 +84,6 @@
 open-class-browser=<Control-Key-x><Control-Key-b>
 open-module=<Control-Key-x><Control-Key-m>
 open-new-window=<Control-Key-x><Control-Key-n>
-new-tab=<Alt-Key-t><Control-Key-t>
 open-window-from-file=<Control-Key-x><Control-Key-f>
 plain-newline-and-indent=<Control-Key-j>
 print-window=<Control-x><Control-Key-p>
@@ -114,6 +118,10 @@
 del-word-right=<Alt-Key-d>
 
 [IDLE Classic Mac]
+close-tab=<Control-key-w>
+new-tab=<Control-Key-t>
+next-tab=<Control-Key-Prior>
+prev-tab=<Control-Key-Next>
 copy=<Command-Key-c>
 cut=<Command-Key-x>
 paste=<Command-Key-v>
@@ -121,7 +129,6 @@
 center-insert=<Control-Key-l>
 close-all-windows=<Command-Key-q>
 close-window=<Command-Key-w>
-close-tab=<Control-key-w>
 do-nothing=<Control-Key-F12>
 end-of-file=<Control-Key-d>
 python-docs=<Key-F1>
@@ -134,7 +141,6 @@
 open-class-browser=<Command-Key-b>
 open-module=<Command-Key-m>
 open-new-window=<Command-Key-n>
-new-tab=<Control-Key-t>
 open-window-from-file=<Command-Key-o>
 plain-newline-and-indent=<Control-Key-j>
 print-window=<Command-Key-p>
@@ -167,6 +173,10 @@
 del-word-right=<Control-Key-Delete>
 
 [IDLE Classic OSX]
+close-tab=<Control-Key-w>
+new-tab = <Control-Key-t>
+next-tab=<Control-Key-Prior>
+prev-tab=<Control-Key-Next>
 toggle-tabs = <Control-Key-t>
 interrupt-execution = <Control-Key-c>
 untabify-region = <Control-Key-6>
@@ -181,7 +191,6 @@
 comment-region = <Control-Key-3>
 redo = <Shift-Command-Key-Z>
 close-window = <Command-Key-w>
-close-tab=<Control-Key-w>
 restart-shell = <Control-Key-F6>
 save-window-as-file = <Command-Key-S>
 close-all-windows = <Command-Key-q>
@@ -212,7 +221,6 @@
 end-of-file = <Control-Key-d>
 open-class-browser = <Command-Key-b>
 open-new-window = <Command-Key-n>
-new-tab = <Control-Key-t>
 open-module = <Command-Key-m>
 find-selection = <Shift-Command-Key-F3>
 python-context-help = <Shift-Key-F1>

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/configHandler.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/configHandler.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/configHandler.py	Mon Jul 21 14:11:04 2008
@@ -558,6 +558,10 @@
         defined here.
         """
         keyBindings={
+            '<<close-tab>>': ['<Control-w>'],
+            '<<new-tab>>': ['<Control-t>'],
+            '<<next-tab>>': ['<Control-Prior'],
+            '<<prev-tab>>': ['<Control-Next'],
             '<<copy>>': ['<Control-c>', '<Control-C>'],
             '<<cut>>': ['<Control-x>', '<Control-X>'],
             '<<paste>>': ['<Control-v>', '<Control-V>'],
@@ -565,7 +569,6 @@
             '<<center-insert>>': ['<Control-l>'],
             '<<close-all-windows>>': ['<Control-q>'],
             '<<close-window>>': ['<Alt-F4>'],
-            '<<close-tab>>': ['<Control-w>'],
             '<<do-nothing>>': ['<Control-x>'],
             '<<end-of-file>>': ['<Control-d>'],
             '<<python-docs>>': ['<F1>'],
@@ -578,7 +581,6 @@
             '<<open-class-browser>>': ['<Alt-c>'],
             '<<open-module>>': ['<Alt-m>'],
             '<<open-new-window>>': ['<Control-n>'],
-            '<<new-tab>>': ['<Control-t>'],
             '<<open-window-from-file>>': ['<Control-o>'],
             '<<plain-newline-and-indent>>': ['<Control-j>'],
             '<<print-window>>': ['<Control-p>'],

Modified: sandbox/trunk/ttk-gsoc/src/idlelib/editorpage.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/idlelib/editorpage.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/idlelib/editorpage.py	Mon Jul 21 14:11:04 2008
@@ -321,7 +321,8 @@
             method_name = event[prefix_size:-prefix_size].replace('-', '_')
             text.bind(event, getattr(self, "_%s_event" % method_name.lower()))
 
-        parent_actions = ('<<new-tab>>', '<<open-module>>')
+        parent_actions = ('<<new-tab>>', '<<next-tab>>', '<<prev-tab>>',
+            '<<open-module>>')
 
         for action in parent_actions:
             prefix_size = action.count('<')


More information about the Python-checkins mailing list