Ali Gholami Rudi  committed 2db1502

not using editor._rope_title in core.EditorManager

  • Participants
  • Parent commits 87b4070

Comments (0)

Files changed (5)

 now on we will move toward the promised features like auto-completion.  
   The keybinding will be customizable in future. 
 C-i            correct line indentation
+  This program, rope, is a python IDE. It tries to give users lots of things
+that are not available in python IDEs yet.
+* Refactoring:
+  In recent years refactoring has become a basic task of everyday programing,
+specially in java community. In the agile programing methodologies, like
+Extreme Programing, Refactoring is one of the core practices.
+  As Martin Fowler the writer of the "Refactoring: Improving the design of 
+existing code" book says "Refactoring is the process of changing a software
+system in such a way that it does not alter the external behavior of the code
+yet improves its internal structure."
+  Some IDEs support some basic refactorings like 'PyDev' (which uses bicycle
+repair man). These IDEs have a limited set of refactorings and fail
+when doing refactorings that need to know the type of objects in the
+source code (specially for relatively large projects). rope tries to provide a 
+rich set of refactorings. Some of the refactorings require type
+inferencing which is described later.
+* Auto Completion:
+  One of the basic features of modern IDEs is the availability of auto-completion.
+Some Python IDEs have auto-completion support but in a limited form. Since
+the type of many variables cannot be deduced from simple analysis of the source code.
+Auto-completing modules names, class names, static methods, class methods,
+function names and variable names are easy. But auto-completing the methods and
+attributes of an object is hard. Because the IDE needs to know the type of
+the object that cannot be achieved easily most of the time in dynamic languages.
+rope uses Type Inferencing algorithms to solve this problem.
+* Type Inferencing:
+  One disadvantage of dynamic languages like python is that you cannot
+know the type of variables by a simple analysis of program source code
+most of the time. Knowing the type of variables is very essential for
+providing many of the refactorings and auto-completions. rope will use
+type inferencing to overcome this problem.
+  Static type inferencing uses program source code to guess the type
+of objects. But type inferencing python programs is very hard.
+There have been some attempts though not very successful (examples:
+psycho: only str and int types, StarKiller: wasn't released and
+ShedSkin: very limited). They where mostly directed at speeding up
+python programs by transforming its code to other typed languages 
+rather than building IDEs. Such algorithms might be helpful.
+  There is another approache toward type inferencing. That is the analysis
+of running programs. This dynamic approach records the types variables are
+assigned to during the program execution. Although this approach is
+a lot easier to implement than the alternative, it is limited. Only the
+parts of the program that are executed are analyzed. If developers write
+unit tests and use test driven development this approach works very well.
+Project Road Map
+  The main motive for starting this project was the lack of good
+refactoring tools for python language. Refactoring programs like "bicycle repair man"
+aren't reliable due to type inferencing problems discussed earlier and they
+support a limited number of refactorings.
+* Why an IDE and not a standalone library or program?
+  As Don Roberts one of the writers of the famous "Refactoring Browser" for
+smalltalk writes in his doctoral thesis:
+  "An early implementation of the Refactoring Browser for Smalltalk was a separate
+tool from the standard Smalltalk development tools. What we found was that no
+one used it. We did not even use it ourselves. Once we integrated the refactorings
+directly into the Smalltalk Browser, we used them extensively."
+  The main goal of rope is to concentrate on type inferencing and refactoring
+of python programs and not a state of art IDE (At least not in the first phase).
+The type inferencing and refactoring parts of the rope will not
+dependent on rope and if successful, will be released as standalone programs
+and libraries so that other projects may use them.
 Bug reports
   Send your bug reports and feature requests to rope's sourceforge

File docs/stories.txt

 * Enhancing syntax highlighting @ 1
+  * Ignoring comment lines
   * Only highlighting the changed region
   * Extend highlighting region while highlighting if necessay
   * Highlighting after cut, paste, undo and redo

File docs/workingon.txt

 * Showing modified file status
-? not using editor._rope_title
+- not using editor._rope_title
-? SF repository
+? SF repository; Subversion or CVS? Synchronizing local SVN with SF?
 ? Adding selection list class
 ? Separation of acceptance and unit tests
 ? GUI Testing Problems? again!

File rope/

         self.editor_frame.pack(fill=BOTH, expand=1)
         self.editors = []
+        self.buttons = {}
         self.active_file_path = StringVar('')
         self.active_editor = None
         editor.get_editor().getWidget().pack(fill=BOTH, expand=1)
+        self.buttons[editor].select()
         self.active_editor = editor
         self.editors.insert(0, editor)
     def get_resource_editor(self, file):
         for editor in self.editors:
             if editor.get_file() == file:
-                editor._rope_title.invoke()
+                self.buttons[editor].invoke()
                 return editor
         editor = FileEditor(file, GraphicalEditor(self.editor_frame))
                             value=file.get_path(), indicatoron=0, bd=2,
                             command=lambda: self.activate_editor(editor),
                             selectcolor='#99A', relief=GROOVE)
-        editor._rope_title = title
+        self.buttons[editor] = title
         title.pack(fill=BOTH, side=LEFT)
-        self.active_editor._rope_title.forget()
+        self.buttons[self.active_editor].forget()
+        del self.buttons[self.active_editor]
         self.active_editor = None
         if self.editors:
-            self.editors[0]._rope_title.invoke()
+            self.buttons[self.editors[0]].invoke()
 class Core(object):

File ropetest/

 from rope.indenter import PythonCodeIndenter
 class GraphicalEditorTest(unittest.TestCase):
+    '''This class only tests features that are specific to GraphicalEditor; see mockeditortest'''
     __factory = GraphicalEditorFactory()
     def setUp(self):