summaryrefslogtreecommitdiffstats
path: root/Mac/Tools/IDE
diff options
context:
space:
mode:
authorJust van Rossum <just@letterror.com>2001-07-05 07:06:26 (GMT)
committerJust van Rossum <just@letterror.com>2001-07-05 07:06:26 (GMT)
commit25ddc6330f1977c4c650f1002586faf4f7b2c639 (patch)
tree894eb3ad9d659af7e01f062be354f6ce1cfa8851 /Mac/Tools/IDE
parent924e18e0b8d39a961e8d008ebcf3d43c9eee70db (diff)
downloadcpython-25ddc6330f1977c4c650f1002586faf4f7b2c639.zip
cpython-25ddc6330f1977c4c650f1002586faf4f7b2c639.tar.gz
cpython-25ddc6330f1977c4c650f1002586faf4f7b2c639.tar.bz2
- minor cleanup, removed bogus comments
- make method reload handle __private attrs correctly - fixed whole word search
Diffstat (limited to 'Mac/Tools/IDE')
-rw-r--r--Mac/Tools/IDE/PyEdit.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/Mac/Tools/IDE/PyEdit.py b/Mac/Tools/IDE/PyEdit.py
index a58de1b..ac6cc0e 100644
--- a/Mac/Tools/IDE/PyEdit.py
+++ b/Mac/Tools/IDE/PyEdit.py
@@ -359,14 +359,15 @@ class Editor(W.Window):
if self.editgroup.editor.changed:
import EasyDialogs
import Qd
- Qd.InitCursor() # XXX should be done by dialog
- save = EasyDialogs.AskYesNoCancel('Save window "%s" before closing?' % self.title, 1)
+ Qd.InitCursor()
+ save = EasyDialogs.AskYesNoCancel('Save window "%s" before closing?' % self.title,
+ default=1, no="Don\xd5t save")
if save > 0:
if self.domenu_save():
return 1
elif save < 0:
return 1
- self.globals = None # XXX doesn't help... all globals leak :-(
+ self.globals = None
W.Window.close(self)
def domenu_close(self, *args):
@@ -564,13 +565,12 @@ class Editor(W.Window):
else:
raise W.AlertError, "Can't find a class."
if globals.has_key(classname):
- locals = globals[classname].__dict__
+ klass = globals[classname]
else:
raise W.AlertError, "Can't find class \"%s\"." % classname
- # dedent to top level
- for i in range(len(lines)):
- lines[i] = lines[i][1:]
- pytext = string.join(lines, '\r')
+ # add class def
+ pytext = ("class %s:\n" % classname) + pytext
+ selfirstline = selfirstline - 1
elif indent > 0:
raise W.AlertError, "Can't run indented code."
@@ -578,6 +578,10 @@ class Editor(W.Window):
# now a traceback will give the right line number
pytext = selfirstline * '\r' + pytext
self.execstring(pytext, globals, locals, file, modname)
+ if indent == 1 and globals[classname] is not klass:
+ # update the class in place
+ klass.__dict__.update(globals[classname].__dict__)
+ globals[classname] = klass
def setthreadstate(self, state):
oldstate = self._threadstate
@@ -786,7 +790,7 @@ def _escape(where, what) :
def _makewholewordpattern(word):
# first, escape special regex chars
- for esc in "\\[].*^+$?":
+ for esc in "\\[]().*^+$?":
word = _escape(word, esc)
notwordcharspat = '[^' + _wordchars + ']'
pattern = '(' + word + ')'