summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-02-15 18:05:15 (GMT)
committerGuido van Rossum <guido@python.org>2000-02-15 18:05:15 (GMT)
commitec73dc67000e8100bfdd9f1827acee67d797767f (patch)
tree9cb062a2bfff98090473d137e2894f21922f623f /Tools
parent17752f7c4bf2b34328e097d7eb541369c48815c5 (diff)
downloadcpython-ec73dc67000e8100bfdd9f1827acee67d797767f.zip
cpython-ec73dc67000e8100bfdd9f1827acee67d797767f.tar.gz
cpython-ec73dc67000e8100bfdd9f1827acee67d797767f.tar.bz2
Support for Moshe's status bar.
Diffstat (limited to 'Tools')
-rw-r--r--Tools/idle/EditorWindow.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/Tools/idle/EditorWindow.py b/Tools/idle/EditorWindow.py
index eb9466a..44e2b13 100644
--- a/Tools/idle/EditorWindow.py
+++ b/Tools/idle/EditorWindow.py
@@ -85,6 +85,7 @@ class EditorWindow:
from IOBinding import IOBinding
import Bindings
from Tkinter import Toplevel
+ from MultiStatusBar import MultiStatusBar
about_title = about_title
about_text = about_text
@@ -101,7 +102,8 @@ class EditorWindow:
self.menubar = Menu(root)
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,
+ 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],
highlightcolor=cprefs.CHilite[0],
@@ -139,7 +141,8 @@ class EditorWindow:
if sys.platform[:3] == 'win':
text['font'] = ("lucida console", 8)
# text['font'] = ("courier new", 10)
- text.pack(side=LEFT, fill=BOTH, expand=1)
+ text_frame.pack(side=LEFT, fill=BOTH, expand=1)
+ text.pack(side=TOP, fill=BOTH, expand=1)
text.focus_set()
self.per = per = self.Percolator(text)
@@ -186,6 +189,21 @@ class EditorWindow:
if self.extensions.has_key('AutoIndent'):
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):
if self.top.wm_state() == "iconic":