Some long overdue maintainance. Made all IDE sources 7-bit-clean, to avoid any further encoding conversion troubles.

This commit is contained in:
Just van Rossum 2001-06-19 21:37:33 +00:00
parent 9020bcebc8
commit dc3c617cb8
14 changed files with 86 additions and 84 deletions

View file

@ -14,9 +14,9 @@ class _modulebrowser:
#self.window.bevelbox = W.BevelBox((0, 0, 0, 56)) #self.window.bevelbox = W.BevelBox((0, 0, 0, 56))
self.window.openbutton = W.Button((10, 8, 80, 16), "Open", self.openbuttonhit) self.window.openbutton = W.Button((10, 8, 80, 16), "Open", self.openbuttonhit)
self.window.browsebutton = W.Button((100, 8, 80, 16), "Browseƒ", self.browsebuttonhit) self.window.browsebutton = W.Button((100, 8, 80, 16), "Browse\xc9", self.browsebuttonhit)
self.window.reloadbutton = W.Button((10, 32, 80, 16), "Reload", self.reloadbuttonhit) self.window.reloadbutton = W.Button((10, 32, 80, 16), "Reload", self.reloadbuttonhit)
self.window.openotherbutton = W.Button((100, 32, 80, 16), "Open otherƒ", self.openother) self.window.openotherbutton = W.Button((100, 32, 80, 16), "Open other\xc9", self.openother)
self.window.openbutton.enable(0) self.window.openbutton.enable(0)
self.window.reloadbutton.enable(0) self.window.reloadbutton.enable(0)
@ -81,7 +81,7 @@ class _modulebrowser:
file, path, description = imp.find_module(modname) file, path, description = imp.find_module(modname)
except ImportError: except ImportError:
W.SetCursor("arrow") W.SetCursor("arrow")
W.Message("CanÕt find file for module %s." W.Message("Can't find file for module '%s'."
% modname) % modname)
else: else:
self.openscript(path, modname) self.openscript(path, modname)
@ -93,7 +93,7 @@ class _modulebrowser:
elif path[-4:] in ['.pyc', '.pyo']: elif path[-4:] in ['.pyc', '.pyo']:
W.getapplication().openscript(path[:-1], modname=modname) W.getapplication().openscript(path[:-1], modname=modname)
else: else:
W.Message("CanÕt edit %s; it might be a shared library or a .pyc file." W.Message("Can't edit '%s'; it might be a shared library or a .pyc file."
% modname) % modname)
def openother(self): def openother(self):
@ -106,9 +106,9 @@ class _modulebrowser:
file, path, description = imp.find_module(modname) file, path, description = imp.find_module(modname)
except ImportError: except ImportError:
if modname in sys.builtin_module_names: if modname in sys.builtin_module_names:
alerttext = "%s” is a builtin module, which you canÕt edit." % modname alerttext = "'%s' is a builtin module, which you can't edit." % modname
else: else:
alerttext = "No module named %s." % modname alerttext = "No module named '%s'." % modname
raise W.AlertError, alerttext raise W.AlertError, alerttext
self.openscript(path, modname) self.openscript(path, modname)

View file

@ -38,7 +38,7 @@ def double_repr(key, value, truncvalue = 0,
value = _repr(value) value = _repr(value)
'' + value # test to see if it is a string, in case a __repr__ method is buggy '' + value # test to see if it is a string, in case a __repr__ method is buggy
except: except:
value = ' exception in repr()' value = '\xa5\xa5\xa5 exception in repr()'
if truncvalue: if truncvalue:
return key + '\t' + value[:255] return key + '\t' + value[:255]
return key + '\t' + value return key + '\t' + value
@ -360,7 +360,7 @@ INDEXING_TYPES = (
def unpack_object(object, indent = 0): def unpack_object(object, indent = 0):
tp = type(object) tp = type(object)
if tp in SIMPLE_TYPES and tp is not types.NoneType: if tp in SIMPLE_TYPES and tp is not types.NoneType:
raise TypeError, 'canÕt browse simple type: %s' % tp.__name__ raise TypeError, "can't browse simple type: %s" % tp.__name__
elif tp == types.DictionaryType: elif tp == types.DictionaryType:
return unpack_dict(object, indent) return unpack_dict(object, indent)
elif tp in (types.TupleType, types.ListType): elif tp in (types.TupleType, types.ListType):

View file

@ -48,7 +48,7 @@ class ConsoleTextWidget(W.EditText):
def open(self): def open(self):
W.EditText.open(self) W.EditText.open(self)
self.write('Python ' + sys.version + '\n' + sys.copyright + '\n') self.write('Python ' + sys.version + '\nType "copyright", "credits" or "license" for more information.\n')
self.write(sys.ps1) self.write(sys.ps1)
self.flush() self.flush()
@ -156,8 +156,8 @@ class PyConsole(W.Window):
def makenamespacemenu(self, *args): def makenamespacemenu(self, *args):
W.SetCursor('watch') W.SetCursor('watch')
namespacelist = self.getnamespacelist() namespacelist = self.getnamespacelist()
self.namespacemenu.set([("Clear window", self.clearbuffer), ("Font settingsƒ", self.dofontsettings), self.namespacemenu.set([("Clear window", self.clearbuffer), ("Font settings\xc9", self.dofontsettings),
["Namespace"] + namespacelist, ("Browse namespaceƒ", self.browsenamespace)]) ["Namespace"] + namespacelist, ("Browse namespace\xc9", self.browsenamespace)])
currentname = self.consoletext._namespace["__name__"] currentname = self.consoletext._namespace["__name__"]
for i in range(len(namespacelist)): for i in range(len(namespacelist)):
if namespacelist[i][0] == currentname: if namespacelist[i][0] == currentname:
@ -264,7 +264,7 @@ class PyOutput:
tabbable = 0) tabbable = 0)
self.w.outputtext = OutputTextWidget((-1, -1, -14, 1), inset = (6, 5), self.w.outputtext = OutputTextWidget((-1, -1, -14, 1), inset = (6, 5),
fontsettings = self.fontsettings, tabsettings = self.tabsettings, readonly = 1) fontsettings = self.fontsettings, tabsettings = self.tabsettings, readonly = 1)
menuitems = [("Clear window", self.clearbuffer), ("Font settingsƒ", self.dofontsettings)] menuitems = [("Clear window", self.clearbuffer), ("Font settings\xc9", self.dofontsettings)]
self.w.popupmenu = W.PopupMenu((-15, -1, 16, 16), menuitems) self.w.popupmenu = W.PopupMenu((-15, -1, 16, 16), menuitems)
self.w._bary = W.Scrollbar((-15, 14, 16, -14), self.w.outputtext.vscroll, max = 32767) self.w._bary = W.Scrollbar((-15, 14, 16, -14), self.w.outputtext.vscroll, max = 32767)

View file

@ -72,7 +72,7 @@ class Debugger(bdb.Bdb):
self.botframe = bottomframe self.botframe = bottomframe
if running: if running:
self.set_continue() self.set_continue()
self.reason = 'Runningƒ' self.reason = 'Running\xc9'
self.setstate('running') self.setstate('running')
else: else:
self.set_step() self.set_step()
@ -187,7 +187,7 @@ class Debugger(bdb.Bdb):
def makeoptionsmenu(self): def makeoptionsmenu(self):
options = [('Clear breakpoints', self.w.panes.bottom.src.source.clearbreakpoints), options = [('Clear breakpoints', self.w.panes.bottom.src.source.clearbreakpoints),
('Clear all breakpoints', self.clear_all_breaks), ('Clear all breakpoints', self.clear_all_breaks),
('Edit breakpointsƒ', self.edit_breaks), '-', ('Edit breakpoints\xc9', self.edit_breaks), '-',
(self.tracemagic and (self.tracemagic and
'Disable __magic__ tracing' or 'Enable __magic__ tracing', self.togglemagic)] 'Disable __magic__ tracing' or 'Enable __magic__ tracing', self.togglemagic)]
self.w.panes.bottom.src.optionsmenu.set(options) self.w.panes.bottom.src.optionsmenu.set(options)
@ -318,7 +318,7 @@ class Debugger(bdb.Bdb):
def running(self): def running(self):
W.SetCursor('watch') W.SetCursor('watch')
self.reason = 'Runningƒ' self.reason = 'Running\xc9'
self.setstate('running') self.setstate('running')
#self.w.panes.bottom.src.source.set('') #self.w.panes.bottom.src.source.set('')
#self.w.panes.browserpanes.stacklist.stack.set([]) #self.w.panes.browserpanes.stacklist.stack.set([])
@ -350,7 +350,7 @@ class Debugger(bdb.Bdb):
try: try:
f, filename, (suff, mode, dummy) = imp.find_module(modname) f, filename, (suff, mode, dummy) = imp.find_module(modname)
except ImportError: except ImportError:
self.w.panes.bottom.src.source.set('canÕt find file') self.w.panes.bottom.src.source.set("can't find file")
else: else:
if f: if f:
f.close() f.close()
@ -360,9 +360,9 @@ class Debugger(bdb.Bdb):
f.close() f.close()
self.w.panes.bottom.src.source.set(data, filename) self.w.panes.bottom.src.source.set(data, filename)
else: else:
self.w.panes.bottom.src.source.set('canÕt find file') self.w.panes.bottom.src.source.set("can't find file")
else: else:
self.w.panes.bottom.src.source.set('canÕt find file') self.w.panes.bottom.src.source.set("can't find file")
else: else:
self.w.panes.bottom.src.source.set(data, filename) self.w.panes.bottom.src.source.set(data, filename)
self.file = filename self.file = filename
@ -682,7 +682,7 @@ class BreakpointsViewer:
self.w.panes.files = W.List(None, callback = self.filehit) #, flags = Lists.lOnlyOne) self.w.panes.files = W.List(None, callback = self.filehit) #, flags = Lists.lOnlyOne)
self.w.panes.gr = W.Group(None) self.w.panes.gr = W.Group(None)
self.w.panes.gr.breaks = W.List((0, 0, -130, 0), callback = self.linehit) #, flags = Lists.lOnlyOne) self.w.panes.gr.breaks = W.List((0, 0, -130, 0), callback = self.linehit) #, flags = Lists.lOnlyOne)
self.w.panes.gr.openbutton = W.Button((-80, 4, 0, 16), 'Viewƒ', self.openbuttonhit) self.w.panes.gr.openbutton = W.Button((-80, 4, 0, 16), 'View\xc9', self.openbuttonhit)
self.w.panes.gr.deletebutton = W.Button((-80, 28, 0, 16), 'Delete', self.deletebuttonhit) self.w.panes.gr.deletebutton = W.Button((-80, 28, 0, 16), 'Delete', self.deletebuttonhit)
self.w.bind('<close>', self.close) self.w.bind('<close>', self.close)
@ -880,7 +880,7 @@ _debugger = None
def getdebugger(): def getdebugger():
if not __debug__: if not __debug__:
raise W.AlertError, "CanÕt debug in Optimize bytecode” mode.\r(see Default startup options” in EditPythonPreferences)" raise W.AlertError, "Can't debug in \"Optimize bytecode\" mode.\r(see \"Default startup options\" in EditPythonPreferences)"
global _debugger global _debugger
if _debugger is None: if _debugger is None:
_debugger = Debugger() _debugger = Debugger()

View file

@ -101,7 +101,7 @@ class Results:
class Status: class Status:
def __init__(self): def __init__(self):
self.w = W.Dialog((440, 64), "Searchingƒ") self.w = W.Dialog((440, 64), "Searching\xc9")
self.w.searching = W.TextBox((4, 4, -4, 16), "DevDev:PyPyDoc 1.5.1:ext:parseTupleAndKeywords.html") self.w.searching = W.TextBox((4, 4, -4, 16), "DevDev:PyPyDoc 1.5.1:ext:parseTupleAndKeywords.html")
self.w.hits = W.TextBox((4, 24, -4, 16), "Hits: 0") self.w.hits = W.TextBox((4, 24, -4, 16), "Hits: 0")
self.w.canceltip = W.TextBox((4, 44, -4, 16), "Type cmd-period (.) to cancel.") self.w.canceltip = W.TextBox((4, 44, -4, 16), "Type cmd-period (.) to cancel.")

View file

@ -67,7 +67,7 @@ class Editor(W.Window):
else: else:
sourceOS = 'UNIX' sourceOS = 'UNIX'
searchString = '\n' searchString = '\n'
change = EasyDialogs.AskYesNoCancel('%s contains %s-style line feeds. ' change = EasyDialogs.AskYesNoCancel('"%s" contains %s-style line feeds. '
'Change them to MacOS carriage returns?' % (self.title, sourceOS), 1) 'Change them to MacOS carriage returns?' % (self.title, sourceOS), 1)
# bug: Cancel is treated as No # bug: Cancel is treated as No
if change > 0: if change > 0:
@ -224,14 +224,14 @@ class Editor(W.Window):
self.linefield.bind("<click>", self.clicklinefield) self.linefield.bind("<click>", self.clicklinefield)
def makeoptionsmenu(self): def makeoptionsmenu(self):
menuitems = [('Font settingsƒ', self.domenu_fontsettings), menuitems = [('Font settings\xc9', self.domenu_fontsettings),
("Save optionsƒ", self.domenu_options), ("Save options\xc9", self.domenu_options),
'-', '-',
('\0' + chr(self.run_as_main) + 'Run as __main__', self.domenu_toggle_run_as_main), ('\0' + chr(self.run_as_main) + 'Run as __main__', self.domenu_toggle_run_as_main),
#('\0' + chr(self.run_with_interpreter) + 'Run with Interpreter', self.domenu_toggle_run_with_interpreter), #('\0' + chr(self.run_with_interpreter) + 'Run with Interpreter', self.domenu_toggle_run_with_interpreter),
#'-', #'-',
('Modularize', self.domenu_modularize), ('Modularize', self.domenu_modularize),
('Browse namespaceƒ', self.domenu_browsenamespace), ('Browse namespace\xc9', self.domenu_browsenamespace),
'-'] '-']
if self.profiling: if self.profiling:
menuitems = menuitems + [('Disable profiler', self.domenu_toggleprofiler)] menuitems = menuitems + [('Disable profiler', self.domenu_toggleprofiler)]
@ -240,7 +240,7 @@ class Editor(W.Window):
if self.editgroup.editor._debugger: if self.editgroup.editor._debugger:
menuitems = menuitems + [('Disable debugger', self.domenu_toggledebugger), menuitems = menuitems + [('Disable debugger', self.domenu_toggledebugger),
('Clear breakpoints', self.domenu_clearbreakpoints), ('Clear breakpoints', self.domenu_clearbreakpoints),
('Edit breakpointsƒ', self.domenu_editbreakpoints)] ('Edit breakpoints\xc9', self.domenu_editbreakpoints)]
else: else:
menuitems = menuitems + [('Enable debugger', self.domenu_toggledebugger)] menuitems = menuitems + [('Enable debugger', self.domenu_toggledebugger)]
self.editgroup.optionsmenu.set(menuitems) self.editgroup.optionsmenu.set(menuitems)
@ -285,7 +285,7 @@ class Editor(W.Window):
def domenu_modularize(self, *args): def domenu_modularize(self, *args):
modname = _filename_as_modname(self.title) modname = _filename_as_modname(self.title)
if not modname: if not modname:
raise W.AlertError, 'CanÕt modularize %s' % self.title raise W.AlertError, "Can't modularize \"%s\"" % self.title
run_as_main = self.run_as_main run_as_main = self.run_as_main
self.run_as_main = 0 self.run_as_main = 0
self.run() self.run()
@ -360,7 +360,7 @@ class Editor(W.Window):
import EasyDialogs import EasyDialogs
import Qd import Qd
Qd.InitCursor() # XXX should be done by dialog Qd.InitCursor() # XXX should be done by dialog
save = EasyDialogs.AskYesNoCancel('Save window %s before closing?' % self.title, 1) save = EasyDialogs.AskYesNoCancel('Save window "%s" before closing?' % self.title, 1)
if save > 0: if save > 0:
if self.domenu_save(): if self.domenu_save():
return 1 return 1
@ -416,11 +416,7 @@ class Editor(W.Window):
W.getapplication().makescriptsmenu() W.getapplication().makescriptsmenu()
def domenu_save_as_applet(self, *args): def domenu_save_as_applet(self, *args):
try: import buildtools
import buildtools
except ImportError:
# only have buildtools in Python >= 1.5.2
raise W.AlertError, "Save as Applet” is only supported in\rPython 1.5.2 and up."
buildtools.DEBUG = 0 # ouch. buildtools.DEBUG = 0 # ouch.
@ -504,7 +500,7 @@ class Editor(W.Window):
if self.editgroup.editor.changed: if self.editgroup.editor.changed:
import EasyDialogs import EasyDialogs
import Qd; Qd.InitCursor() import Qd; Qd.InitCursor()
save = EasyDialogs.AskYesNoCancel('Save %s before running?' % self.title, 1) save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1)
if save > 0: if save > 0:
if self.domenu_save(): if self.domenu_save():
return return
@ -560,23 +556,23 @@ class Editor(W.Window):
classname = string.split(string.strip(line[6:]))[0] classname = string.split(string.strip(line[6:]))[0]
classend = identifieRE_match(classname) classend = identifieRE_match(classname)
if classend < 1: if classend < 1:
raise W.AlertError, 'CanÕt find a class.' raise W.AlertError, "Can't find a class."
classname = classname[:classend] classname = classname[:classend]
break break
elif line and line[0] not in '\t#': elif line and line[0] not in '\t#':
raise W.AlertError, 'CanÕt find a class.' raise W.AlertError, "Can't find a class."
else: else:
raise W.AlertError, 'CanÕt find a class.' raise W.AlertError, "Can't find a class."
if globals.has_key(classname): if globals.has_key(classname):
locals = globals[classname].__dict__ locals = globals[classname].__dict__
else: else:
raise W.AlertError, 'CanÕt find class %s”.' % classname raise W.AlertError, "Can't find class \"%s\"." % classname
# dedent to top level # dedent to top level
for i in range(len(lines)): for i in range(len(lines)):
lines[i] = lines[i][1:] lines[i] = lines[i][1:]
pytext = string.join(lines, '\r') pytext = string.join(lines, '\r')
elif indent > 0: elif indent > 0:
raise W.AlertError, 'CanÕt run indented code.' raise W.AlertError, "Can't run indented code."
# add "newlines" to fool compile/exec: # add "newlines" to fool compile/exec:
# now a traceback will give the right line number # now a traceback will give the right line number
@ -839,7 +835,7 @@ class SearchEngine:
self.buttons = [ ("Find", "cmdf", self.find), self.buttons = [ ("Find", "cmdf", self.find),
("Replace", "cmdr", self.replace), ("Replace", "cmdr", self.replace),
("Replace all", None, self.replaceall), ("Replace all", None, self.replaceall),
("DonÕt find", "cmdd", self.dont), ("Don't find", "cmdd", self.dont),
("Cancel", "cmd.", self.cancel) ("Cancel", "cmd.", self.cancel)
] ]
for i in range(len(self.buttons)): for i in range(len(self.buttons)):
@ -848,7 +844,7 @@ class SearchEngine:
self.w[title] = W.Button(bounds, title, callback) self.w[title] = W.Button(bounds, title, callback)
if shortcut: if shortcut:
self.w.bind(shortcut, self.w[title].push) self.w.bind(shortcut, self.w[title].push)
self.w.setdefaultbutton(self.w["DonÕt find"]) self.w.setdefaultbutton(self.w["Don't find"])
self.w.find.edit.bind("<key>", self.key) self.w.find.edit.bind("<key>", self.key)
self.w.bind("<activate>", self.activate) self.w.bind("<activate>", self.activate)
self.w.bind("<close>", self.close) self.w.bind("<close>", self.close)
@ -881,11 +877,11 @@ class SearchEngine:
else: else:
for title, cmd, call in self.buttons[:-2]: for title, cmd, call in self.buttons[:-2]:
self.w[title].enable(0) self.w[title].enable(0)
self.w.setdefaultbutton(self.w["DonÕt find"]) self.w.setdefaultbutton(self.w["Don't find"])
else: else:
for title, cmd, call in self.buttons[:-2]: for title, cmd, call in self.buttons[:-2]:
self.w[title].enable(0) self.w[title].enable(0)
self.w.setdefaultbutton(self.w["DonÕt find"]) self.w.setdefaultbutton(self.w["Don't find"])
def find(self): def find(self):
self.getparmsfromwindow() self.getparmsfromwindow()
@ -1204,7 +1200,7 @@ class _EditorDefaultSettings:
self.template = "%s, %d point" self.template = "%s, %d point"
self.fontsettings, self.tabsettings, self.windowsize = geteditorprefs() self.fontsettings, self.tabsettings, self.windowsize = geteditorprefs()
self.w = W.Dialog((328, 120), "Editor default settings") self.w = W.Dialog((328, 120), "Editor default settings")
self.w.setfontbutton = W.Button((8, 8, 80, 16), "Set fontƒ", self.dofont) self.w.setfontbutton = W.Button((8, 8, 80, 16), "Set font\xc9", self.dofont)
self.w.fonttext = W.TextBox((98, 10, -8, 14), self.template % (self.fontsettings[0], self.fontsettings[2])) self.w.fonttext = W.TextBox((98, 10, -8, 14), self.template % (self.fontsettings[0], self.fontsettings[2]))
self.w.picksizebutton = W.Button((8, 50, 80, 16), "Front window", self.picksize) self.w.picksizebutton = W.Button((8, 50, 80, 16), "Front window", self.picksize)

View file

@ -1,9 +1,9 @@
# copyright 1996-1999 Just van Rossum, Letterror. just@letterror.com # copyright 1996-2001 Just van Rossum, Letterror. just@letterror.com
# keep this (__main__) as clean as possible, since we are using # keep this (__main__) as clean as possible, since we are using
# it like the "normal" interpreter. # it like the "normal" interpreter.
__version__ = '1.0' __version__ = '1.0.1'
def init(): def init():

Binary file not shown.

View file

@ -50,13 +50,13 @@ class PythonIDE(Wapplication.Application):
def makeusermenus(self): def makeusermenus(self):
m = Wapplication.Menu(self.menubar, "File") m = Wapplication.Menu(self.menubar, "File")
newitem = FrameWork.MenuItem(m, "New", "N", 'new') newitem = FrameWork.MenuItem(m, "New", "N", 'new')
openitem = FrameWork.MenuItem(m, "Openƒ", "O", 'open') openitem = FrameWork.MenuItem(m, "Open\xc9", "O", 'open')
FrameWork.Separator(m) FrameWork.Separator(m)
closeitem = FrameWork.MenuItem(m, "Close", "W", 'close') closeitem = FrameWork.MenuItem(m, "Close", "W", 'close')
saveitem = FrameWork.MenuItem(m, "Save", "S", 'save') saveitem = FrameWork.MenuItem(m, "Save", "S", 'save')
saveasitem = FrameWork.MenuItem(m, "Save asƒ", None, 'save_as') saveasitem = FrameWork.MenuItem(m, "Save as\xc9", None, 'save_as')
FrameWork.Separator(m) FrameWork.Separator(m)
saveasappletitem = FrameWork.MenuItem(m, "Save as Appletƒ", None, 'save_as_applet') saveasappletitem = FrameWork.MenuItem(m, "Save as Applet\xc9", None, 'save_as_applet')
FrameWork.Separator(m) FrameWork.Separator(m)
quititem = FrameWork.MenuItem(m, "Quit", "Q", 'quit') quititem = FrameWork.MenuItem(m, "Quit", "Q", 'quit')
@ -71,7 +71,7 @@ class PythonIDE(Wapplication.Application):
selallitem = FrameWork.MenuItem(m, "Select all", "A", "selectall") selallitem = FrameWork.MenuItem(m, "Select all", "A", "selectall")
sellineitem = FrameWork.MenuItem(m, "Select line", "L", "selectline") sellineitem = FrameWork.MenuItem(m, "Select line", "L", "selectline")
FrameWork.Separator(m) FrameWork.Separator(m)
finditem = FrameWork.MenuItem(m, "Findƒ", "F", "find") finditem = FrameWork.MenuItem(m, "Find\xc9", "F", "find")
findagainitem = FrameWork.MenuItem(m, "Find again", 'G', "findnext") findagainitem = FrameWork.MenuItem(m, "Find again", 'G', "findnext")
enterselitem = FrameWork.MenuItem(m, "Enter search string", "E", "entersearchstring") enterselitem = FrameWork.MenuItem(m, "Enter search string", "E", "entersearchstring")
replaceitem = FrameWork.MenuItem(m, "Replace", None, "replace") replaceitem = FrameWork.MenuItem(m, "Replace", None, "replace")
@ -84,12 +84,12 @@ class PythonIDE(Wapplication.Application):
runitem = FrameWork.MenuItem(m, "Run window", "R", 'run') runitem = FrameWork.MenuItem(m, "Run window", "R", 'run')
runselitem = FrameWork.MenuItem(m, "Run selection", None, 'runselection') runselitem = FrameWork.MenuItem(m, "Run selection", None, 'runselection')
FrameWork.Separator(m) FrameWork.Separator(m)
moditem = FrameWork.MenuItem(m, "Module browserƒ", "M", self.domenu_modulebrowser) moditem = FrameWork.MenuItem(m, "Module browser\xc9", "M", self.domenu_modulebrowser)
FrameWork.Separator(m) FrameWork.Separator(m)
mm = FrameWork.SubMenu(m, "Preferences") mm = FrameWork.SubMenu(m, "Preferences")
FrameWork.MenuItem(mm, "Set Scripts folderƒ", None, self.do_setscriptsfolder) FrameWork.MenuItem(mm, "Set Scripts folder\xc9", None, self.do_setscriptsfolder)
FrameWork.MenuItem(mm, "Editor default settingsƒ", None, self.do_editorprefs) FrameWork.MenuItem(mm, "Editor default settings\xc9", None, self.do_editorprefs)
FrameWork.MenuItem(mm, "Set default window fontƒ", None, self.do_setwindowfont) FrameWork.MenuItem(mm, "Set default window font\xc9", None, self.do_setwindowfont)
self.openwindowsmenu = Wapplication.Menu(self.menubar, 'Windows') self.openwindowsmenu = Wapplication.Menu(self.menubar, 'Windows')
self.makeopenwindowsmenu() self.makeopenwindowsmenu()
@ -110,7 +110,7 @@ class PythonIDE(Wapplication.Application):
path = os.path.join(os.getcwd(), "Scripts") path = os.path.join(os.getcwd(), "Scripts")
if not os.path.exists(path): if not os.path.exists(path):
os.mkdir(path) os.mkdir(path)
f = open(os.path.join(path, "Place your scripts hereƒ"), "w") f = open(os.path.join(path, "Place your scripts here\xc9"), "w")
f.close() f.close()
fss = macfs.FSSpec(path) fss = macfs.FSSpec(path)
self.scriptsfolder = fss.NewAlias() self.scriptsfolder = fss.NewAlias()
@ -156,10 +156,10 @@ class PythonIDE(Wapplication.Application):
if ftype == 'TEXT': if ftype == 'TEXT':
self.openscript(path) self.openscript(path)
else: else:
W.Message("CanÕt open file of type '%s'." % ftype) W.Message("Can't open file of type '%s'." % ftype)
def getabouttext(self): def getabouttext(self):
return "About Python IDEƒ" return "About Python IDE\xc9"
def do_about(self, id, item, window, event): def do_about(self, id, item, window, event):
Splash.about() Splash.about()

View file

@ -24,6 +24,9 @@ def uninstall_importhook():
_progress = 0 _progress = 0
_about_width = 440
_about_height = 340
def importing(module): def importing(module):
global _progress global _progress
Qd.SetPort(splash) Qd.SetPort(splash)
@ -32,17 +35,19 @@ def importing(module):
fontID = geneva fontID = geneva
Qd.TextFont(fontID) Qd.TextFont(fontID)
Qd.TextSize(9) Qd.TextSize(9)
rect = (35, 265, 365, 281) labelrect = (35, _about_height - 35, _about_width - 35, _about_height - 19)
framerect = (35, _about_height - 19, _about_width - 35, _about_height - 11)
l, t, r, b = progrect = Qd.InsetRect(framerect, 1, 1)
if module: if module:
TE.TETextBox('Importing: ' + module, rect, 0) TE.TETextBox('Importing: ' + module, labelrect, 0)
if not _progress: if not _progress:
Qd.FrameRect((35, 281, 365, 289)) Qd.FrameRect(framerect)
pos = min(36 + 330 * _progress / 44, 364) pos = min(r, l + ((r - l) * _progress) / 44)
Qd.PaintRect((36, 282, pos, 288)) Qd.PaintRect((l, t, pos, b))
_progress = _progress + 1 _progress = _progress + 1
else: else:
Qd.EraseRect(rect) Qd.EraseRect(labelrect)
Qd.PaintRect((36, 282, pos, 288)) Qd.PaintRect((l, t, pos, b))
Qd.QDFlushPortBuffer(splash.GetDialogWindow().GetWindowPort(), None) Qd.QDFlushPortBuffer(splash.GetDialogWindow().GetWindowPort(), None)
def my__import__(name, globals=None, locals=None, fromlist=None): def my__import__(name, globals=None, locals=None, fromlist=None):
@ -71,20 +76,20 @@ import sys
_keepsplashscreenopen = 0 _keepsplashscreenopen = 0
abouttext1 = """The Python Integrated Development Environment for the MacintoshŽ abouttext1 = """The Python Integrated Development Environment for the Macintosh\xaa
Version: %s Version: %s
Copyright 1997-2000 Just van Rossum, Letterror. <just@letterror.com> Copyright 1997-2001 Just van Rossum, Letterror. <just@letterror.com>
Python %s Python %s
%s %s
See: <http://www.python.org/> for information and documentation.""" See: <http://www.python.org/> for information and documentation."""
flauwekul = [ 'Goodday, Bruce.', flauwekul = [ "Goodday, Bruce.",
'WhatÕs new?', "What's new?",
'Nudge, nudge, say no more!', "Nudge, nudge, say no more!",
'No, no sir, itÕs not dead. ItÕs resting.', "No, no sir, it's not dead. It's resting.",
'Albatros!', "Albatros!",
'ItÕs . . .', "It's . . .",
'Is your name not Bruce, then?', "Is your name not Bruce, then?",
"""But Mr F.G. Superman has a secret identity . . . """But Mr F.G. Superman has a secret identity . . .
when trouble strikes at any time . . . when trouble strikes at any time . . .
at any place . . . he is ready to become . . . at any place . . . he is ready to become . . .
@ -111,7 +116,7 @@ def drawtext(what = 0):
fontID = geneva fontID = geneva
Qd.TextFont(fontID) Qd.TextFont(fontID)
Qd.TextSize(9) Qd.TextSize(9)
rect = (10, 115, 390, 290) rect = (10, 115, _about_width - 10, _about_height - 30)
if not what: if not what:
import __main__ import __main__
abouttxt = nl2return(abouttext1 % ( abouttxt = nl2return(abouttext1 % (
@ -134,6 +139,7 @@ def wait():
Qd.InitCursor() Qd.InitCursor()
time = Evt.TickCount() time = Evt.TickCount()
whattext = 0 whattext = 0
drawtext(whattext)
while _keepsplashscreenopen: while _keepsplashscreenopen:
ok, event = Evt.EventAvail(Events.highLevelEventMask) ok, event = Evt.EventAvail(Events.highLevelEventMask)
if ok: if ok:
@ -154,7 +160,7 @@ def wait():
drawtext(whattext) drawtext(whattext)
time = Evt.TickCount() time = Evt.TickCount()
del splash del splash
#Res.CloseResFile(splashresfile)
def about(): def about():
global splash, splashresfile, _keepsplashscreenopen global splash, splashresfile, _keepsplashscreenopen

View file

@ -344,18 +344,18 @@ class Application(FrameWork.Application):
# XXX and that's the last thing we want here. # XXX and that's the last thing we want here.
f, filename, (suff, mode, dummy) = imp.find_module(modname) f, filename, (suff, mode, dummy) = imp.find_module(modname)
except ImportError: except ImportError:
raise W.AlertError, "CanÕt find file for %s" % modname raise W.AlertError, "Can't find file for \"%s\"" % modname
else: else:
if not f: if not f:
raise W.AlertError, "CanÕt find file for %s" % modname raise W.AlertError, "Can't find file for \"%s\"" % modname
f.close() f.close()
if suff == '.py': if suff == '.py':
self.openscript(filename, lineno, charoffset) self.openscript(filename, lineno, charoffset)
return return
else: else:
raise W.AlertError, "CanÕt find file for %s" % modname raise W.AlertError, "Can't find file for \"%s\"" % modname
else: else:
raise W.AlertError, "CanÕt find file •%sÕ" % filename raise W.AlertError, "Can't find file \"%s\"" % filename
if lineno is not None: if lineno is not None:
editor.selectline(lineno, charoffset) editor.selectline(lineno, charoffset)
return editor return editor

View file

@ -871,7 +871,7 @@ class PyEditor(TextEditor):
if onoff: if onoff:
if not __debug__: if not __debug__:
import W import W
raise W.AlertError, "CanÕt debug in Optimize bytecode” mode.\r(see Default startup options” in EditPythonPreferences)" raise W.AlertError, "Can't debug in \"Optimize bytecode\" mode.\r(see \"Default startup options\" in EditPythonPreferences)"
import PyDebugger import PyDebugger
self._debugger = PyDebugger.getdebugger() self._debugger = PyDebugger.getdebugger()
self._debugger.register_editor(self, self.file) self._debugger.register_editor(self, self.file)

View file

@ -57,7 +57,7 @@ class TraceBack:
filename = os.path.split(filename)[1] filename = os.path.split(filename)[1]
if lineno: if lineno:
charno = charno - 1 charno = charno - 1
text = str(value) + '\rFile: "' + str(filename) + '", line ' + str(lineno) + '\r\r' + line[:charno] + "" + line[charno:-1] text = str(value) + '\rFile: "' + str(filename) + '", line ' + str(lineno) + '\r\r' + line[:charno] + "\xa5" + line[charno:-1]
else: else:
text = str(value) + '\rFile: "' + str(filename) + '"' text = str(value) + '\rFile: "' + str(filename) + '"'
self.syntaxdialog = W.ModalDialog((360, 120), "Syntax Error") self.syntaxdialog = W.ModalDialog((360, 120), "Syntax Error")
@ -123,10 +123,10 @@ class TraceBack:
self.w.editbutton = W.Button((10, -30, 60, 16), "Edit", self.edit) self.w.editbutton = W.Button((10, -30, 60, 16), "Edit", self.edit)
self.w.editbutton.enable(0) self.w.editbutton.enable(0)
self.w.browselocalsbutton = W.Button((80, -30, 100, 16), "Browse localsƒ", self.browselocals) self.w.browselocalsbutton = W.Button((80, -30, 100, 16), "Browse locals\xc9", self.browselocals)
self.w.browselocalsbutton.enable(0) self.w.browselocalsbutton.enable(0)
self.w.postmortembutton = W.Button((190, -30, 100, 16), "Post mortemƒ", self.postmortem) self.w.postmortembutton = W.Button((190, -30, 100, 16), "Post mortem\xc9", self.postmortem)
self.w.setdefaultbutton(self.w.editbutton) self.w.setdefaultbutton(self.w.editbutton)
self.w.bind("cmdb", self.w.browselocalsbutton.push) self.w.bind("cmdb", self.w.browselocalsbutton.push)

View file

@ -568,7 +568,7 @@ def FrontWindowInsert(stuff):
pass pass
import EasyDialogs import EasyDialogs
if EasyDialogs.AskYesNoCancel( if EasyDialogs.AskYesNoCancel(
"CanÕt find window or widget to insert text into; copy to clipboard instead?", "Can't find window or widget to insert text into; copy to clipboard instead?",
1) == 1: 1) == 1:
import Scrap import Scrap
Scrap.ZeroScrap() Scrap.ZeroScrap()