[Python-checkins] CVS: python/dist/src/Tools/idle EditorWindow.py,1.28,1.29

Guido van Rossum guido@cnri.reston.va.us
Tue, 15 Feb 2000 13:05:18 -0500 (EST)


Update of /projects/cvsroot/python/dist/src/Tools/idle
In directory eric:/projects/python/develop/guido/src/Tools/idle

Modified Files:
	EditorWindow.py 
Log Message:
Support for Moshe's status bar.


Index: EditorWindow.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Tools/idle/EditorWindow.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** EditorWindow.py	1999/08/26 23:06:05	1.28
--- EditorWindow.py	2000/02/15 18:05:15	1.29
***************
*** 86,89 ****
--- 86,90 ----
      import Bindings
      from Tkinter import Toplevel
+     from MultiStatusBar import MultiStatusBar
  
      about_title = about_title
***************
*** 102,106 ****
          self.top = top = self.Toplevel(root, menu=self.menubar)
          self.vbar = vbar = Scrollbar(top, name='vbar')
!         self.text = text = Text(top, name='text', padx=5,
                                  foreground=cprefs.CNormal[0],
                                  background=cprefs.CNormal[1],
--- 103,108 ----
          self.top = top = self.Toplevel(root, menu=self.menubar)
          self.vbar = vbar = Scrollbar(top, name='vbar')
!         self.text_frame = text_frame = Frame(top)
!         self.text = text = Text(text_frame, name='text', padx=5,
                                  foreground=cprefs.CNormal[0],
                                  background=cprefs.CNormal[1],
***************
*** 140,144 ****
              text['font'] = ("lucida console", 8)
  #            text['font'] = ("courier new", 10)
!         text.pack(side=LEFT, fill=BOTH, expand=1)
          text.focus_set()
  
--- 142,147 ----
              text['font'] = ("lucida console", 8)
  #            text['font'] = ("courier new", 10)
!         text_frame.pack(side=LEFT, fill=BOTH, expand=1)
!         text.pack(side=TOP, fill=BOTH, expand=1)
          text.focus_set()
  
***************
*** 187,190 ****
--- 190,208 ----
              self.extensions['AutoIndent'].set_indentation_params(
                  self.ispythonsource(filename))
+         self.set_status_bar()
+ 
+     def set_status_bar(self):
+         self.status_bar = self.MultiStatusBar(self.text_frame)
+         self.status_bar.set_label('column', 'Col: ?', side=RIGHT)
+         self.status_bar.set_label('line', 'Ln: ?', side=RIGHT)
+         self.status_bar.pack(side=BOTTOM, fill=X)
+         self.text.bind('<KeyRelease>', self.set_line_and_column)
+         self.text.bind('<ButtonRelease>', self.set_line_and_column)
+         self.text.after_idle(self.set_line_and_column)
+ 
+     def set_line_and_column(self, event=None):
+         line, column = string.split(self.text.index(INSERT), '.')
+         self.status_bar.set_label('column', 'Col: %s' % column)
+         self.status_bar.set_label('line', 'Ln: %s' % line)
  
      def wakeup(self):