Anonymous avatar Anonymous committed f58118b

Switching active editor; C-F6

Comments (0)

Files changed (3)

docs/workingon.txt

 
 ? Adding EditorManager class
 ? Adding selection list class
-
-
 ? Separation of acceptance and unit tests
 ? GUI Testing Problems? again!
 ? Possible base UI classes: completion lists, dialogs, named fields
             return 'break'
         widget.bind('<Control-x><k>', _close_active_editor)
         widget.bind('<Control-x><b>', self._change_editor_dialog)
+        def do_switch_active_editor(event):
+            self.switch_active_editor()
+            return 'break'
+        widget.bind('<Control-F6>', do_switch_active_editor)
 
 
     def _find_file_dialog(self, event=None):
             runner = PythonFileRunner(activeEditor.get_file())
             return runner
 
+    def switch_active_editor(self):
+        if len(self.editors) >= 2:
+            self.activate_editor(self.editors[1])
+
     @staticmethod
     def get_core():
         '''Get the singleton instance of Core'''

ropetest/coretest.py

         Core.get_core().close_active_editor()
         self.assertTrue(Core.get_core().get_active_editor() is None)
 
+    def test_switching_active_editor(self):
+        parent = self.project.get_root_folder();
+        parent.create_file('file1.txt')
+        parent.create_file('file2.txt')
+        editor1 = Core.get_core().open_file('file1.txt')
+        editor2 = Core.get_core().open_file('file2.txt')
+        self.assertEquals(editor2, Core.get_core().get_active_editor())
+        Core.get_core().switch_active_editor()
+        self.assertEquals(editor1, Core.get_core().get_active_editor())
+
+
 if __name__ == '__main__':
     unittest.main()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.