Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17967/framework
Modified Files:
Tag: py3k
app.py bitmap.py dbgcommands.py dlgappcore.py help.py
interact.py intpyapp.py intpydde.py mdi_pychecker.py
scriptutils.py sgrepmdi.py startup.py stdin.py toolmenu.py
winout.py
Log Message:
Changes for Python 3
Index: intpyapp.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/intpyapp.py,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -C2 -d -r1.11 -r1.11.2.1
*** intpyapp.py 9 Aug 2008 16:47:07 -0000 1.11
--- intpyapp.py 29 Aug 2008 06:16:41 -0000 1.11.2.1
***************
*** 7,15 ****
import sys
import string
! import app
import traceback
from pywin.mfc import window, afxres, dialog
import commctrl
! import dbgcommands
lastLocateFileName = ".py" # used in the "File/Locate" dialog...
--- 7,15 ----
import sys
import string
! from . import app
import traceback
from pywin.mfc import window, afxres, dialog
import commctrl
! from . import dbgcommands
lastLocateFileName = ".py" # used in the "File/Locate" dialog...
***************
*** 47,51 ****
# And a "Tools" menu on the main frame.
menu = self.GetMenu()
! import toolmenu
toolmenu.SetToolsMenu(menu, 2)
# And fix the "Help" menu on the main frame
--- 47,51 ----
# And a "Tools" menu on the main frame.
menu = self.GetMenu()
! from . import toolmenu
toolmenu.SetToolsMenu(menu, 2)
# And fix the "Help" menu on the main frame
***************
*** 128,133 ****
# Return None if no existing instance
try:
! import intpydde
except ImportError:
# No dde support!
return None
--- 128,134 ----
# Return None if no existing instance
try:
! from . import intpydde
except ImportError:
+ traceback.print_exc()
# No dde support!
return None
***************
*** 144,148 ****
# remote DDE app, and we should terminate.
try:
! import intpydde
except ImportError:
self.ddeServer = None
--- 145,149 ----
# remote DDE app, and we should terminate.
try:
! from . import intpydde
except ImportError:
self.ddeServer = None
***************
*** 177,183 ****
# Allow Pythonwin to host OCX controls.
win32ui.EnableControlContainer()
!
! # Display the interactive window if the user wants it.
! import interact
interact.CreateInteractiveWindowUserPreference()
--- 178,182 ----
# Allow Pythonwin to host OCX controls.
win32ui.EnableControlContainer()
! from . import interact
interact.CreateInteractiveWindowUserPreference()
***************
*** 206,210 ****
win32ui.DestroyDebuggerThread()
try:
! import interact
interact.DestroyInteractiveWindow()
except:
--- 205,209 ----
win32ui.DestroyDebuggerThread()
try:
! from . import interact
interact.DestroyInteractiveWindow()
except:
***************
*** 238,247 ****
argType = args[0]
if argStart >= len(args):
! raise TypeError, "The command line requires an additional arg."
if argType=="/edit":
# Load up the default application.
if dde:
fname = win32api.GetFullPathName(args[argStart])
! dde.Exec("win32ui.GetApp().OpenDocumentFile(%s)" % (`fname`))
else:
win32ui.GetApp().OpenDocumentFile(args[argStart])
--- 237,246 ----
argType = args[0]
if argStart >= len(args):
! raise TypeError("The command line requires an additional arg.")
if argType=="/edit":
# Load up the default application.
if dde:
fname = win32api.GetFullPathName(args[argStart])
! dde.Exec("win32ui.GetApp().OpenDocumentFile(%s)" % (repr(fname)))
else:
win32ui.GetApp().OpenDocumentFile(args[argStart])
***************
*** 250,254 ****
dde.Exec("import scriptutils;scriptutils.RunScript('%s', '%s', 1)" % (args[argStart], ' '.join(args[argStart+1:])))
else:
! import scriptutils
scriptutils.RunScript(args[argStart], ' '.join(args[argStart+1:]))
elif argType=="/run":
--- 249,253 ----
dde.Exec("import scriptutils;scriptutils.RunScript('%s', '%s', 1)" % (args[argStart], ' '.join(args[argStart+1:])))
else:
! from . import scriptutils
scriptutils.RunScript(args[argStart], ' '.join(args[argStart+1:]))
elif argType=="/run":
***************
*** 256,263 ****
dde.Exec("import scriptutils;scriptutils.RunScript('%s', '%s', 0)" % (args[argStart], ' '.join(args[argStart+1:])))
else:
! import scriptutils
scriptutils.RunScript(args[argStart], ' '.join(args[argStart+1:]), 0)
elif argType=="/app":
! raise RuntimeError, "/app only supported for new instances of Pythonwin.exe"
elif argType=='/new': # Allow a new instance of Pythonwin
return 1
--- 255,262 ----
dde.Exec("import scriptutils;scriptutils.RunScript('%s', '%s', 0)" % (args[argStart], ' '.join(args[argStart+1:])))
else:
! from . import scriptutils
scriptutils.RunScript(args[argStart], ' '.join(args[argStart+1:]), 0)
elif argType=="/app":
! raise RuntimeError("/app only supported for new instances of Pythonwin.exe")
elif argType=='/new': # Allow a new instance of Pythonwin
return 1
***************
*** 268,277 ****
win32ui.MessageBox("The /dde command can only be used\r\nwhen Pythonwin is already running")
else:
! raise TypeError, "Command line arguments not recognised"
except:
typ, val, tb = sys.exc_info()
! print "There was an error processing the command line args"
traceback.print_exception(typ, val, tb, None, sys.stdout)
! win32ui.OutputDebug("There was a problem with the command line args - %s: %s" % (`typ`,`val`))
tb = None # Prevent a cycle
--- 267,276 ----
win32ui.MessageBox("The /dde command can only be used\r\nwhen Pythonwin is already running")
else:
! raise TypeError("Command line arguments not recognised")
except:
typ, val, tb = sys.exc_info()
! print("There was an error processing the command line args")
traceback.print_exception(typ, val, tb, None, sys.stdout)
! win32ui.OutputDebug("There was a problem with the command line args - %s: %s" % (repr(typ),repr(val)))
tb = None # Prevent a cycle
***************
*** 292,300 ****
for module in modules:
try:
! exec "import "+module
except: # Catch em all, else the app itself dies! 'ImportError:
traceback.print_exc()
msg = 'Startup import of user module "%s" failed' % module
! print msg
win32ui.MessageBox(msg)
--- 291,299 ----
for module in modules:
try:
! exec("from . import "+module)
except: # Catch em all, else the app itself dies! 'ImportError:
traceback.print_exc()
msg = 'Startup import of user module "%s" failed' % module
! print(msg)
win32ui.MessageBox(msg)
***************
*** 303,312 ****
#
def OnDDECommand(self, command):
! # print "DDE Executing", `command`
try:
! exec command + "\n"
except:
! print "ERROR executing DDE command: ", command
! traceback.print_exc()
raise
--- 302,312 ----
#
def OnDDECommand(self, command):
! print ("DDE Executing", repr(command))
try:
! exec(command + "\n")
except:
! t,v,tb=sys.exc_info()
! print("ERROR executing DDE command: ", command)
! traceback.print_exception(t,v,tb)
raise
***************
*** 333,351 ****
def OnFileImport( self, id, code ):
" Called when a FileImport message is received. Import the current or specified file"
! import scriptutils
scriptutils.ImportFile()
def OnFileCheck( self, id, code ):
" Called when a FileCheck message is received. Check the current file."
! import scriptutils
scriptutils.CheckFile()
def OnUpdateFileCheck(self, cmdui):
! import scriptutils
cmdui.Enable( scriptutils.GetActiveFileName(0) is not None )
def OnFileRun( self, id, code ):
" Called when a FileRun message is received. "
! import scriptutils
showDlg = win32api.GetKeyState(win32con.VK_SHIFT) >= 0
scriptutils.RunScript(None, None, showDlg)
--- 333,351 ----
def OnFileImport( self, id, code ):
" Called when a FileImport message is received. Import the current or specified file"
! from . import scriptutils
scriptutils.ImportFile()
def OnFileCheck( self, id, code ):
" Called when a FileCheck message is received. Check the current file."
! from . import scriptutils
scriptutils.CheckFile()
def OnUpdateFileCheck(self, cmdui):
! from . import scriptutils
cmdui.Enable( scriptutils.GetActiveFileName(0) is not None )
def OnFileRun( self, id, code ):
" Called when a FileRun message is received. "
! from . import scriptutils
showDlg = win32api.GetKeyState(win32con.VK_SHIFT) >= 0
scriptutils.RunScript(None, None, showDlg)
***************
*** 353,357 ****
def OnFileLocate( self, id, code ):
from pywin.mfc import dialog
! import scriptutils
import os
global lastLocateFileName # save the new version away for next time...
--- 353,357 ----
def OnFileLocate( self, id, code ):
from pywin.mfc import dialog
! from . import scriptutils
import os
global lastLocateFileName # save the new version away for next time...
***************
*** 382,387 ****
from pywin.dialogs import ideoptions
sheet.AddPage( ideoptions.OptionsPropPage() )
!
! import toolmenu
sheet.AddPage( toolmenu.ToolMenuPropPage() )
--- 382,386 ----
from pywin.dialogs import ideoptions
sheet.AddPage( ideoptions.OptionsPropPage() )
! from . import toolmenu
sheet.AddPage( toolmenu.ToolMenuPropPage() )
***************
*** 416,420 ****
def OnInteractiveWindow(self, id, code):
# toggle the existing state.
! import interact
interact.ToggleInteractiveWindow()
--- 415,419 ----
def OnInteractiveWindow(self, id, code):
# toggle the existing state.
! from . import interact
interact.ToggleInteractiveWindow()
***************
*** 431,436 ****
# Only attempt to save editor documents.
from pywin.framework.editor import editorTemplate
! docs = filter(lambda doc: doc.IsModified() and doc.GetPathName(), editorTemplate.GetDocumentList())
! map(lambda doc: doc.OnSaveDocument(doc.GetPathName()), docs)
win32ui.SetStatusText("%d documents saved" % len(docs), 1)
--- 430,435 ----
# Only attempt to save editor documents.
from pywin.framework.editor import editorTemplate
! docs = [doc for doc in editorTemplate.GetDocumentList() if doc.IsModified() and doc.GetPathName()]
! list(map(lambda doc: doc.OnSaveDocument(doc.GetPathName()), docs))
win32ui.SetStatusText("%d documents saved" % len(docs), 1)
***************
*** 444,448 ****
def OnHelpIndex( self, id, code ):
! import help
help.SelectAndRunHelpFile()
--- 443,447 ----
def OnHelpIndex( self, id, code ):
! from . import help
help.SelectAndRunHelpFile()
Index: mdi_pychecker.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/mdi_pychecker.py,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** mdi_pychecker.py 9 Aug 2008 16:47:07 -0000 1.2
--- mdi_pychecker.py 29 Aug 2008 06:16:42 -0000 1.2.2.1
***************
*** 39,43 ****
import win32con
import sys, string, re, glob, os, stat, time
! import scriptutils
def getsubdirs(d):
--- 39,43 ----
import win32con
import sys, string, re, glob, os, stat, time
! from . import scriptutils
def getsubdirs(d):
***************
*** 57,61 ****
if os.path.isdir(d):
d = d.lower()
! if not dirs.has_key(d):
dirs[d] = None
if recurse:
--- 57,61 ----
if os.path.isdir(d):
d = d.lower()
! if d not in dirs:
dirs[d] = None
if recurse:
***************
*** 63,67 ****
for sd in subdirs:
sd = sd.lower()
! if not dirs.has_key(sd):
dirs[sd] = None
elif os.path.isfile(d):
--- 63,67 ----
for sd in subdirs:
sd = sd.lower()
! if sd not in dirs:
dirs[sd] = None
elif os.path.isfile(d):
***************
*** 69,73 ****
else:
x = None
! if os.environ.has_key(d):
x = dirpath(os.environ[d])
elif d[:5] == 'HKEY_':
--- 69,73 ----
else:
x = None
! if d in os.environ:
x = dirpath(os.environ[d])
elif d[:5] == 'HKEY_':
***************
*** 90,94 ****
if x:
for xd in x:
! if not dirs.has_key(xd):
dirs[xd] = None
if recurse:
--- 90,94 ----
if x:
for xd in x:
! if xd not in dirs:
dirs[xd] = None
if recurse:
***************
*** 96,103 ****
for sd in subdirs:
sd = sd.lower()
! if not dirs.has_key(sd):
dirs[sd] = None
self.dirs = []
! for d in dirs.keys():
self.dirs.append(d)
--- 96,103 ----
for sd in subdirs:
sd = sd.lower()
! if sd not in dirs:
dirs[sd] = None
self.dirs = []
! for d in list(dirs.keys()):
self.dirs.append(d)
***************
*** 248,252 ****
self.GetFirstView().Append('#Pychecker Run in '+self.dirpattern+' %s\n'%time.asctime())
if self.verbose:
! self.GetFirstView().Append('# ='+`self.dp.dirs`+'\n')
self.GetFirstView().Append('# Files '+self.filpattern+'\n')
self.GetFirstView().Append('# Options '+self.greppattern+'\n')
--- 248,252 ----
self.GetFirstView().Append('#Pychecker Run in '+self.dirpattern+' %s\n'%time.asctime())
if self.verbose:
! self.GetFirstView().Append('# ='+repr(self.dp.dirs)+'\n')
self.GetFirstView().Append('# Files '+self.filpattern+'\n')
self.GetFirstView().Append('# Options '+self.greppattern+'\n')
***************
*** 262,266 ****
##self.flist = glob.glob(self.dp[0]+'\\'+self.fplist[0])
import operator
! self.flist = reduce(operator.add, map(glob.glob,self.fplist) )
#import pywin.debugger;pywin.debugger.set_trace()
self.startPycheckerRun()
--- 262,266 ----
##self.flist = glob.glob(self.dp[0]+'\\'+self.fplist[0])
import operator
! self.flist = reduce(operator.add, list(map(glob.glob,self.fplist)) )
#import pywin.debugger;pywin.debugger.set_trace()
self.startPycheckerRun()
***************
*** 276,281 ****
old=win32api.SetCursor(win32api.LoadCursor(0, win32con.IDC_APPSTARTING))
win32ui.GetApp().AddIdleHandler(self.idleHandler)
! import thread
! thread.start_new(self.threadPycheckerRun,())
##win32api.SetCursor(old)
def threadPycheckerRun(self):
--- 276,281 ----
old=win32api.SetCursor(win32api.LoadCursor(0, win32con.IDC_APPSTARTING))
win32ui.GetApp().AddIdleHandler(self.idleHandler)
! import _thread
! _thread.start_new(self.threadPycheckerRun,())
##win32api.SetCursor(old)
def threadPycheckerRun(self):
***************
*** 313,317 ****
finally:
self.result=result
! print '== Pychecker run finished =='
self.GetFirstView().Append('\n'+'== Pychecker run finished ==')
self.SetModifiedFlag(0)
--- 313,317 ----
finally:
self.result=result
! print('== Pychecker run finished ==')
self.GetFirstView().Append('\n'+'== Pychecker run finished ==')
self.SetModifiedFlag(0)
***************
*** 327,331 ****
line = lines[i]
if self.pat.search(line) != None:
! self.GetFirstView().Append(f+'('+`i+1` + ') '+line)
else:
self.fndx = -1
--- 327,331 ----
line = lines[i]
if self.pat.search(line) != None:
! self.GetFirstView().Append(f+'('+repr(i+1) + ') '+line)
else:
self.fndx = -1
***************
*** 349,353 ****
def GetParams(self):
! return self.dirpattern+'\t'+self.filpattern+'\t'+self.greppattern+'\t'+`self.casesensitive`+'\t'+`self.recurse`+'\t'+`self.verbose`
def OnSaveDocument(self, filename):
--- 349,353 ----
def GetParams(self):
! return self.dirpattern+'\t'+self.filpattern+'\t'+self.greppattern+'\t'+repr(self.casesensitive)+'\t'+repr(self.recurse)+'\t'+repr(self.verbose)
def OnSaveDocument(self, filename):
***************
*** 557,561 ****
items = items + newitems
for item in items:
! win32api.WriteProfileVal(section, `i`, item, ini)
i = i + 1
self.UpdateData(0)
--- 557,561 ----
items = items + newitems
for item in items:
! win32api.WriteProfileVal(section, repr(i), item, ini)
i = i + 1
self.UpdateData(0)
Index: startup.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/startup.py,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -d -r1.4 -r1.4.2.1
*** startup.py 9 Aug 2008 18:37:22 -0000 1.4
--- startup.py 29 Aug 2008 06:16:42 -0000 1.4.2.1
***************
*** 38,43 ****
sys.appargv = sys.argv[:]
# Must check for /app param here.
! if len(sys.argv)>=2 and sys.argv[0].lower()=='/app':
! import cmdline
moduleName = cmdline.FixArgFileName(sys.argv[1])
sys.appargvoffset = 2
--- 38,43 ----
sys.appargv = sys.argv[:]
# Must check for /app param here.
! if len(sys.argv)>=2 and sys.argv[0].lower()=='/app':
! from . import cmdline
moduleName = cmdline.FixArgFileName(sys.argv[1])
sys.appargvoffset = 2
***************
*** 46,50 ****
sys.argv = newargv
! exec "import %s\n" % moduleName
try:
--- 46,50 ----
sys.argv = newargv
! from . import intpyapp
try:
***************
*** 55,61 ****
# that does exist does not have a Python class (ie, was created
# by the host .EXE). In this case, we do the "old style" init...
! import app
if app.AppBuilder is None:
! raise TypeError, "No application object has been registered"
app.App = app.AppBuilder()
--- 55,61 ----
# that does exist does not have a Python class (ie, was created
# by the host .EXE). In this case, we do the "old style" init...
! from . import app
if app.AppBuilder is None:
! raise TypeError("No application object has been registered")
app.App = app.AppBuilder()
Index: stdin.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/stdin.py,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -C2 -d -r1.3 -r1.3.2.1
*** stdin.py 9 Aug 2008 16:47:07 -0000 1.3
--- stdin.py 29 Aug 2008 06:16:42 -0000 1.3.2.1
***************
*** 22,26 ****
true = 1
false = 0
! get_input_line = raw_input
class Stdin:
--- 22,28 ----
true = 1
false = 0
!
! import code
! get_input_line = code.InteractiveConsole.raw_input
class Stdin:
***************
*** 110,114 ****
"""
line = get_input_line()
! print '>>>',line # echo input to console
self.buffer = self.buffer + line + '\n'
--- 112,116 ----
"""
line = get_input_line()
! print('>>>',line) # echo input to console
self.buffer = self.buffer + line + '\n'
***************
*** 120,124 ****
"""
if self.closed:
! return apply(self.real_file.readlines, sizehint)
result = []
--- 122,126 ----
"""
if self.closed:
! return self.real_file.readlines(*sizehint)
result = []
***************
*** 159,163 ****
test_input = test_input[end_of_line_pos + 1:]
if len(result) == 0 or result[0] == '~':
! raise 'EOF'
return result
--- 161,165 ----
test_input = test_input[end_of_line_pos + 1:]
if len(result) == 0 or result[0] == '~':
! raise EOFError
return result
***************
*** 167,176 ****
try:
x = Stdin()
! print x.read()
! print x.readline()
! print x.read(12)
! print x.readline(47)
! print x.readline(3)
! print x.readlines()
finally:
get_input_line = raw_input
--- 169,178 ----
try:
x = Stdin()
! print(x.read())
! print(x.readline())
! print(x.read(12))
! print(x.readline(47))
! print(x.readline(3))
! print(x.readlines())
finally:
get_input_line = raw_input
Index: interact.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/interact.py,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -C2 -d -r1.17 -r1.17.2.1
*** interact.py 9 Aug 2008 16:47:07 -0000 1.17
--- interact.py 29 Aug 2008 06:16:41 -0000 1.17.2.1
***************
*** 28,33 ****
trace=pywin.scintilla.formatter.trace
!
! import winout
import re
--- 28,32 ----
trace=pywin.scintilla.formatter.trace
! from . import winout
import re
***************
*** 229,233 ****
styleStart = STYLE_INTERACTIVE_BANNER
self.scintilla.SCIStartStyling(start, 31)
! self.style_buffer = array.array("c", chr(0)*len(stringVal))
self.ColorizeInteractiveCode(stringVal, styleStart, stylePyStart)
self.scintilla.SCISetStylingEx(self.style_buffer)
--- 228,232 ----
styleStart = STYLE_INTERACTIVE_BANNER
self.scintilla.SCIStartStyling(start, 31)
! self.style_buffer = array.array("b", (0,)*len(stringVal))
self.ColorizeInteractiveCode(stringVal, styleStart, stylePyStart)
self.scintilla.SCISetStylingEx(self.style_buffer)
***************
*** 255,259 ****
def runcode(self, code):
try:
! exec code in self.globals, self.locals
except SystemExit:
raise
--- 254,258 ----
def runcode(self, code):
try:
! exec(code, self.globals, self.locals)
except SystemExit:
raise
***************
*** 305,314 ****
if pywin.is_platform_unicode:
try:
! line = unicode(line, pywin.default_scintilla_encoding).encode(pywin.default_platform_encoding)
except:
# We should fix the underlying problem rather than always masking errors
# so make it complain.
! print "Unicode error converting", repr(line)
! line = unicode(line, pywin.default_scintilla_encoding, "ignore").encode(pywin.default_platform_encoding)
while line and line[-1] in ['\r', '\n']:
--- 304,313 ----
if pywin.is_platform_unicode:
try:
! line = str(line, pywin.default_scintilla_encoding).encode(pywin.default_platform_encoding)
except:
# We should fix the underlying problem rather than always masking errors
# so make it complain.
! print("Unicode error converting", repr(line))
! line = str(line, pywin.default_scintilla_encoding, "ignore").encode(pywin.default_platform_encoding)
while line and line[-1] in ['\r', '\n']:
***************
*** 331,335 ****
return
terms = (["\n" + sys.ps2] * (len(bufLines)-1)) + ['']
! for bufLine, term in map(None, bufLines, terms):
if bufLine.strip():
self.write( bufLine + term )
--- 330,334 ----
return
terms = (["\n" + sys.ps2] * (len(bufLines)-1)) + ['']
! for bufLine, term in zip(bufLines, terms):
if bufLine.strip():
self.write( bufLine + term )
***************
*** 541,545 ****
win32clipboard.OpenClipboard()
try:
! win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT, unicode(out_code))
finally:
win32clipboard.CloseClipboard()
--- 540,544 ----
win32clipboard.OpenClipboard()
try:
! win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT, out_code)
finally:
win32clipboard.CloseClipboard()
***************
*** 556,560 ****
try:
o=compile(code, '<clipboard>', 'exec')
! exec o in __main__.__dict__
except:
traceback.print_exc()
--- 555,559 ----
try:
o=compile(code, '<clipboard>', 'exec')
! exec(o, __main__.__dict__)
except:
traceback.print_exc()
***************
*** 606,610 ****
win32ui.SetStatusText("The last active Window has been closed.")
except AttributeError:
! print "Can't find the last active window!"
lastActive = None
if lastActive is not None:
--- 605,609 ----
win32ui.SetStatusText("The last active Window has been closed.")
except AttributeError:
! print("Can't find the last active window!")
lastActive = None
if lastActive is not None:
Index: app.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/app.py,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -C2 -d -r1.14 -r1.14.2.1
*** app.py 11 Aug 2008 00:38:28 -0000 1.14
--- app.py 29 Aug 2008 06:16:41 -0000 1.14.2.1
***************
*** 13,17 ****
from pywin.mfc import window, dialog, thread, afxres
import traceback
! from pywin.framework import scriptutils
## NOTE: App and AppBuild should NOT be used - instead, you should contruct your
--- 13,17 ----
from pywin.mfc import window, dialog, thread, afxres
import traceback
! from . import scriptutils
## NOTE: App and AppBuild should NOT be used - instead, you should contruct your
***************
*** 25,32 ****
# Helpers that should one day be removed!
def AddIdleHandler(handler):
! print "app.AddIdleHandler is deprecated - please use win32ui.GetApp().AddIdleHandler() instead."
return win32ui.GetApp().AddIdleHandler(handler)
def DeleteIdleHandler(handler):
! print "app.DeleteIdleHandler is deprecated - please use win32ui.GetApp().DeleteIdleHandler() instead."
return win32ui.GetApp().DeleteIdleHandler(handler)
--- 25,32 ----
# Helpers that should one day be removed!
def AddIdleHandler(handler):
! print("app.AddIdleHandler is deprecated - please use win32ui.GetApp().AddIdleHandler() instead.")
return win32ui.GetApp().AddIdleHandler(handler)
def DeleteIdleHandler(handler):
! print("app.DeleteIdleHandler is deprecated - please use win32ui.GetApp().DeleteIdleHandler() instead.")
return win32ui.GetApp().DeleteIdleHandler(handler)
***************
*** 169,175 ****
thisRet = handler(handler, count)
except:
! print "Idle handler %s failed" % (`handler`)
traceback.print_exc()
! print "Idle handler removed from list"
try:
self.DeleteIdleHandler(handler)
--- 169,175 ----
thisRet = handler(handler, count)
except:
! print("Idle handler %s failed" % (repr(handler)))
traceback.print_exc()
! print("Idle handler removed from list")
try:
self.DeleteIdleHandler(handler)
***************
*** 206,210 ****
win32ui.MessageBox("The help file is not registered!")
else:
! import help
help.OpenHelpFile(helpFile, helpCmd)
except:
--- 206,210 ----
win32ui.MessageBox("The help file is not registered!")
else:
! from . import help
help.OpenHelpFile(helpFile, helpCmd)
except:
***************
*** 365,382 ****
ret=dialog.GetSimpleInput(prompt)
if ret==None:
! raise KeyboardInterrupt, "operation cancelled"
return ret
def Win32Input(prompt=None):
"Provide input() for gui apps"
! return eval(raw_input(prompt))
! sys.modules['__builtin__'].raw_input=Win32RawInput
! sys.modules['__builtin__'].input=Win32Input
def HaveGoodGUI():
"""Returns true if we currently have a good gui available.
"""
! return sys.modules.has_key("pywin.framework.startup")
def CreateDefaultGUI( appClass = None):
--- 365,386 ----
ret=dialog.GetSimpleInput(prompt)
if ret==None:
! raise KeyboardInterrupt("operation cancelled")
return ret
def Win32Input(prompt=None):
"Provide input() for gui apps"
! return eval(input(prompt))
!
! ## sys.modules['__builtin__'].raw_input=Win32RawInput
! ## sys.modules['__builtin__'].input=Win32Input
! import code
! code.InteractiveConsole.raw_input=Win32RawInput
! code.InteractiveConsole.input=Win32Input
def HaveGoodGUI():
"""Returns true if we currently have a good gui available.
"""
! return "pywin.framework.startup" in sys.modules
def CreateDefaultGUI( appClass = None):
***************
*** 384,388 ****
"""
if appClass is None:
! import intpyapp # Bring in the default app - could be param'd later.
appClass = intpyapp.InteractivePythonApp
# Create and init the app.
--- 388,392 ----
"""
if appClass is None:
! from . import intpyapp # Bring in the default app - could be param'd later.
appClass = intpyapp.InteractivePythonApp
# Create and init the app.
Index: sgrepmdi.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/sgrepmdi.py,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** sgrepmdi.py 9 Aug 2008 16:47:07 -0000 1.7
--- sgrepmdi.py 29 Aug 2008 06:16:42 -0000 1.7.2.1
***************
*** 29,33 ****
import stat
import glob
! import scriptutils
def getsubdirs(d):
--- 29,33 ----
import stat
import glob
! from pywin.framework import scriptutils
def getsubdirs(d):
***************
*** 47,51 ****
if os.path.isdir(d):
d = d.lower()
! if not dirs.has_key(d):
dirs[d] = None
if recurse:
--- 47,51 ----
if os.path.isdir(d):
d = d.lower()
! if d not in dirs:
dirs[d] = None
if recurse:
***************
*** 53,57 ****
for sd in subdirs:
sd = sd.lower()
! if not dirs.has_key(sd):
dirs[sd] = None
elif os.path.isfile(d):
--- 53,57 ----
for sd in subdirs:
sd = sd.lower()
! if sd not in dirs:
dirs[sd] = None
elif os.path.isfile(d):
***************
*** 59,63 ****
else:
x = None
! if os.environ.has_key(d):
x = dirpath(os.environ[d])
elif d[:5] == 'HKEY_':
--- 59,63 ----
else:
x = None
! if d in os.environ:
x = dirpath(os.environ[d])
elif d[:5] == 'HKEY_':
***************
*** 80,84 ****
if x:
for xd in x:
! if not dirs.has_key(xd):
dirs[xd] = None
if recurse:
--- 80,84 ----
if x:
for xd in x:
! if xd not in dirs:
dirs[xd] = None
if recurse:
***************
*** 86,93 ****
for sd in subdirs:
sd = sd.lower()
! if not dirs.has_key(sd):
dirs[sd] = None
self.dirs = []
! for d in dirs.keys():
self.dirs.append(d)
--- 86,93 ----
for sd in subdirs:
sd = sd.lower()
! if sd not in dirs:
dirs[sd] = None
self.dirs = []
! for d in list(dirs.keys()):
self.dirs.append(d)
***************
*** 234,238 ****
self.GetFirstView().Append('#Search '+self.dirpattern+'\n')
if self.verbose:
! self.GetFirstView().Append('# ='+`self.dp.dirs`+'\n')
self.GetFirstView().Append('# Files '+self.filpattern+'\n')
self.GetFirstView().Append('# For '+self.greppattern+'\n')
--- 234,238 ----
self.GetFirstView().Append('#Search '+self.dirpattern+'\n')
if self.verbose:
! self.GetFirstView().Append('# ='+repr(self.dp.dirs)+'\n')
self.GetFirstView().Append('# Files '+self.filpattern+'\n')
self.GetFirstView().Append('# For '+self.greppattern+'\n')
***************
*** 263,267 ****
line = lines[i]
if self.pat.search(line) != None:
! self.GetFirstView().Append(f+'('+`i+1` + ') '+line)
else:
self.fndx = -1
--- 263,267 ----
line = lines[i]
if self.pat.search(line) != None:
! self.GetFirstView().Append(f+'('+repr(i+1) + ') '+line)
else:
self.fndx = -1
***************
*** 285,289 ****
def GetParams(self):
! return self.dirpattern+'\t'+self.filpattern+'\t'+self.greppattern+'\t'+`self.casesensitive`+'\t'+`self.recurse`+'\t'+`self.verbose`
def OnSaveDocument(self, filename):
--- 285,289 ----
def GetParams(self):
! return self.dirpattern+'\t'+self.filpattern+'\t'+self.greppattern+'\t'+repr(self.casesensitive)+'\t'+repr(self.recurse)+'\t'+repr(self.verbose)
def OnSaveDocument(self, filename):
***************
*** 404,408 ****
style = win32con.DS_MODALFRAME | win32con.WS_POPUP | win32con.WS_VISIBLE | win32con.WS_CAPTION | win32con.WS_SYSMENU | win32con.DS_SETFONT
CS = win32con.WS_CHILD | win32con.WS_VISIBLE
! tmp = [ ["Grep", (0, 0, 210, 90), style, None, (8, "MS Sans Serif")], ]
tmp.append([STATIC, "Grep For:", -1, (7, 7, 50, 9), CS ])
tmp.append([EDIT, gp, 101, (52, 7, 144, 11), CS | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL | win32con.WS_BORDER])
--- 404,408 ----
style = win32con.DS_MODALFRAME | win32con.WS_POPUP | win32con.WS_VISIBLE | win32con.WS_CAPTION | win32con.WS_SYSMENU | win32con.DS_SETFONT
CS = win32con.WS_CHILD | win32con.WS_VISIBLE
! tmp = [ ["Grep", (0, 0, 210, 90), style, 0, (8, "MS Sans Serif")], ]
tmp.append([STATIC, "Grep For:", -1, (7, 7, 50, 9), CS ])
tmp.append([EDIT, gp, 101, (52, 7, 144, 11), CS | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL | win32con.WS_BORDER])
***************
*** 458,462 ****
items = items + newitems
for item in items:
! win32api.WriteProfileVal(section, `i`, item, ini)
i = i + 1
self.UpdateData(0)
--- 458,462 ----
items = items + newitems
for item in items:
! win32api.WriteProfileVal(section, repr(i), item, ini)
i = i + 1
self.UpdateData(0)
***************
*** 478,482 ****
style = win32con.DS_MODALFRAME | win32con.WS_POPUP | win32con.WS_VISIBLE | win32con.WS_CAPTION | win32con.WS_SYSMENU | win32con.DS_SETFONT
CS = win32con.WS_CHILD | win32con.WS_VISIBLE
! tmp = [ ["Grep Parameters", (0, 0, 205, 100), style, None, (8, "MS Sans Serif")], ]
tmp.append([LISTBOX, '', 107, (7, 7, 150, 72), CS | win32con.LBS_MULTIPLESEL| win32con.LBS_STANDARD | win32con.LBS_HASSTRINGS | win32con.WS_TABSTOP | win32con.LBS_NOTIFY])
tmp.append([BUTTON,'OK', win32con.IDOK, (167, 7, 32, 12), CS | win32con.BS_DEFPUSHBUTTON| win32con.WS_TABSTOP])
--- 478,482 ----
style = win32con.DS_MODALFRAME | win32con.WS_POPUP | win32con.WS_VISIBLE | win32con.WS_CAPTION | win32con.WS_SYSMENU | win32con.DS_SETFONT
CS = win32con.WS_CHILD | win32con.WS_VISIBLE
! tmp = [ ["Grep Parameters", (0, 0, 205, 100), style, 0, (8, "MS Sans Serif")], ]
tmp.append([LISTBOX, '', 107, (7, 7, 150, 72), CS | win32con.LBS_MULTIPLESEL| win32con.LBS_STANDARD | win32con.LBS_HASSTRINGS | win32con.WS_TABSTOP | win32con.LBS_NOTIFY])
tmp.append([BUTTON,'OK', win32con.IDOK, (167, 7, 32, 12), CS | win32con.BS_DEFPUSHBUTTON| win32con.WS_TABSTOP])
Index: dbgcommands.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/dbgcommands.py,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** dbgcommands.py 25 Feb 2008 21:56:41 -0000 1.2
--- dbgcommands.py 29 Aug 2008 06:16:41 -0000 1.2.2.1
***************
*** 5,9 ****
# imported
import win32ui, win32con
! import scriptutils
import warnings
--- 5,9 ----
# imported
import win32ui, win32con
! from . import scriptutils
import warnings
***************
*** 33,37 ****
frame.HookCommandUpdate(methUpdate, id)
! for id in IdToBarNames.keys():
frame.HookCommand( self.OnDebuggerBar, id)
frame.HookCommandUpdate(self.OnUpdateDebuggerBar, id)
--- 33,37 ----
frame.HookCommandUpdate(methUpdate, id)
! for id in list(IdToBarNames.keys()):
frame.HookCommand( self.OnDebuggerBar, id)
frame.HookCommandUpdate(self.OnUpdateDebuggerBar, id)
Index: intpydde.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/intpydde.py,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -C2 -d -r1.2 -r1.2.4.1
*** intpydde.py 22 Jun 2006 13:55:49 -0000 1.2
--- intpydde.py 29 Aug 2008 06:16:42 -0000 1.2.4.1
***************
*** 10,15 ****
from pywin.mfc import object
from dde import *
! import traceback
! import string
class DDESystemTopic(object.Object):
--- 10,14 ----
from pywin.mfc import object
from dde import *
! import sys, traceback
class DDESystemTopic(object.Object):
***************
*** 22,28 ****
self.app.OnDDECommand(data)
except:
# The DDE Execution failed.
! print "Error executing DDE command."
! traceback.print_exc()
return 0
--- 21,28 ----
self.app.OnDDECommand(data)
except:
+ t,v,tb = sys.exc_info()
# The DDE Execution failed.
! print("Error executing DDE command.")
! traceback.print_exception(t,v,tb)
return 0
Index: dlgappcore.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/dlgappcore.py,v
retrieving revision 1.3
retrieving revision 1.3.4.1
diff -C2 -d -r1.3 -r1.3.4.1
*** dlgappcore.py 21 Jun 2005 08:04:42 -0000 1.3
--- dlgappcore.py 29 Aug 2008 06:16:41 -0000 1.3.4.1
***************
*** 1,7 ****
! # dlgappcore.
! #
! # base classes for dialog based apps.
!
! import app
import win32ui
import win32con
--- 1,3 ----
! from . import app
import win32ui
import win32con
***************
*** 55,59 ****
if self.frame is None:
! raise error, "No dialog was created by CreateDialog()"
return
--- 51,55 ----
if self.frame is None:
! raise error("No dialog was created by CreateDialog()")
return
Index: toolmenu.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/toolmenu.py,v
retrieving revision 1.3
retrieving revision 1.3.4.1
diff -C2 -d -r1.3 -r1.3.4.1
*** toolmenu.py 7 Feb 2004 02:06:56 -0000 1.3
--- toolmenu.py 29 Aug 2008 06:16:42 -0000 1.3.4.1
***************
*** 4,8 ****
import win32con
import win32api
! import app
import sys
import string
--- 4,8 ----
import win32con
import win32api
! from . import app
import sys
import string
***************
*** 101,105 ****
try:
! exec "%s\n" % pyCmd
worked=1
except SystemExit:
--- 101,105 ----
try:
! exec("%s\n" % pyCmd)
worked=1
except SystemExit:
***************
*** 107,111 ****
worked = 1
except:
! print "Failed to execute command:\n%s" % pyCmd
traceback.print_exc()
worked=0
--- 107,111 ----
worked = 1
except:
! print("Failed to execute command:\n%s" % pyCmd)
traceback.print_exc()
worked=0
***************
*** 137,141 ****
self.HookNotify(self.OnNotifyListControl, commctrl.LVN_ITEMCHANGED)
! self.HookNotify(self.OnNotifyListControlEndLabelEdit, commctrl.LVN_ENDLABELEDIT)
# Hook the button clicks.
--- 137,141 ----
self.HookNotify(self.OnNotifyListControl, commctrl.LVN_ITEMCHANGED)
! self.HookNotify(self.OnNotifyListControlEndLabelEdit, commctrl.LVN_ENDLABELEDITW)
# Hook the button clicks.
Index: help.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/help.py,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -C2 -d -r1.12 -r1.12.2.1
*** help.py 9 Aug 2008 16:47:07 -0000 1.12
--- help.py 29 Aug 2008 06:16:41 -0000 1.12.2.1
***************
*** 25,29 ****
win32help.HtmlHelp(frame, None, win32help.HH_UNINITIALIZE, htmlhelp_handle)
except win32help.error:
! print "Failed to finalize htmlhelp!"
htmlhelp_handle = None
--- 25,29 ----
win32help.HtmlHelp(frame, None, win32help.HH_UNINITIALIZE, htmlhelp_handle)
except win32help.error:
! print("Failed to finalize htmlhelp!")
htmlhelp_handle = None
***************
*** 74,81 ****
try:
key = win32api.RegOpenKey(root, regutil.BuildDefaultPythonKey() + "\\Help", 0, win32con.KEY_READ)
! except win32api.error, (code, fn, details):
import winerror
if code!=winerror.ERROR_FILE_NOT_FOUND:
! raise win32api.error, (code, fn, details)
return retList
try:
--- 74,82 ----
try:
key = win32api.RegOpenKey(root, regutil.BuildDefaultPythonKey() + "\\Help", 0, win32con.KEY_READ)
! except win32api.error as xxx_todo_changeme:
! (code, fn, details) = xxx_todo_changeme.args
import winerror
if code!=winerror.ERROR_FILE_NOT_FOUND:
! raise win32api.error(code, fn, details)
return retList
try:
***************
*** 87,94 ****
retList.append((helpDesc, helpFile))
keyNo = keyNo + 1
! except win32api.error, (code, fn, desc):
import winerror
if code!=winerror.ERROR_NO_MORE_ITEMS:
! raise win32api.error, (code, fn, desc)
break
finally:
--- 88,96 ----
retList.append((helpDesc, helpFile))
keyNo = keyNo + 1
! except win32api.error as xxx_todo_changeme1:
! (code, fn, desc) = xxx_todo_changeme1.args
import winerror
if code!=winerror.ERROR_NO_MORE_ITEMS:
! raise win32api.error(code, fn, desc)
break
finally:
***************
*** 143,147 ****
if helpIDMap:
! for id, (desc, fname) in helpIDMap.items():
otherMenu.AppendMenu(win32con.MF_ENABLED|win32con.MF_STRING,id, desc)
else:
--- 145,149 ----
if helpIDMap:
! for id, (desc, fname) in list(helpIDMap.items()):
otherMenu.AppendMenu(win32con.MF_ENABLED|win32con.MF_STRING,id, desc)
else:
Index: winout.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/winout.py,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -C2 -d -r1.14 -r1.14.2.1
*** winout.py 9 Aug 2008 16:47:07 -0000 1.14
--- winout.py 29 Aug 2008 06:16:42 -0000 1.14.2.1
***************
*** 24,30 ****
from pywin.mfc import docview
from pywin.framework import app, window
! from pywintypes import UnicodeType
import win32ui, win32api, win32con
! import Queue
debug = lambda msg: None
--- 24,30 ----
from pywin.mfc import docview
from pywin.framework import app, window
! ## from pywintypes import UnicodeType
import win32ui, win32api, win32con
! import queue
debug = lambda msg: None
***************
*** 109,113 ****
if type(appendParams)!=type(()):
appendParams = (appendParams,)
! apply(menu.AppendMenu, appendParams)
menu.TrackPopupMenu(params[5]) # track at mouse position.
return 0
--- 109,113 ----
if type(appendParams)!=type(()):
appendParams = (appendParams,)
! menu.AppendMenu(*appendParams)
menu.TrackPopupMenu(params[5]) # track at mouse position.
return 0
***************
*** 118,122 ****
# jump to it. FALSE if no error (and no action taken)
def HandleSpecialLine(self):
! import scriptutils
line = self.GetLine()
if line[:11]=="com_error: ":
--- 118,122 ----
# jump to it. FALSE if no error (and no action taken)
def HandleSpecialLine(self):
! from . import scriptutils
line = self.GetLine()
if line[:11]=="com_error: ":
***************
*** 127,134 ****
det = eval(line[line.find(":")+1:].strip())
win32ui.SetStatusText("Opening help file on OLE error...");
! import help
help.OpenHelpFile(det[2][3],win32con.HELP_CONTEXT, det[2][4])
return 1
! except win32api.error, details:
try:
msg = details[2]
--- 127,134 ----
det = eval(line[line.find(":")+1:].strip())
win32ui.SetStatusText("Opening help file on OLE error...");
! from . import help
help.OpenHelpFile(det[2][3],win32con.HELP_CONTEXT, det[2][4])
return 1
! except win32api.error as details:
try:
msg = details[2]
***************
*** 218,222 ****
self.template.killBuffer.remove(item)
if bytes < len(item):
! print "Warning - output buffer not big enough!"
return item
except IndexError:
--- 218,222 ----
self.template.killBuffer.remove(item)
if bytes < len(item):
! print("Warning - output buffer not big enough!")
return item
except IndexError:
***************
*** 322,326 ****
self.defSize=defSize
self.currentView = None
! self.outputQueue = Queue.Queue(-1)
self.mainThreadId = win32api.GetCurrentThreadId()
self.idleHandlerSet = 0
--- 322,326 ----
self.defSize=defSize
self.currentView = None
! self.outputQueue = queue.Queue(-1)
self.mainThreadId = win32api.GetCurrentThreadId()
self.idleHandlerSet = 0
***************
*** 402,407 ****
if self.interruptCount > 1:
# Drop the queue quickly as the user is already annoyed :-)
! self.outputQueue = Queue.Queue(-1)
! print "Interrupted."
bEmpty = 1
else:
--- 402,407 ----
if self.interruptCount > 1:
# Drop the queue quickly as the user is already annoyed :-)
! self.outputQueue = queue.Queue(-1)
! print("Interrupted.")
bEmpty = 1
else:
***************
*** 428,432 ****
return 0
! def QueueFlush(self, max = sys.maxint):
# Returns true if the queue is empty after the flush
# debug("Queueflush - %d, %d\n" % (max, self.outputQueue.qsize()))
--- 428,432 ----
return 0
! def QueueFlush(self, max = sys.maxsize):
# Returns true if the queue is empty after the flush
# debug("Queueflush - %d, %d\n" % (max, self.outputQueue.qsize()))
***************
*** 437,451 ****
try:
item = self.outputQueue.get_nowait()
! if is_platform_unicode:
! # Note is_platform_unicode is never true any more!
! if not isinstance(item, UnicodeType):
! item = unicode(item, default_platform_encoding)
! item = item.encode(default_scintilla_encoding) # What scintilla uses.
! else:
! # try and display using mbcs encoding
! if isinstance(item, UnicodeType):
! item = item.encode("mbcs")
items.append(item)
! except Queue.Empty:
rc = 1
break
--- 437,451 ----
try:
item = self.outputQueue.get_nowait()
! ## if is_platform_unicode:
! ## # Note is_platform_unicode is never true any more!
! ## if not isinstance(item, UnicodeType):
! ## item = str(item, default_platform_encoding)
! ## item = item.encode(default_scintilla_encoding) # What scintilla uses.
! ## else:
! ## # try and display using mbcs encoding
! ## if isinstance(item, UnicodeType):
! ## item = item.encode("mbcs")
items.append(item)
! except queue.Empty:
rc = 1
break
***************
*** 498,502 ****
def RTFWindowOutput(*args, **kw):
kw['makeView'] = WindowOutputViewRTF
! return apply( WindowOutput, args, kw )
--- 498,502 ----
def RTFWindowOutput(*args, **kw):
kw['makeView'] = WindowOutputViewRTF
! return WindowOutput(*args, **kw)
***************
*** 509,516 ****
w = WindowOutput(queueing=flags.WQ_IDLE)
w.write("First bit of text\n")
! import thread
for i in range(5):
w.write("Hello from the main thread\n")
! thread.start_new(thread_test, (w,))
for i in range(2):
w.write("Hello from the main thread\n")
--- 509,516 ----
w = WindowOutput(queueing=flags.WQ_IDLE)
w.write("First bit of text\n")
! import _thread
for i in range(5):
w.write("Hello from the main thread\n")
! _thread.start_new(thread_test, (w,))
for i in range(2):
w.write("Hello from the main thread\n")
Index: bitmap.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/bitmap.py,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** bitmap.py 9 Aug 2008 16:47:07 -0000 1.2
--- bitmap.py 29 Aug 2008 06:16:41 -0000 1.2.2.1
***************
*** 4,8 ****
import string
import os
! import app
import sys
--- 4,8 ----
import string
import os
! from . import app
import sys
Index: scriptutils.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/scriptutils.py,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -C2 -d -r1.18 -r1.18.2.1
*** scriptutils.py 11 Aug 2008 00:38:28 -0000 1.18
--- scriptutils.py 29 Aug 2008 06:16:42 -0000 1.18.2.1
***************
*** 15,19 ****
import bdb
! from cmdline import ParseArgs
RS_DEBUGGER_NONE=0 # Dont run under the debugger.
--- 15,19 ----
import bdb
! from .cmdline import ParseArgs
RS_DEBUGGER_NONE=0 # Dont run under the debugger.
***************
*** 77,82 ****
if syspath and win32ui.FullPath(syspath)==path:
return 1
! except win32ui.error, details:
! print "Warning: The sys.path entry '%s' is invalid\n%s" % (syspath, details)
return 0
--- 77,82 ----
if syspath and win32ui.FullPath(syspath)==path:
return 1
! except win32ui.error as details:
! print("Warning: The sys.path entry '%s' is invalid\n%s" % (syspath, details))
return 0
***************
*** 97,101 ****
modBits.append(modBit)
# If on path, _and_ existing package of that name loaded.
! if IsOnPythonPath(path) and sys.modules.has_key(modBit) and \
( os.path.exists(os.path.join(path, '__init__.py')) or \
os.path.exists(os.path.join(path, '__init__.pyc')) or \
--- 97,101 ----
modBits.append(modBit)
# If on path, _and_ existing package of that name loaded.
! if IsOnPythonPath(path) and modBit in sys.modules and \
( os.path.exists(os.path.join(path, '__init__.py')) or \
os.path.exists(os.path.join(path, '__init__.pyc')) or \
***************
*** 159,165 ****
if bAutoSave and \
! (len(pathName)>0 or \
! doc.GetTitle()[:8]=="Untitled" or \
! doc.GetTitle()[:6]=="Script"): # if not a special purpose window
if doc.IsModified():
try:
--- 159,165 ----
if bAutoSave and \
! (len(pathName)>0 or \
! doc.GetTitle()[:8]=="Untitled" or \
! doc.GetTitle()[:6]=="Script"): # if not a special purpose window
if doc.IsModified():
try:
***************
*** 263,267 ****
try:
f = open(script)
! except IOError, (code, msg):
win32ui.MessageBox("The file could not be opened - %s (%d)" % (msg, code))
return
--- 263,268 ----
try:
f = open(script)
! except IOError as xxx_todo_changeme:
! (code, msg) = xxx_todo_changeme.args
win32ui.MessageBox("The file could not be opened - %s (%d)" % (msg, code))
return
***************
*** 309,320 ****
else:
# Post mortem or no debugging
! exec codeObject in __main__.__dict__
bWorked = 1
except bdb.BdbQuit:
# Dont print tracebacks when the debugger quit, but do print a message.
! print "Debugging session cancelled."
exitCode = 1
bWorked = 1
! except SystemExit, code:
exitCode = code
bWorked = 1
--- 310,321 ----
else:
# Post mortem or no debugging
! exec(codeObject, __main__.__dict__)
bWorked = 1
except bdb.BdbQuit:
# Dont print tracebacks when the debugger quit, but do print a message.
! print("Debugging session cancelled.")
exitCode = 1
bWorked = 1
! except SystemExit as code:
exitCode = code
bWorked = 1
***************
*** 329,339 ****
bWorked = 1
except:
if interact.edit and interact.edit.currentView:
interact.edit.currentView.EnsureNoPrompt()
! traceback.print_exc()
if interact.edit and interact.edit.currentView:
interact.edit.currentView.AppendToPrompt([])
if debuggingType == RS_DEBUGGER_PM:
! debugger.pm()
sys.argv = oldArgv
if insertedPath0:
--- 330,343 ----
bWorked = 1
except:
+ ## ??? sys.exc_info is reset to (None, None, None) after some function calls -
+ ## Is this a 'feature' of py3k, or are we clearing an error somewhere ???
+ exc_type, exc_value, exc_traceback=sys.exc_info()
if interact.edit and interact.edit.currentView:
interact.edit.currentView.EnsureNoPrompt()
! traceback.print_exception(exc_type, exc_value, exc_traceback)
if interact.edit and interact.edit.currentView:
interact.edit.currentView.AppendToPrompt([])
if debuggingType == RS_DEBUGGER_PM:
! debugger.pm(exc_traceback)
sys.argv = oldArgv
if insertedPath0:
***************
*** 362,366 ****
if pathName is not None:
! if os.path.splitext(pathName)[1].lower() <> ".py":
pathName = None
--- 366,370 ----
if pathName is not None:
! if os.path.splitext(pathName)[1].lower() != ".py":
pathName = None
***************
*** 378,382 ****
modName, modExt = os.path.splitext(modName)
newPath = None
! for key, mod in sys.modules.items():
if hasattr(mod, '__file__'):
fname = mod.__file__
--- 382,386 ----
modName, modExt = os.path.splitext(modName)
newPath = None
! for key, mod in list(sys.modules.items()):
if hasattr(mod, '__file__'):
fname = mod.__file__
***************
*** 392,396 ****
if newPath: sys.path.append(newPath)
! if sys.modules.has_key(modName):
bNeedReload = 1
what = "reload"
--- 396,400 ----
if newPath: sys.path.append(newPath)
! if modName in sys.modules:
bNeedReload = 1
what = "reload"
***************
*** 404,408 ****
try:
! # always do an import, as it is cheap is already loaded. This ensures
# it is in our name space.
codeObj = compile('import '+modName,'<auto import>','exec')
--- 408,412 ----
try:
! # always do an import, as it is cheap if it's already loaded. This ensures
# it is in our name space.
codeObj = compile('import '+modName,'<auto import>','exec')
***************
*** 411,417 ****
return
try:
! exec codeObj in __main__.__dict__
if bNeedReload:
! reload(sys.modules[modName])
# codeObj = compile('reload('+modName+')','<auto import>','eval')
# exec codeObj in __main__.__dict__
--- 415,423 ----
return
try:
! exec(codeObj, __main__.__dict__)
if bNeedReload:
!
! import imp
! imp.reload(sys.modules[modName])
# codeObj = compile('reload('+modName+')','<auto import>','eval')
# exec codeObj in __main__.__dict__
***************
*** 435,440 ****
try:
f = open(pathName)
! except IOError, details:
! print "Cant open file '%s' - %s" % (pathName, details)
return
try:
--- 441,446 ----
try:
f = open(pathName)
! except IOError as details:
! print("Cant open file '%s' - %s" % (pathName, details))
return
try:
***************
*** 454,458 ****
def RunTabNanny(filename):
! import cStringIO
tabnanny = FindTabNanny()
if tabnanny is None:
--- 460,464 ----
def RunTabNanny(filename):
! import io
tabnanny = FindTabNanny()
if tabnanny is None:
***************
*** 461,465 ****
# Capture the tab-nanny output
! newout = cStringIO.StringIO()
old_out = sys.stderr, sys.stdout
sys.stderr = sys.stdout = newout
--- 467,471 ----
# Capture the tab-nanny output
! newout = io.StringIO()
old_out = sys.stderr, sys.stdout
sys.stderr = sys.stdout = newout
***************
*** 481,486 ****
win32ui.SetStatusText("The TabNanny found trouble at line %d" % lineno)
except (IndexError, TypeError, ValueError):
! print "The tab nanny complained, but I cant see where!"
! print data
return 0
return 1
--- 487,492 ----
win32ui.SetStatusText("The TabNanny found trouble at line %d" % lineno)
except (IndexError, TypeError, ValueError):
! print("The tab nanny complained, but I cant see where!")
! print(data)
return 0
return 1
***************
*** 513,517 ****
view.EnsureCharsVisible(charNo)
except AttributeError:
! print "Doesnt appear to be one of our views?"
view.SetSel(min(start, size), min(start + nChars, size))
if bScrollToTop:
--- 519,523 ----
view.EnsureCharsVisible(charNo)
except AttributeError:
! print("Doesnt appear to be one of our views?")
view.SetSel(min(start, size), min(start + nChars, size))
if bScrollToTop:
***************
*** 549,554 ****
path = win32api.RegQueryValue(win32con.HKEY_LOCAL_MACHINE, "SOFTWARE\\Python\\PythonCore\\%s\\InstallPath" % (sys.winver))
except win32api.error:
! print "WARNING - The Python registry does not have an 'InstallPath' setting"
! print " The file '%s' can not be located" % (filename)
return None
fname = os.path.join(path, "Tools\\Scripts\\%s" % filename)
--- 555,560 ----
path = win32api.RegQueryValue(win32con.HKEY_LOCAL_MACHINE, "SOFTWARE\\Python\\PythonCore\\%s\\InstallPath" % (sys.winver))
except win32api.error:
! print("WARNING - The Python registry does not have an 'InstallPath' setting")
! print(" The file '%s' can not be located" % (filename))
return None
fname = os.path.join(path, "Tools\\Scripts\\%s" % filename)
***************
*** 556,560 ****
os.stat(fname)
except os.error:
! print "WARNING - The file '%s' can not be located in path '%s'" % (filename, path)
return None
--- 562,566 ----
os.stat(fname)
except os.error:
! print("WARNING - The file '%s' can not be located in path '%s'" % (filename, path))
return None
|