diff options
author | Guido van Rossum <guido@python.org> | 1999-06-02 11:05:19 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1999-06-02 11:05:19 (GMT) |
commit | 808fa4993e1d65c42d5fd86af4230fd3540ad9a1 (patch) | |
tree | 1908cd8814c04eba37530aba8a3584b58acc48a2 /Tools/idle | |
parent | d395aeeaa4ab194e55aa5f8bb7b1693089709c95 (diff) | |
download | cpython-808fa4993e1d65c42d5fd86af4230fd3540ad9a1.zip cpython-808fa4993e1d65c42d5fd86af4230fd3540ad9a1.tar.gz cpython-808fa4993e1d65c42d5fd86af4230fd3540ad9a1.tar.bz2 |
Changes by Mark Hammond to allow using IDLE extensions in PythonWin as
well: make three dialog routines instance variables.
Diffstat (limited to 'Tools/idle')
-rw-r--r-- | Tools/idle/AutoIndent.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Tools/idle/AutoIndent.py b/Tools/idle/AutoIndent.py index 067df3b..cf32135 100644 --- a/Tools/idle/AutoIndent.py +++ b/Tools/idle/AutoIndent.py @@ -1,7 +1,7 @@ import string -from Tkinter import TclError -import tkMessageBox -import tkSimpleDialog +#from Tkinter import TclError +#import tkMessageBox +#import tkSimpleDialog # The default tab setting for a Text widget, in average-width characters. TK_TABWIDTH_DEFAULT = 8 @@ -121,6 +121,7 @@ class AutoIndent: num_context_lines = 50, 500, 5000000 def __init__(self, editwin): + self.editwin = editwin self.text = editwin.text def config(self, **options): @@ -170,7 +171,7 @@ class AutoIndent: try: first = text.index("sel.first") last = text.index("sel.last") - except TclError: + except: # Was catching TclError, but this doesnt work for first = last = None if first and last: text.delete(first, last) @@ -197,7 +198,7 @@ class AutoIndent: try: first = text.index("sel.first") last = text.index("sel.last") - except TclError: + except: # Was catching TclError, but this doesnt work for first = last = None text.undo_block_start() try: @@ -230,7 +231,7 @@ class AutoIndent: try: first = text.index("sel.first") last = text.index("sel.last") - except TclError: + except: # Was catching TclError, but this doesnt work for first = last = None text.undo_block_start() try: @@ -374,7 +375,7 @@ class AutoIndent: self.set_region(head, tail, chars, lines) def toggle_tabs_event(self, event): - if tkMessageBox.askyesno( + if self.editwin.askyesno( "Toggle tabs", "Turn tabs " + ("on", "off")[self.usetabs] + "?", parent=self.text): @@ -390,7 +391,7 @@ class AutoIndent: return "break" def change_indentwidth_event(self, event): - new = tkSimpleDialog.askinteger( + new = self.editwin.askinteger( "Indent width", "New indent width (1-16)", parent=self.text, @@ -448,7 +449,7 @@ class AutoIndent: text.undo_block_stop() def _asktabwidth(self): - return tkSimpleDialog.askinteger( + return self.editwin.askinteger( "Tab width", "Spaces per tab?", parent=self.text, |