Anonymous avatar Anonymous committed bfcd18d

Showing current line number

Comments (0)

Files changed (6)

+- Showing current line in status bar : April 28, 2006
+
+
+- Switch editor dialog; C-x b and C-F6 : April 27, 2006
+
+
 - Make new package dialog : April 25, 2006
 
 
   * Showing modified file status
 
 
-* Showing current line in status bar @ 1
-
-
-* Switch editor dialog; C-x b and C-F6 @ 1
-
-
 --- Remaining Stories ---
 ? Rename rope; maybe pyrope
 ? Using underlined_words function style
 ? Separate domain and presentation everywhere
 * Make tests less dependant
-* Make a new Project; Seperate Opening and creating projects
+* Make a new Project; Seperate opening and creating projects
 * Add removing resources to Core
 ? Project resource consistency; What if it is deleted after being created.
-? Distinction of functional and unit tests
-? Logging and status bar
 ? Using SF SVN; Making a script for committing to SF

docs/workingon.txt

-*** Switch editor dialog; C-x b and C-F6 @ 1 ***
+
 
 ? Adding EditorManager class
 ? Adding selection list class
         self.editor_list = Frame(self.main, borderwidth=0)
         self.editor_frame = Frame(self.main, borderwidth=0, relief=RIDGE)
         self.status_bar = Frame(self.main, borderwidth=1, relief=RIDGE)
-        self.status_text = Label(self.status_bar, text='')
-        self.status_text.pack(side=LEFT)
+        self.status_text = Label(self.status_bar, text=' ', height=1)
 
         self.editors = []
         self.active_file_path = StringVar('')
         def do_switch_active_editor(event):
             self.switch_active_editor()
             return 'break'
-        widget.bind('<Control-F6>', do_switch_active_editor)
-
+        widget.bind('<Control-KeyRelease-F6>', do_switch_active_editor)
+        def show_current_line_number(event):
+            if self.get_active_editor():
+                self.status_text['text'] = 'line : %d' % \
+                                           self.get_active_editor().get_editor().get_current_line_number()
+            else:
+                self.status_text['text'] = ' '
+        widget.bind('<Any-KeyRelease>', show_current_line_number)
+        widget.bind('<Any-Button>', show_current_line_number)
+        widget.bind('<FocusIn>', show_current_line_number)
 
     def _find_file_dialog(self, event=None):
         if not self.project:
         self.main.columnconfigure(0, weight=1)
         self.editor_list.pack(fill=BOTH, side=TOP)
         self.editor_frame.pack(fill=BOTH, expand=1)
+        self.editor_frame.pack_propagate(0)
+        self.status_text.pack(side=LEFT, fill=BOTH)
         self.status_bar.pack(fill=BOTH, side=BOTTOM)
         self.main.pack(fill=BOTH, expand=1)
         self.main.pack_propagate(0)
     def get_indenter(self):
         return self.indenter
 
+    def get_current_line_number(self):
+        return self._get_line_from_index(INSERT)
+
 
 class GraphicalTextIndex(TextIndex):
     '''An immutable class for pointing to a position in a text'''

ropetest/editortest.py

         self.editor.undo()
         self.assertEquals('sample text', self.editor.get_text())
 
+    def test_current_line_number(self):
+        self.assertEquals(1, self.editor.get_current_line_number())
+        self.editor.set_text('sample\n text \n end')
+        self.editor.set_insert(self.editor.get_index(9))
+        self.assertEquals(2, self.editor.get_current_line_number())
+        self.editor.set_insert(self.editor.get_end())
+        self.assertEquals(3, self.editor.get_current_line_number())
+
 
 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.