Commits

Ali Gholami Rudi  committed f58118b

Switching active editor; C-F6

  • Participants
  • Parent commits 031f24a

Comments (0)

Files changed (3)

File 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

File rope/core.py

             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'''

File 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()