pywin32-checkins Mailing List for Python for Windows Extensions (Page 71)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(6) |
Jul
(50) |
Aug
(11) |
Sep
(24) |
Oct
(184) |
Nov
(118) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(25) |
Mar
(34) |
Apr
(105) |
May
(49) |
Jun
(38) |
Jul
(39) |
Aug
(7) |
Sep
(98) |
Oct
(79) |
Nov
(20) |
Dec
(17) |
2005 |
Jan
(66) |
Feb
(32) |
Mar
(43) |
Apr
(30) |
May
(58) |
Jun
(30) |
Jul
(16) |
Aug
(4) |
Sep
(21) |
Oct
(42) |
Nov
(11) |
Dec
(14) |
2006 |
Jan
(42) |
Feb
(30) |
Mar
(22) |
Apr
(1) |
May
(9) |
Jun
(15) |
Jul
(20) |
Aug
(9) |
Sep
(8) |
Oct
(1) |
Nov
(9) |
Dec
(43) |
2007 |
Jan
(52) |
Feb
(45) |
Mar
(20) |
Apr
(12) |
May
(59) |
Jun
(39) |
Jul
(35) |
Aug
(31) |
Sep
(17) |
Oct
(20) |
Nov
(4) |
Dec
(4) |
2008 |
Jan
(28) |
Feb
(111) |
Mar
(4) |
Apr
(27) |
May
(40) |
Jun
(27) |
Jul
(32) |
Aug
(94) |
Sep
(87) |
Oct
(153) |
Nov
(336) |
Dec
(331) |
2009 |
Jan
(298) |
Feb
(127) |
Mar
(20) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(1) |
2010 |
Jan
(7) |
Feb
(1) |
Mar
|
Apr
|
May
(15) |
Jun
(4) |
Jul
(3) |
Aug
(28) |
Sep
(1) |
Oct
(19) |
Nov
(16) |
Dec
(6) |
2011 |
Jan
(2) |
Feb
(18) |
Mar
(17) |
Apr
(12) |
May
(5) |
Jun
(11) |
Jul
(7) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(4) |
Dec
|
2012 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
(8) |
May
(4) |
Jun
(3) |
Jul
(13) |
Aug
(27) |
Sep
(8) |
Oct
(9) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
(10) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(9) |
2014 |
Jan
(2) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Roger U. <ru...@us...> - 2008-08-29 07:05:53
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7524 Modified Files: Tag: py3k ToDo.txt Log Message: More to do ... Index: ToDo.txt =================================================================== RCS file: /cvsroot/pywin32/pywin32/Attic/ToDo.txt,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** ToDo.txt 29 Aug 2008 06:57:36 -0000 1.1.2.1 --- ToDo.txt 29 Aug 2008 07:06:02 -0000 1.1.2.2 *************** *** 42,50 **** Autoindent gets spaces/tabs wrong ! ! ! ! \ No newline at end of file --- 42,48 ---- Autoindent gets spaces/tabs wrong + Several places where 'utf-8' is hardcoded, change to default_scintilla_encoding ! Figure out a clean way to switch between commctrl.*A and commctrl.*W constants for hooking messages \ No newline at end of file |
From: Roger U. <ru...@us...> - 2008-08-29 06:57:26
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3817 Added Files: Tag: py3k ToDo.txt Log Message: Some notes on things that still need work --- NEW FILE: ToDo.txt --- Some things that still need work for Python 3.0 win32ras - Add constants with unicode names Places where need to call PyType_Ready for all types defined in module perfmon directsound dbi, odbc win32ras, win2kras win32help Swig doesn't handle com_interface_parent, adsi will not build Several types set Py_TPFLAGS_BASETYPE but do not have required infrastructure to actually subclass. Pythonwin - LVITEM and TVITEM conversions use PyWinobject_AsTCHAR, result needs to be freed xxx win32uimodule - Python_callback has 64-bit issues with HWND, WPARAM, LPARAM xxx win32util.cpp - GetReprText needs fixes for Py3k unicode repr is_uiObject leaks a ref to _obj_ for python classes with simulated subclassing of mfc object 'stop at exceptions' option doesn't do anything (even in 2.x) repr for MFC objects needs work, currently doesn't print associated python class due to recursion - maybe special case it in __getattr__ ? Work on direct subclassing of MFC types tp_flags must include Py_TPFLAGS_BASETYPE Requires that each type have tp_new, which needs to set the object's type to passed in type As prelim work, convert functions that create MFC objects (CreateDialog, CreateMenu, etc) to keyword args, as they will be very similar to tp_new for created type Pasted text ends up with empty lines Autoindent gets spaces/tabs wrong |
From: Roger U. <ru...@us...> - 2008-08-29 06:44:40
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30565 Modified Files: Tag: py3k status.py Log Message: Fix a couple more thread -> _thread problems from 2to3 Index: status.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/dialogs/status.py,v retrieving revision 1.3.4.1 retrieving revision 1.3.4.2 diff -C2 -d -r1.3.4.1 -r1.3.4.2 *** status.py 29 Aug 2008 06:16:41 -0000 1.3.4.1 --- status.py 29 Aug 2008 06:44:50 -0000 1.3.4.2 *************** *** 25,29 **** (0, 0, w, h), style, ! None, (8, "MS Sans Serif")], ] --- 25,29 ---- (0, 0, w, h), style, ! 0, (8, "MS Sans Serif")], ] *************** *** 153,157 **** self._Send(MYWM_SET) ! class ProgressThread(_thread.WinThread): def __init__(self, title, msg = "", maxticks = 100, tickincr = 1): self.title = title --- 153,157 ---- self._Send(MYWM_SET) ! class ProgressThread(thread.WinThread): def __init__(self, title, msg = "", maxticks = 100, tickincr = 1): self.title = title *************** *** 160,164 **** self.tickincr = tickincr self.dialog = None ! _thread.WinThread.__init__(self) self.createdEvent = threading.Event() --- 160,164 ---- self.tickincr = tickincr self.dialog = None ! thread.WinThread.__init__(self) self.createdEvent = threading.Event() *************** *** 171,175 **** pass self.createdEvent.set() ! return _thread.WinThread.InitInstance(self) def ExitInstance(self): --- 171,175 ---- pass self.createdEvent.set() ! return thread.WinThread.InitInstance(self) def ExitInstance(self): |
From: Roger U. <ru...@us...> - 2008-08-29 06:17:03
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18484 Modified Files: Tag: py3k ModuleBrowser.py __init__.py configui.py document.py editor.py frame.py template.py vss.py Log Message: Changes for Python 3 Index: ModuleBrowser.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor/ModuleBrowser.py,v retrieving revision 1.8 retrieving revision 1.8.4.1 diff -C2 -d -r1.8 -r1.8.4.1 *** ModuleBrowser.py 3 Nov 2003 07:34:24 -0000 1.8 --- ModuleBrowser.py 29 Aug 2008 06:17:09 -0000 1.8.4.1 *************** *** 19,28 **** def GetSubList(self): ret = [] ! for item in self.clbrdata.values(): if item.__class__ != pyclbr.Class: # ie, it is a pyclbr Function instance (only introduced post 1.5.2) ret.append(HierListCLBRFunction( item ) ) else: ret.append(HierListCLBRClass( item) ) ! ret.sort() return ret def IsExpandable(self): --- 19,28 ---- def GetSubList(self): ret = [] ! for item in list(self.clbrdata.values()): if item.__class__ != pyclbr.Class: # ie, it is a pyclbr Function instance (only introduced post 1.5.2) ret.append(HierListCLBRFunction( item ) ) else: ret.append(HierListCLBRClass( item) ) ! ## ret.sort() - Py3k will not compare objects of different types return ret def IsExpandable(self): *************** *** 77,81 **** r1.sort() r2=[] ! for meth, lineno in self.methods.items(): r2.append(HierListCLBRMethod(meth, self.file, lineno)) r2.sort() --- 77,81 ---- r1.sort() r2=[] ! for meth, lineno in list(self.methods.items()): r2.append(HierListCLBRMethod(meth, self.file, lineno)) r2.sort() Index: document.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor/document.py,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** document.py 9 Aug 2008 16:47:20 -0000 1.11 --- document.py 29 Aug 2008 06:17:09 -0000 1.11.2.1 *************** *** 77,81 **** try: self.SaveFile(fileName) ! except IOError, details: win32ui.MessageBox("Error - could not save file\r\n\r\n%s"%details) return 0 --- 77,81 ---- try: self.SaveFile(fileName) ! except IOError as details: win32ui.MessageBox("Error - could not save file\r\n\r\n%s"%details) return 0 *************** *** 117,121 **** states.append(info) self.OnOpenDocument(self.GetPathName()) ! for view, info in map(None, views, states): if info is not None: view._EndUserStateChange(info) --- 117,121 ---- states.append(info) self.OnOpenDocument(self.GetPathName()) ! for view, info in zip(views, states): if info is not None: view._EndUserStateChange(info) *************** *** 129,139 **** try: newstat = os.stat(self.GetPathName()) ! except os.error, (code, msg): if not self.bReportedFileNotFound: ! print "The file '%s' is open for editing, but\nchecking it for changes caused the error: %s" % (self.GetPathName(), msg) self.bReportedFileNotFound = 1 return if self.bReportedFileNotFound: ! print "The file '%s' has re-appeared - continuing to watch for changes..." % (self.GetPathName(),) self.bReportedFileNotFound = 0 # Once found again we want to start complaining. changed = (self.fileStat is None) or \ --- 129,140 ---- try: newstat = os.stat(self.GetPathName()) ! except os.error as xxx_todo_changeme: ! (code, msg) = xxx_todo_changeme.args if not self.bReportedFileNotFound: ! print("The file '%s' is open for editing, but\nchecking it for changes caused the error: %s" % (self.GetPathName(), msg)) self.bReportedFileNotFound = 1 return if self.bReportedFileNotFound: ! print("The file '%s' has re-appeared - continuing to watch for changes..." % (self.GetPathName(),)) self.bReportedFileNotFound = 0 # Once found again we want to start complaining. changed = (self.fileStat is None) or \ *************** *** 219,223 **** if pretend_ss: ! print "We are only pretending to check it out!" win32api.SetFileAttributes(self.GetPathName(), win32con.FILE_ATTRIBUTE_NORMAL) self.ReloadDocument() --- 220,224 ---- if pretend_ss: ! print("We are only pretending to check it out!") win32api.SetFileAttributes(self.GetPathName(), win32con.FILE_ATTRIBUTE_NORMAL) self.ReloadDocument() *************** *** 232,236 **** except: traceback.print_exc() ! print "Error loading source control module." return 0 --- 233,237 ---- except: traceback.print_exc() ! print("Error loading source control module.") return 0 *************** *** 254,258 **** frame.AutoRestore() except: ! print "Could not bring document to foreground" return self._obj_.SaveModified() --- 255,259 ---- frame.AutoRestore() except: ! print("Could not bring document to foreground") return self._obj_.SaveModified() *************** *** 288,293 **** try: self.watchEvent = win32api.FindFirstChangeNotification(path, 0, filter) ! except win32api.error, (rc, fn, msg): ! print "Can not watch file", path, "for changes -", msg def SignalStop(self): win32event.SetEvent(self.stopEvent) --- 289,295 ---- try: self.watchEvent = win32api.FindFirstChangeNotification(path, 0, filter) ! except win32api.error as xxx_todo_changeme1: ! (rc, fn, msg) = xxx_todo_changeme1.args ! print("Can not watch file", path, "for changes -", msg) def SignalStop(self): win32event.SetEvent(self.stopEvent) *************** *** 307,312 **** # If the directory has been removed underneath us, we get this error. win32api.FindNextChangeNotification(self.watchEvent) ! except win32api.error, (rc, fn, msg): ! print "Can not watch file", self.doc.GetPathName(), "for changes -", msg break --- 309,315 ---- # If the directory has been removed underneath us, we get this error. win32api.FindNextChangeNotification(self.watchEvent) ! except win32api.error as xxx_todo_changeme2: ! (rc, fn, msg) = xxx_todo_changeme2.args ! print("Can not watch file", self.doc.GetPathName(), "for changes -", msg) break Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor/__init__.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** __init__.py 11 Mar 2000 00:52:46 -0000 1.2 --- __init__.py 29 Aug 2008 06:17:09 -0000 1.2.4.1 *************** *** 82,86 **** return eval(fmt) except: ! print "WARNING: Invalid font setting in registry - setting ignored" return default --- 82,86 ---- return eval(fmt) except: ! print("WARNING: Invalid font setting in registry - setting ignored") return default Index: editor.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor/editor.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** editor.py 9 Aug 2008 16:47:20 -0000 1.4 --- editor.py 29 Aug 2008 06:17:09 -0000 1.4.2.1 *************** *** 59,63 **** #ParentEditorDocument=docview.Document ! from document import EditorDocumentBase ParentEditorDocument=EditorDocumentBase class EditorDocument(ParentEditorDocument): --- 59,63 ---- #ParentEditorDocument=docview.Document ! from .document import EditorDocumentBase ParentEditorDocument=EditorDocumentBase class EditorDocument(ParentEditorDocument): *************** *** 304,308 **** try: if lineNo is None: ! lineNo = int(raw_input("Enter Line Number")) except (ValueError, KeyboardInterrupt): return 0 --- 304,308 ---- try: if lineNo is None: ! lineNo = int(input("Enter Line Number")) except (ValueError, KeyboardInterrupt): return 0 *************** *** 436,440 **** self.bCheckingFile = 0 ! from template import EditorTemplateBase class EditorTemplate(EditorTemplateBase): def __init__(self, res=win32ui.IDR_TEXTTYPE, makeDoc=None, makeFrame=None, makeView=None): --- 436,440 ---- self.bCheckingFile = 0 ! from .template import EditorTemplateBase class EditorTemplate(EditorTemplateBase): def __init__(self, res=win32ui.IDR_TEXTTYPE, makeDoc=None, makeFrame=None, makeView=None): Index: vss.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor/vss.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** vss.py 9 Aug 2008 16:47:20 -0000 1.4 --- vss.py 29 Aug 2008 06:17:09 -0000 1.4.2.1 *************** *** 82,86 **** item.Checkout(None, fileName) ok = 1 ! except pythoncom.com_error, (hr, msg, exc, arg): if exc: msg = exc[2] --- 82,87 ---- item.Checkout(None, fileName) ok = 1 ! except pythoncom.com_error as xxx_todo_changeme: ! (hr, msg, exc, arg) = xxx_todo_changeme.args if exc: msg = exc[2] Index: configui.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor/configui.py,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** configui.py 25 Feb 2008 05:31:46 -0000 1.8 --- configui.py 29 Aug 2008 06:17:09 -0000 1.8.2.1 *************** *** 1,4 **** from pywin.mfc import dialog ! import document import win32ui import win32con --- 1,4 ---- from pywin.mfc import dialog ! from . import document import win32ui import win32con *************** *** 47,51 **** - def _AddEditorOption(self, idd, typ, optionName, defaultVal): self.AddDDX(idd, optionName, typ) --- 47,50 ---- Index: template.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor/template.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** template.py 9 Aug 2008 16:47:20 -0000 1.4 --- template.py 29 Aug 2008 06:17:09 -0000 1.4.2.1 *************** *** 5,9 **** import pywin.framework.window import os ! import frame ParentEditorTemplate=docview.DocTemplate --- 5,9 ---- import pywin.framework.window import os ! from . import frame ParentEditorTemplate=docview.DocTemplate *************** *** 34,38 **** """Returns a list of property pages """ ! import configui return [configui.EditorPropertyPage(), configui.EditorWhitespacePropertyPage()] --- 34,38 ---- """Returns a list of property pages """ ! from . import configui return [configui.EditorPropertyPage(), configui.EditorWhitespacePropertyPage()] *************** *** 45,49 **** filename = os.path.join(path, filename) # print `filename` ! except (win32api.error, IndexError), details: pass # print "Couldnt get the full filename!", details --- 45,49 ---- filename = os.path.join(path, filename) # print `filename` ! except (win32api.error, IndexError) as details: pass # print "Couldnt get the full filename!", details Index: frame.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor/frame.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** frame.py 25 Feb 2008 03:19:12 -0000 1.6 --- frame.py 29 Aug 2008 06:17:09 -0000 1.6.2.1 *************** *** 4,9 **** import win32con import afxres ! ! import ModuleBrowser class EditorFrame(pywin.framework.window.MDIChildWnd): --- 4,8 ---- import win32con import afxres ! from . import ModuleBrowser class EditorFrame(pywin.framework.window.MDIChildWnd): |
From: Roger U. <ru...@us...> - 2008-08-29 06:17:00
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor/color In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18484/color Modified Files: Tag: py3k coloreditor.py Log Message: Changes for Python 3 Index: coloreditor.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/editor/color/coloreditor.py,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** coloreditor.py 13 Jun 2008 20:47:56 -0000 1.13 --- coloreditor.py 29 Aug 2008 06:17:09 -0000 1.13.2.1 *************** *** 272,276 **** self.FoldCollapseEvent(None) else: ! print "Unknown collapse/expand ID" def OnUpdateViewFold(self, cmdui): # Update the tick on the UI. if not self.bFolding: --- 272,276 ---- self.FoldCollapseEvent(None) else: ! print("Unknown collapse/expand ID") def OnUpdateViewFold(self, cmdui): # Update the tick on the UI. if not self.bFolding: *************** *** 356,360 **** maxLine = self.GetLineCount() # Find the first line, and check out its state. ! for lineSeek in xrange(maxLine): if self.SCIGetFoldLevel(lineSeek) & SC_FOLDLEVELHEADERFLAG: expanding = not self.SCIGetFoldExpanded(lineSeek) --- 356,360 ---- maxLine = self.GetLineCount() # Find the first line, and check out its state. ! for lineSeek in range(maxLine): if self.SCIGetFoldLevel(lineSeek) & SC_FOLDLEVELHEADERFLAG: expanding = not self.SCIGetFoldExpanded(lineSeek) *************** *** 363,367 **** # no folds here! return ! for lineSeek in xrange(lineSeek, maxLine): level = self.SCIGetFoldLevel(lineSeek) level_no = level & SC_FOLDLEVELNUMBERMASK - SC_FOLDLEVELBASE --- 363,367 ---- # no folds here! return ! for lineSeek in range(lineSeek, maxLine): level = self.SCIGetFoldLevel(lineSeek) level_no = level & SC_FOLDLEVELNUMBERMASK - SC_FOLDLEVELBASE *************** *** 384,388 **** levels=[SC_FOLDLEVELBASE] ## Scintilla's level number is based on amount of whitespace indentation ! for lineno in xrange(self.GetLineCount()): level = self.SCIGetFoldLevel(lineno) if not level & SC_FOLDLEVELHEADERFLAG: --- 384,388 ---- levels=[SC_FOLDLEVELBASE] ## Scintilla's level number is based on amount of whitespace indentation ! for lineno in range(self.GetLineCount()): level = self.SCIGetFoldLevel(lineno) if not level & SC_FOLDLEVELHEADERFLAG: *************** *** 410,414 **** levels=[SC_FOLDLEVELBASE] ## Scintilla's level number is based on amount of whitespace indentation ! for lineno in xrange(self.GetLineCount()): level = self.SCIGetFoldLevel(lineno) if not level & SC_FOLDLEVELHEADERFLAG: --- 410,414 ---- levels=[SC_FOLDLEVELBASE] ## Scintilla's level number is based on amount of whitespace indentation ! for lineno in range(self.GetLineCount()): level = self.SCIGetFoldLevel(lineno) if not level & SC_FOLDLEVELHEADERFLAG: *************** *** 441,445 **** return 1 win32ui.DoWaitCursor(1) ! for lineno in xrange(0, self.GetLineCount()): if self.SCIGetFoldLevel(lineno) & SC_FOLDLEVELHEADERFLAG and \ not self.SCIGetFoldExpanded(lineno): --- 441,445 ---- return 1 win32ui.DoWaitCursor(1) ! for lineno in range(0, self.GetLineCount()): if self.SCIGetFoldLevel(lineno) & SC_FOLDLEVELHEADERFLAG and \ not self.SCIGetFoldExpanded(lineno): *************** *** 462,466 **** win32ui.DoWaitCursor(1) self.Colorize() ! for lineno in xrange(0, self.GetLineCount()): if self.SCIGetFoldLevel(lineno) & SC_FOLDLEVELHEADERFLAG and \ self.SCIGetFoldExpanded(lineno): --- 462,466 ---- win32ui.DoWaitCursor(1) self.Colorize() ! for lineno in range(0, self.GetLineCount()): if self.SCIGetFoldLevel(lineno) & SC_FOLDLEVELHEADERFLAG and \ self.SCIGetFoldExpanded(lineno): |
From: Roger U. <ru...@us...> - 2008-08-29 06:16:35
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17967/scintilla Modified Files: Tag: py3k IDLEenvironment.py bindings.py config.py configui.py control.py document.py find.py formatter.py keycodes.py view.py Log Message: Changes for Python 3 Index: config.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/config.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** config.py 9 Aug 2008 16:47:07 -0000 1.6 --- config.py 29 Aug 2008 06:16:42 -0000 1.6.2.1 *************** *** 11,15 **** import sys import string ! import keycodes import marshal import stat --- 11,15 ---- import sys import string ! from . import keycodes import marshal import stat *************** *** 37,41 **** if sep_pos == -1: if line.strip(): ! print "Warning: Line %d: %s is an invalid entry" % (lineno, `line`) return None, None return "", "" --- 37,41 ---- if sep_pos == -1: if line.strip(): ! print("Warning: Line %d: %s is an invalid entry" % (lineno, repr(line))) return None, None return "", "" *************** *** 59,63 **** def find_config_files(): ! return map( lambda x: os.path.split(x)[1], map( lambda x: os.path.splitext(x)[0], glob.glob(os.path.join(pywin.__path__[0], "*.cfg")))) class ConfigManager: --- 59,63 ---- def find_config_files(): ! return [os.path.split(x)[1] for x in [os.path.splitext(x)[0] for x in glob.glob(os.path.join(pywin.__path__[0], "*.cfg"))]] class ConfigManager: *************** *** 161,165 **** ns = {} try: ! exec codeob in ns except: traceback.print_exc() --- 161,165 ---- ns = {} try: ! exec(codeob, ns) except: traceback.print_exc() *************** *** 168,172 **** if ns: num = 0 ! for name, func in ns.items(): if type(func)==types.FunctionType and name[:1] != '_': bindings.bind(name, func) --- 168,172 ---- if ns: num = 0 ! for name, func in list(ns.items()): if type(func)==types.FunctionType and name[:1] != '_': bindings.bind(name, func) *************** *** 201,205 **** map = {} keymap = subsection_keymap.get(subsection, {}) ! for key_info, map_event in keymap.items(): map[map_event] = key_info self.key_to_events[subsection] = map --- 201,205 ---- map = {} keymap = subsection_keymap.get(subsection, {}) ! for key_info, map_event in list(keymap.items()): map[map_event] = key_info self.key_to_events[subsection] = map *************** *** 212,218 **** def report_error(self, msg): self.last_error = msg ! print "Error in %s: %s" % (self.filename, msg) def report_warning(self, msg): ! print "Warning in %s: %s" % (self.filename, msg) def _readline(self, fp, lineno, bStripComments = 1): --- 212,218 ---- def report_error(self, msg): self.last_error = msg ! print("Error in %s: %s" % (self.filename, msg)) def report_warning(self, msg): ! print("Warning in %s: %s" % (self.filename, msg)) def _readline(self, fp, lineno, bStripComments = 1): *************** *** 280,284 **** c = compile("".join(lines), self.filename, "exec") self._save_data("extension code", c) ! except SyntaxError, details: msg = details[0] errlineno = details[1][1] + start_lineno --- 280,284 ---- c = compile("".join(lines), self.filename, "exec") self._save_data("extension code", c) ! except SyntaxError as details: msg = details[0] errlineno = details[1][1] + start_lineno *************** *** 308,312 **** map = cm.get_data("keys") took = time.clock()-start ! print "Loaded %s items in %.4f secs" % (len(map), took) if __name__=='__main__': --- 308,312 ---- map = cm.get_data("keys") took = time.clock()-start ! print("Loaded %s items in %.4f secs" % (len(map), took)) if __name__=='__main__': Index: IDLEenvironment.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/IDLEenvironment.py,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** IDLEenvironment.py 9 Aug 2008 16:47:07 -0000 1.11 --- IDLEenvironment.py 29 Aug 2008 06:16:42 -0000 1.11.2.1 *************** *** 23,27 **** modname = "pywin.idle." + module __import__(modname) ! except ImportError, details: msg = "The IDLE extension '%s' can not be located.\r\n\r\n" \ "Please correct the installation and restart the" \ --- 23,27 ---- modname = "pywin.idle." + module __import__(modname) ! except ImportError as details: msg = "The IDLE extension '%s' can not be located.\r\n\r\n" \ "Please correct the installation and restart the" \ *************** *** 42,46 **** if self.finished: return "" ! if not self.__dict__.has_key("_scint_lines"): # XXX - note - assumes this is only called once the file is loaded! self._scint_lines = self.text.edit.GetTextRange().split("\n") --- 42,46 ---- if self.finished: return "" ! if "_scint_lines" not in self.__dict__: # XXX - note - assumes this is only called once the file is loaded! self._scint_lines = self.text.edit.GetTextRange().split("\n") *************** *** 69,73 **** self.extension_menus = None try: ! for ext in self.extensions.values(): closer = getattr(ext, "close", None) if closer is not None: --- 69,73 ---- self.extension_menus = None try: ! for ext in list(self.extensions.values()): closer = getattr(ext, "close", None) if closer is not None: *************** *** 84,88 **** ext = self.extensions[extension] = klass(self) # Find and bind all the events defined in the extension. ! events = filter(lambda item: item[-6:]=="_event", dir(klass)) for event in events: name = "<<%s>>" % (event[:-6].replace("_", "-"), ) --- 84,88 ---- ext = self.extensions[extension] = klass(self) # Find and bind all the events defined in the extension. ! events = [item for item in dir(klass) if item[-6:]=="_event"] for event in events: name = "<<%s>>" % (event[:-6].replace("_", "-"), ) *************** *** 94,102 **** bindings = self.edit.bindings ret = [] ! for ext in self.extensions.values(): menudefs = getattr(ext, "menudefs", []) for name, items in menudefs: if name == menu_name: ! for text, event in filter(lambda item: item is not None, items): text = text.replace("&", "&&") text = text.replace("_", "&") --- 94,102 ---- bindings = self.edit.bindings ret = [] ! for ext in list(self.extensions.values()): menudefs = getattr(ext, "menudefs", []) for name, items in menudefs: if name == menu_name: ! for text, event in [item for item in items if item is not None]: text = text.replace("&", "&&") text = text.replace("_", "&") *************** *** 202,206 **** def TkIndexToOffset(bm, edit, marks): base, nextTokPos = _NextTok(bm, 0) ! if base is None: raise ValueError, "Empty bookmark ID!" if base.find(".")>0: try: --- 202,206 ---- def TkIndexToOffset(bm, edit, marks): base, nextTokPos = _NextTok(bm, 0) ! if base is None: raise ValueError("Empty bookmark ID!") if base.find(".")>0: try: *************** *** 208,212 **** if col=="first" or col=="last": # Tag name ! if line != "sel": raise ValueError, "Tags arent here!" sel = edit.GetSel() if sel[0]==sel[1]: --- 208,212 ---- if col=="first" or col=="last": # Tag name ! if line != "sel": raise ValueError("Tags arent here!") sel = edit.GetSel() if sel[0]==sel[1]: *************** *** 226,230 **** pos = pos + int(col) except (ValueError, IndexError): ! raise ValueError, "Unexpected literal in '%s'" % base elif base == 'insert': pos = edit.GetSel()[0] --- 226,230 ---- pos = pos + int(col) except (ValueError, IndexError): ! raise ValueError("Unexpected literal in '%s'" % base) elif base == 'insert': pos = edit.GetSel()[0] *************** *** 238,242 **** pos = marks[base] except KeyError: ! raise ValueError, "Unsupported base offset or undefined mark '%s'" % base while 1: --- 238,242 ---- pos = marks[base] except KeyError: ! raise ValueError("Unsupported base offset or undefined mark '%s'" % base) while 1: *************** *** 245,252 **** if word in ['+','-']: num, nextTokPos = _NextTok(bm, nextTokPos) ! if num is None: raise ValueError, "+/- operator needs 2 args" what, nextTokPos = _NextTok(bm, nextTokPos) ! if what is None: raise ValueError, "+/- operator needs 2 args" ! if what[0] <> "c": raise ValueError, "+/- only supports chars" if word=='+': pos = pos + int(num) --- 245,252 ---- if word in ['+','-']: num, nextTokPos = _NextTok(bm, nextTokPos) ! if num is None: raise ValueError("+/- operator needs 2 args") what, nextTokPos = _NextTok(bm, nextTokPos) ! if what is None: raise ValueError("+/- operator needs 2 args") ! if what[0] != "c": raise ValueError("+/- only supports chars") if word=='+': pos = pos + int(num) *************** *** 268,272 **** pos = pos + 1 else: ! raise ValueError, "Unsupported relative offset '%s'" % word return max(pos, 0) # Tkinter is tollerant of -ve indexes - we aren't --- 268,272 ---- pos = pos + 1 else: ! raise ValueError("Unsupported relative offset '%s'" % word) return max(pos, 0) # Tkinter is tollerant of -ve indexes - we aren't *************** *** 349,354 **** pos = self._getoffset(pos) except EmptyRange: ! raise TextError, "Empty range" self.edit.SetSel((pos, pos)) # IDLE only deals with "\n" - we will be nicer bits = text.split('\n') --- 349,356 ---- pos = self._getoffset(pos) except EmptyRange: ! raise TextError("Empty range") self.edit.SetSel((pos, pos)) + self.edit.SCIAddText(text) + """ # IDLE only deals with "\n" - we will be nicer bits = text.split('\n') *************** *** 357,360 **** --- 359,363 ---- self.edit.SCINewline() self.edit.SCIAddText(bit) + """ def delete(self, start, end=None): *************** *** 363,367 **** if end is not None: end = self._getoffset(end) except EmptyRange: ! raise TextError, "Empty range" # If end is specified and == start, then we must delete nothing. if start==end: return --- 366,370 ---- if end is not None: end = self._getoffset(end) except EmptyRange: ! raise TextError("Empty range") # If end is specified and == start, then we must delete nothing. if start==end: return *************** *** 396,400 **** pos = self._getoffset(pos) except EmptyRange: ! raise TextError, "Empty range '%s'" % pos if name == "insert": self.edit.SetSel( pos ) --- 399,403 ---- pos = self._getoffset(pos) except EmptyRange: ! raise TextError("Empty range '%s'" % pos) if name == "insert": self.edit.SetSel( pos ) *************** *** 403,417 **** def tag_add(self, name, start, end): ! if name != "sel": raise ValueError, "Only sel tag is supported" try: start = self._getoffset(start) end = self._getoffset(end) except EmptyRange: ! raise TextError, "Empty range" self.edit.SetSel( start, end ) def tag_remove(self, name, start, end): if name !="sel" or start != "1.0" or end != "end": ! raise ValueError, "Cant remove this tag" # Turn the sel into a cursor self.edit.SetSel(self.edit.GetSel()[0]) --- 406,420 ---- def tag_add(self, name, start, end): ! if name != "sel": raise ValueError("Only sel tag is supported") try: start = self._getoffset(start) end = self._getoffset(end) except EmptyRange: ! raise TextError("Empty range") self.edit.SetSel( start, end ) def tag_remove(self, name, start, end): if name !="sel" or start != "1.0" or end != "end": ! raise ValueError("Cant remove this tag") # Turn the sel into a cursor self.edit.SetSel(self.edit.GetSel()[0]) *************** *** 442,451 **** rc = TkIndexToOffset(index, edit, {}) if rc != expected: ! print "ERROR: Index", index,", expected", expected, "but got", rc def TestGet(fr, to, t, expected): got = t.get(fr, to) if got != expected: ! print "ERROR: get(%s, %s) expected %s, but got %s" % (`fr`, `to`, `expected`, `got`) def test(): --- 445,454 ---- rc = TkIndexToOffset(index, edit, {}) if rc != expected: ! print("ERROR: Index", index,", expected", expected, "but got", rc) def TestGet(fr, to, t, expected): got = t.get(fr, to) if got != expected: ! print("ERROR: get(%s, %s) expected %s, but got %s" % (repr(fr), repr(to), repr(expected), repr(got))) def test(): Index: keycodes.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/keycodes.py,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** keycodes.py 9 Aug 2008 16:47:07 -0000 1.5 --- keycodes.py 29 Aug 2008 06:16:42 -0000 1.5.2.1 *************** *** 31,35 **** def _fillmap(): # Pull the VK_names from win32con ! names = filter(lambda entry: entry[:3]=="VK_", win32con.__dict__.keys()) for name in names: n = name[3:].lower() --- 31,35 ---- def _fillmap(): # Pull the VK_names from win32con ! names = [entry for entry in list(win32con.__dict__.keys()) if entry[:3]=="VK_"] for name in names: n = name[3:].lower() *************** *** 126,130 **** def _psc(char): sc = get_scan_code(char) ! print "Char %s -> %d -> %s" % (`char`, sc, key_code_to_name.get(sc)) def test1(): --- 126,130 ---- def _psc(char): sc = get_scan_code(char) ! print("Char %s -> %d -> %s" % (repr(char), sc, key_code_to_name.get(sc))) def test1(): *************** *** 136,140 **** def _pkn(n): scancode, flags = parse_key_name(n) ! print "%s -> %s,%s -> %s" % (n, scancode, flags, make_key_name(scancode, flags)) def test2(): --- 136,140 ---- def _pkn(n): scancode, flags = parse_key_name(n) ! print("%s -> %s,%s -> %s" % (n, scancode, flags, make_key_name(scancode, flags))) def test2(): Index: document.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/document.py,v retrieving revision 1.6 retrieving revision 1.6.4.1 diff -C2 -d -r1.6 -r1.6.4.1 *** document.py 29 Oct 2000 23:44:42 -0000 1.6 --- document.py 29 Aug 2008 06:16:42 -0000 1.6.4.1 *************** *** 2,6 **** from pywin.mfc import docview from pywin import is_platform_unicode, default_platform_encoding, default_scintilla_encoding ! from scintillacon import * import win32con import string --- 2,6 ---- from pywin.mfc import docview from pywin import is_platform_unicode, default_platform_encoding, default_scintilla_encoding ! from .scintillacon import * import win32con import string *************** *** 23,31 **** f = codecs.open(filename, 'rb', default_platform_encoding) else: ! f = open(filename, 'rb') try: text = f.read() finally: f.close() if is_platform_unicode: # Translate from locale-specific (MCBS) encoding to UTF-8 for Scintilla --- 23,32 ---- f = codecs.open(filename, 'rb', default_platform_encoding) else: ! f = open(filename, 'r') try: text = f.read() finally: f.close() + text = text.encode('utf-8') if is_platform_unicode: # Translate from locale-specific (MCBS) encoding to UTF-8 for Scintilla *************** *** 64,68 **** doc = self view.SendScintilla(SCI_CLEARALL) ! view.SendMessage(SCI_ADDTEXT, buffer(text)) view.SendScintilla(SCI_SETUNDOCOLLECTION, 1, 0) view.SendScintilla(win32con.EM_EMPTYUNDOBUFFER, 0, 0) --- 65,69 ---- doc = self view.SendScintilla(SCI_CLEARALL) ! view.SendMessage(SCI_ADDTEXT, text) view.SendScintilla(SCI_SETUNDOCOLLECTION, 1, 0) view.SendScintilla(win32con.EM_EMPTYUNDOBUFFER, 0, 0) *************** *** 126,135 **** for view in self.GetAllViews(): func = getattr(view, funcName) ! apply(func, args) def _ApplyOptionalToViews(self, funcName, *args): for view in self.GetAllViews(): func = getattr(view, funcName, None) if func is not None: ! apply(func, args) def GetEditorView(self): # Find the first frame with a view, --- 127,136 ---- for view in self.GetAllViews(): func = getattr(view, funcName) ! func(*args) def _ApplyOptionalToViews(self, funcName, *args): for view in self.GetAllViews(): func = getattr(view, funcName, None) if func is not None: ! func(*args) def GetEditorView(self): # Find the first frame with a view, *************** *** 151,155 **** for v in self.doc.GetAllViews(): if v.GetSafeHwnd() == hwndFrom: ! return apply(getattr(v, self.name), (std, extra)) # Delegate to the document, but only from a single view (as each view sends it seperately) --- 152,156 ---- for v in self.doc.GetAllViews(): if v.GetSafeHwnd() == hwndFrom: ! return getattr(v, self.name)(*(std, extra)) # Delegate to the document, but only from a single view (as each view sends it seperately) *************** *** 161,163 **** (hwndFrom, idFrom, code) = std if hwndFrom == self.doc.GetEditorView().GetSafeHwnd(): ! apply(self.delegate, (std, extra)) --- 162,164 ---- (hwndFrom, idFrom, code) = std if hwndFrom == self.doc.GetEditorView().GetSafeHwnd(): ! self.delegate(*(std, extra)) Index: control.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/control.py,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -C2 -d -r1.17 -r1.17.2.1 *** control.py 9 Aug 2008 16:47:07 -0000 1.17 --- control.py 29 Aug 2008 06:16:42 -0000 1.17.2.1 *************** *** 6,9 **** --- 6,10 ---- from pywin.mfc import window + from pywin import default_scintilla_encoding import win32con import win32ui *************** *** 13,17 **** import string import os ! from scintillacon import * # Load Scintilla.dll to get access to the control. --- 14,18 ---- import string import os ! from .scintillacon import * # Load Scintilla.dll to get access to the control. *************** *** 58,62 **** def SCIAddText(self, text): ! self.SendMessage(SCI_ADDTEXT, buffer(text)) def SCIAddStyledText(self, text, style = None): # If style is None, text is assumed to be a "native" Scintilla buffer. --- 59,63 ---- def SCIAddText(self, text): ! self.SendMessage(SCI_ADDTEXT, text.encode(default_scintilla_encoding)) def SCIAddStyledText(self, text, style = None): # If style is None, text is assumed to be a "native" Scintilla buffer. *************** *** 64,74 **** # assumed to apply to the entire string. if style is not None: ! text = map(lambda char, style=style: char+chr(style), text) text = ''.join(text) ! self.SendMessage(SCI_ADDSTYLEDTEXT, buffer(text)) def SCIInsertText(self, text, pos=-1): ! sma = array.array('c', text+"\0") ! (a,l) = sma.buffer_info() ! self.SendScintilla(SCI_INSERTTEXT, pos, a) def SCISetSavePoint(self): self.SendScintilla(SCI_SETSAVEPOINT) --- 65,76 ---- # assumed to apply to the entire string. if style is not None: ! text = list(map(lambda char, style=style: char+chr(style), text)) text = ''.join(text) ! self.SendMessage(SCI_ADDSTYLEDTEXT, text.encode(default_scintilla_encoding)) def SCIInsertText(self, text, pos=-1): ! ## sma = array.array('u', text+"\0") ! ## (a,l) = sma.buffer_info() ! buff=(text+'\0').encode(default_scintilla_encoding) ! self.SendScintilla(SCI_INSERTTEXT, pos, buff) def SCISetSavePoint(self): self.SendScintilla(SCI_SETSAVEPOINT) *************** *** 107,113 **** return self.SendScintilla(SCI_STYLESETEOLFILLED, num, v) def SCIStyleSetFont(self, num, name, characterset=0): ! buff = array.array('c', name + "\0") ! addressBuffer = buff.buffer_info()[0] ! self.SendScintilla(SCI_STYLESETFONT, num, addressBuffer) self.SendScintilla(SCI_STYLESETCHARACTERSET, num, characterset) def SCIStyleSetBold(self, num, bBold): --- 109,115 ---- return self.SendScintilla(SCI_STYLESETEOLFILLED, num, v) def SCIStyleSetFont(self, num, name, characterset=0): ! buff = (name + "\0").encode(default_scintilla_encoding) ! ## addressBuffer = buff.buffer_info()[0] ! self.SendScintilla(SCI_STYLESETFONT, num, buff) self.SendScintilla(SCI_STYLESETCHARACTERSET, num, characterset) def SCIStyleSetBold(self, num, bBold): *************** *** 180,186 **** if type(text) in [type([]), type(())]: text = ' '.join(text) ! buff = array.array('c', text + "\0") ! addressBuffer = buff.buffer_info()[0] ! return self.SendScintilla(SCI_AUTOCSHOW, 0, addressBuffer) def SCIAutoCCancel(self): self.SendScintilla(SCI_AUTOCCANCEL) --- 182,187 ---- if type(text) in [type([]), type(())]: text = ' '.join(text) ! buff = (text + "\0").encode(default_scintilla_encoding) ! return self.SendScintilla(SCI_AUTOCSHOW, 0, buff) def SCIAutoCCancel(self): self.SendScintilla(SCI_AUTOCCANCEL) *************** *** 190,196 **** return self.SendScintilla(SCI_AUTOCCOMPLETE) def SCIAutoCStops(self, stops): ! buff = array.array('c', stops + "\0") ! addressBuffer = buff.buffer_info()[0] ! self.SendScintilla(SCI_AUTOCSTOPS, 0, addressBuffer) def SCIAutoCSetAutoHide(self, hide): self.SendScintilla(SCI_AUTOCSETAUTOHIDE, hide) --- 191,196 ---- return self.SendScintilla(SCI_AUTOCCOMPLETE) def SCIAutoCStops(self, stops): ! buff = (stops + "\0").encode(default_scintilla_encoding) ! self.SendScintilla(SCI_AUTOCSTOPS, 0, buff) def SCIAutoCSetAutoHide(self, hide): self.SendScintilla(SCI_AUTOCSETAUTOHIDE, hide) *************** *** 200,211 **** def SCICallTipShow(self, text, pos=-1): if pos==-1: pos = self.GetSel()[0] ! if isinstance(text, unicode): # I'm really not sure what the correct encoding # to use is - but it has gotta be better than total # failure due to the array module text = text.encode("mbcs") ! buff = array.array('c', text + "\0") ! addressBuffer = buff.buffer_info()[0] ! self.SendScintilla(SCI_CALLTIPSHOW, pos, addressBuffer) def SCICallTipCancel(self): self.SendScintilla(SCI_CALLTIPCANCEL) --- 200,213 ---- def SCICallTipShow(self, text, pos=-1): if pos==-1: pos = self.GetSel()[0] ! """ ! if isinstance(text, str): # I'm really not sure what the correct encoding # to use is - but it has gotta be better than total # failure due to the array module text = text.encode("mbcs") ! """ ! buff = (text + "\0").encode(default_scintilla_encoding) ! ## addressBuffer = buff.buffer_info()[0] ! self.SendScintilla(SCI_CALLTIPSHOW, pos, buff) def SCICallTipCancel(self): self.SendScintilla(SCI_CALLTIPCANCEL) *************** *** 218,227 **** # Lexer etc def SCISetKeywords(self, keywords, kw_list_no = 0): ! ar = array.array('c', keywords+"\0") ! (a,l) = ar.buffer_info() ! self.SendScintilla(SCI_SETKEYWORDS, kw_list_no, a) def SCISetProperty(self, name, value): ! name_buff = array.array('c', name + "\0") ! val_buff = array.array("c", str(value) + "\0") address_name_buffer = name_buff.buffer_info()[0] address_val_buffer = val_buff.buffer_info()[0] --- 220,228 ---- # Lexer etc def SCISetKeywords(self, keywords, kw_list_no = 0): ! buff = (keywords+"\0").encode(default_scintilla_encoding) ! self.SendScintilla(SCI_SETKEYWORDS, kw_list_no, buff) def SCISetProperty(self, name, value): ! name_buff = array.array('b', (name + '\0').encode('utf-8')) ! val_buff = array.array("b", (str(value)+'\0').encode('utf-8')) address_name_buffer = name_buff.buffer_info()[0] address_val_buffer = val_buff.buffer_info()[0] *************** *** 279,289 **** """ findtextex_fmt='llPll' ! buff = array.array('c', findText + "\0") ! addressBuffer = buff.buffer_info()[0] ! ft = struct.pack(findtextex_fmt, range[0], range[1], addressBuffer, 0, 0) ! ftBuff = array.array('c', ft) ! addressFtBuff = ftBuff.buffer_info()[0] ! rc = self.SendScintilla(EM_FINDTEXTEX, flags, addressFtBuff) ! ftUnpacked = struct.unpack(findtextex_fmt, ftBuff.tostring()) return rc, (ftUnpacked[3], ftUnpacked[4]) --- 280,290 ---- """ findtextex_fmt='llPll' ! ## Scintilla does not handle unicode in EM_FINDTEXT msg (FINDTEXTEX struct) ! txt_buff = (findText+'\0').encode('utf-8') ! txt_array = array.array('b', txt_buff) ! ft_buff = struct.pack(findtextex_fmt, range[0], range[1], txt_array.buffer_info()[0], 0, 0) ! ft_array = array.array('b', ft_buff) ! rc = self.SendScintilla(EM_FINDTEXTEX, flags, ft_array.buffer_info()[0]) ! ftUnpacked = struct.unpack(findtextex_fmt, ft_array) return rc, (ftUnpacked[3], ftUnpacked[4]) *************** *** 299,306 **** def GetSelText(self): start, end = self.GetSel() ! txtBuf = array.array('c', " " * ((end-start)+1)) addressTxtBuf = txtBuf.buffer_info()[0] self.SendScintilla(EM_GETSELTEXT, 0, addressTxtBuf) ! return txtBuf.tostring()[:-1] def SetSel(self, start=0, end=None): --- 300,307 ---- def GetSelText(self): start, end = self.GetSel() ! txtBuf = array.array('u', " " * ((end-start)+1)) addressTxtBuf = txtBuf.buffer_info()[0] self.SendScintilla(EM_GETSELTEXT, 0, addressTxtBuf) ! return txtBuf.tostring().decode(default_scintilla_encoding) def SetSel(self, start=0, end=None): *************** *** 315,319 **** assert end <= self.GetTextLength(), "The end postion is invalid (%d/%d)" % (end, self.GetTextLength()) cr = struct.pack('ll', start, end) ! crBuff = array.array('c', cr) addressCrBuff = crBuff.buffer_info()[0] rc = self.SendScintilla(EM_EXSETSEL, 0, addressCrBuff) --- 316,320 ---- assert end <= self.GetTextLength(), "The end postion is invalid (%d/%d)" % (end, self.GetTextLength()) cr = struct.pack('ll', start, end) ! crBuff = array.array('b', cr) addressCrBuff = crBuff.buffer_info()[0] rc = self.SendScintilla(EM_EXSETSEL, 0, addressCrBuff) *************** *** 347,362 **** assert end >= 0 and end <= self.GetTextLength(), "The end postion is invalid" initer = "=" * (end - start + 1) ! buff = array.array('c', initer) addressBuffer = buff.buffer_info()[0] tr = struct.pack('llP', start, end, addressBuffer) ! trBuff = array.array('c', tr) addressTrBuff = trBuff.buffer_info()[0] numChars = self.SendScintilla(EM_GETTEXTRANGE, 0, addressTrBuff) ! return buff.tostring()[:numChars] ! def ReplaceSel(self, str): ! buff = array.array('c', str + "\0") ! self.SendScintilla(SCI_REPLACESEL, 0, buff.buffer_info()[0]); ! buff = None def GetLine(self, line=-1): --- 348,363 ---- assert end >= 0 and end <= self.GetTextLength(), "The end postion is invalid" initer = "=" * (end - start + 1) ! buff = array.array('u', initer) addressBuffer = buff.buffer_info()[0] tr = struct.pack('llP', start, end, addressBuffer) ! trBuff = array.array('b', tr) addressTrBuff = trBuff.buffer_info()[0] numChars = self.SendScintilla(EM_GETTEXTRANGE, 0, addressTrBuff) ! ## return buff.tounicode()[:numChars] ! return buff.tostring()[:numChars].decode(default_scintilla_encoding) ! def ReplaceSel(self, str): ! buff = (str + "\0").encode(default_scintilla_encoding) ! self.SendScintilla(SCI_REPLACESEL, 0, buff) def GetLine(self, line=-1): *************** *** 376,381 **** def SetWordWrap(self, mode): ! if mode <> win32ui.CRichEditView_WrapNone: ! raise ValueError, "We dont support word-wrap (I dont think :-)" class CScintillaColorEditInterface(CScintillaEditInterface): --- 377,382 ---- def SetWordWrap(self, mode): ! if mode != win32ui.CRichEditView_WrapNone: ! raise ValueError("We dont support word-wrap (I dont think :-)") class CScintillaColorEditInterface(CScintillaEditInterface): *************** *** 391,395 **** if parent_func is not None: return parent_func() ! import formatter ## return formatter.PythonSourceFormatter(self) return formatter.BuiltinPythonSourceFormatter(self) --- 392,396 ---- if parent_func is not None: return parent_func() ! from . import formatter ## return formatter.PythonSourceFormatter(self) return formatter.BuiltinPythonSourceFormatter(self) Index: find.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/find.py,v retrieving revision 1.10 retrieving revision 1.10.4.1 diff -C2 -d -r1.10 -r1.10.4.1 *** find.py 16 Jun 2005 08:59:11 -0000 1.10 --- find.py 29 Aug 2008 06:16:42 -0000 1.10.4.1 *************** *** 27,31 **** def __setattr__(self, attr, val): if not hasattr(self, attr): ! raise AttributeError, attr self.__dict__[attr]=val --- 27,31 ---- def __setattr__(self, attr, val): if not hasattr(self, attr): ! raise AttributeError(attr) self.__dict__[attr]=val *************** *** 104,108 **** doc = control.GetParent().GetDocument() except AttributeError: ! print "Cant find a document for the control!" doc = None if doc is not None: --- 104,108 ---- doc = control.GetParent().GetDocument() except AttributeError: ! print("Cant find a document for the control!") doc = None if doc is not None: *************** *** 215,219 **** visible = win32con.WS_CHILD | win32con.WS_VISIBLE dt = [ ! ["Find", (0, 2, 240, 75), style, None, (8, "MS Sans Serif")], ["Static", "Fi&nd What:", 101, (5, 8, 40, 10), visible], ["Edit", "", 102, (50, 7, 120, 12), visible | win32con.WS_BORDER | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL], --- 215,219 ---- visible = win32con.WS_CHILD | win32con.WS_VISIBLE dt = [ ! ["Find", (0, 2, 240, 75), style, 0, (8, "MS Sans Serif")], ["Static", "Fi&nd What:", 101, (5, 8, 40, 10), visible], ["Edit", "", 102, (50, 7, 120, 12), visible | win32con.WS_BORDER | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL], *************** *** 233,237 **** visible = win32con.WS_CHILD | win32con.WS_VISIBLE dt = [ ! ["Replace", (0, 2, 240, 95), style, None, (8, "MS Sans Serif")], ["Static", "Fi&nd What:", 101, (5, 8, 40, 10), visible], ["Edit", "", 102, (60, 7, 110, 12), visible | win32con.WS_BORDER | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL], --- 233,237 ---- visible = win32con.WS_CHILD | win32con.WS_VISIBLE dt = [ ! ["Replace", (0, 2, 240, 95), style, 0, (8, "MS Sans Serif")], ["Static", "Fi&nd What:", 101, (5, 8, 40, 10), visible], ["Edit", "", 102, (60, 7, 110, 12), visible | win32con.WS_BORDER | win32con.WS_TABSTOP | win32con.ES_AUTOHSCROLL], Index: configui.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/configui.py,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** configui.py 9 Aug 2008 16:47:07 -0000 1.5 --- configui.py 29 Aug 2008 06:16:42 -0000 1.5.2.1 *************** *** 5,9 **** import copy import string ! from scintillacon import * ###################################################### --- 5,9 ---- import copy import string ! from .scintillacon import * ###################################################### *************** *** 32,36 **** try: if self.scintillaClass is None: ! import control sc = control.CScintillaEdit else: --- 32,36 ---- try: if self.scintillaClass is None: ! from . import control sc = control.CScintillaEdit else: *************** *** 68,72 **** self.listbox = self.GetDlgItem(win32ui.IDC_LIST1) self.HookCommand(self.OnListCommand, win32ui.IDC_LIST1) ! names = self.styles.keys() names.sort() for name in names: --- 68,72 ---- self.listbox = self.GetDlgItem(win32ui.IDC_LIST1) self.HookCommand(self.OnListCommand, win32ui.IDC_LIST1) ! names = list(self.styles.keys()) names.sort() for name in names: Index: view.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/view.py,v retrieving revision 1.28 retrieving revision 1.28.2.1 diff -C2 -d -r1.28 -r1.28.2.1 *** view.py 9 Aug 2008 16:47:08 -0000 1.28 --- view.py 29 Aug 2008 06:16:42 -0000 1.28.2.1 *************** *** 1,9 **** ! # A general purpose MFC CCtrlView view that uses Scintilla. ! ! import control ! import IDLEenvironment # IDLE emulation. from pywin.mfc import docview from pywin.mfc import dialog ! from scintillacon import * import win32con import win32ui --- 1,7 ---- ! from . import control ! from . import IDLEenvironment # IDLE emulation. from pywin.mfc import docview from pywin.mfc import dialog ! from .scintillacon import * import win32con import win32ui *************** *** 14,19 **** import types import __main__ # for attribute lookup ! import bindings ! import keycodes import struct import re --- 12,17 ---- import types import __main__ # for attribute lookup ! from . import bindings ! from . import keycodes import struct import re *************** *** 139,143 **** def _MakeColorizer(self): ext = os.path.splitext(self.GetDocument().GetPathName())[1] ! import formatter return formatter.BuiltinPythonSourceFormatter(self, ext) --- 137,141 ---- def _MakeColorizer(self): ext = os.path.splitext(self.GetDocument().GetPathName())[1] ! from . import formatter return formatter.BuiltinPythonSourceFormatter(self, ext) *************** *** 284,288 **** if cmdid is None: # No event of that name - no point displaying it. ! print 'View.AppendMenu(): Unknown event "%s" specified for menu text "%s" - ignored' % (event, text) return keyname = configManager.get_key_binding( event, self._GetSubConfigNames() ) --- 282,286 ---- if cmdid is None: # No event of that name - no point displaying it. ! print('View.AppendMenu(): Unknown event "%s" specified for menu text "%s" - ignored' % (event, text)) return keyname = configManager.get_key_binding( event, self._GetSubConfigNames() ) *************** *** 350,360 **** def OnCmdEditFind(self, cmd, code): ! import find find.ShowFindDialog() def OnCmdEditRepeat(self, cmd, code): ! import find find.FindNext() def OnCmdEditReplace(self, cmd, code): ! import find find.ShowReplaceDialog() --- 348,358 ---- def OnCmdEditFind(self, cmd, code): ! from . import find find.ShowFindDialog() def OnCmdEditRepeat(self, cmd, code): ! from . import find find.FindNext() def OnCmdEditReplace(self, cmd, code): ! from . import find find.ShowReplaceDialog() *************** *** 379,383 **** def OnCmdGotoLine(self, cmd, id): try: ! lineNo = int(raw_input("Enter Line Number"))-1 except (ValueError, KeyboardInterrupt): return 0 --- 377,381 ---- def OnCmdGotoLine(self, cmd, id): try: ! lineNo = int(input("Enter Line Number"))-1 except (ValueError, KeyboardInterrupt): return 0 *************** *** 390,395 **** s = self.GetTextRange() if is_platform_unicode: ! s = unicode(s,"utf-8").encode("mbcs") ! f = open(filename, 'wb') f.write(s) f.close() --- 388,393 ---- s = self.GetTextRange() if is_platform_unicode: ! s = str(s,"utf-8").encode("mbcs") ! f = open(filename, 'w') f.write(s) f.close() *************** *** 433,453 **** if hasattr(ob, "_oleobj_"): try: ! for iTI in xrange(0,ob._oleobj_.GetTypeInfoCount()): typeInfo = ob._oleobj_.GetTypeInfo(iTI) typeAttr = typeInfo.GetTypeAttr() ! for iFun in xrange(0,typeAttr.cFuncs): funDesc = typeInfo.GetFuncDesc(iFun) funName = typeInfo.GetNames(funDesc.memid)[0] ! if not items_dict.has_key(funName): items_dict[funName] = None except: pass except: ! win32ui.SetStatusText("Error attempting to get object attributes - %s" % (`sys.exc_info()[0]`,)) ! # ensure all keys are strings. ! items = map(str, items_dict.keys()) # All names that start with "_" go! ! items = filter(lambda word: word[0]!='_', items) if not items: --- 431,451 ---- if hasattr(ob, "_oleobj_"): try: ! for iTI in range(0,ob._oleobj_.GetTypeInfoCount()): typeInfo = ob._oleobj_.GetTypeInfo(iTI) typeAttr = typeInfo.GetTypeAttr() ! for iFun in range(0,typeAttr.cFuncs): funDesc = typeInfo.GetFuncDesc(iFun) funName = typeInfo.GetNames(funDesc.memid)[0] ! if funName not in items_dict: items_dict[funName] = None except: pass except: ! win32ui.SetStatusText("Error attempting to get object attributes - %s" % (repr(sys.exc_info()[0]),)) ! # ensure all keys are strings. ! items = [str(k) for k in items_dict.keys()] # All names that start with "_" go! ! items = [k for k in items if not k.startswith('_')] if not items: *************** *** 466,477 **** text = self.GetTextRange(self.LineIndex(minline),endpos) try: ! list = re.findall(r"\b"+left+"\.\w+",text) except re.error: # parens etc may make an invalid RE, but this code wouldnt # benefit even if the RE did work :-) ! list = [] prefix = len(left)+1 unique = {} ! for li in list: unique[li[prefix:]] = 1 # Assuming traditional usage of self... --- 464,475 ---- text = self.GetTextRange(self.LineIndex(minline),endpos) try: ! l = re.findall(r"\b"+left+"\.\w+",text) except re.error: # parens etc may make an invalid RE, but this code wouldnt # benefit even if the RE did work :-) ! l = [] prefix = len(left)+1 unique = {} ! for li in l: unique[li[prefix:]] = 1 # Assuming traditional usage of self... *************** *** 479,483 **** self._UpdateWithClassMethods(unique,curclass) ! items = filter(lambda word: word[:2]!='__' or word[-2:]!='__', unique.keys()) # Ignore the word currently to the right of the dot - probably a red-herring. try: --- 477,481 ---- self._UpdateWithClassMethods(unique,curclass) ! items = [word for word in unique.keys() if word[:2]!='__' or word[-2:]!='__'] # Ignore the word currently to the right of the dot - probably a red-herring. try: *************** *** 530,534 **** curclass = None # Find out which class we are in ! for item in clbrdata.values(): if item.module==curmodule: item_lineno = item.lineno - 1 # Scintilla counts lines from 0, whereas pyclbr - from 1 --- 528,532 ---- curclass = None # Find out which class we are in ! for item in list(clbrdata.values()): if item.module==curmodule: item_lineno = item.lineno - 1 # Scintilla counts lines from 0, whereas pyclbr - from 1 *************** *** 653,659 **** hdcFormat = dc.GetHandleAttrib() fr = struct.pack(fmt, hdcRender, hdcFormat, rc[0], rc[1], rc[2], rc[3], rc[0], rc[1], rc[2], rc[3], pageStart, lengthDoc) ! frBuff = array.array('c', fr) ! addressFrBuff = frBuff.buffer_info()[0] ! nextPageStart = self.SendScintilla(EM_FORMATRANGE, draw, addressFrBuff) return nextPageStart --- 651,657 ---- hdcFormat = dc.GetHandleAttrib() fr = struct.pack(fmt, hdcRender, hdcFormat, rc[0], rc[1], rc[2], rc[3], rc[0], rc[1], rc[2], rc[3], pageStart, lengthDoc) ! ## frBuff = array......array('b', fr) ! ## addressFrBuff = frBuff.buffer_info()[0] ! nextPageStart = self.SendScintilla(EM_FORMATRANGE, draw, fr) return nextPageStart *************** *** 684,688 **** global configManager # Bit of a hack I dont kow what to do about? ! from config import ConfigManager configName = rc = win32ui.GetProfileVal("Editor", "Keyboard Config", "default") configManager = ConfigManager(configName) --- 682,686 ---- global configManager # Bit of a hack I dont kow what to do about? ! from .config import ConfigManager configName = rc = win32ui.GetProfileVal("Editor", "Keyboard Config", "default") configManager = ConfigManager(configName) Index: bindings.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/bindings.py,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** bindings.py 9 Aug 2008 16:47:07 -0000 1.5 --- bindings.py 29 Aug 2008 06:16:42 -0000 1.5.2.1 *************** *** 1,9 **** ! import IDLEenvironment import string import win32ui import win32api import win32con ! import keycodes import sys HANDLER_ARGS_GUESS=0 --- 1,10 ---- ! from . import IDLEenvironment import string import win32ui import win32api import win32con ! from . import keycodes import sys + import traceback HANDLER_ARGS_GUESS=0 *************** *** 50,54 **** def complete_configure(self): ! for id in command_to_events.keys(): self.parent_view.HookCommand(self._OnCommand, id) --- 51,55 ---- def complete_configure(self): ! for id in list(command_to_events.keys()): self.parent_view.HookCommand(self._OnCommand, id) *************** *** 61,65 **** except win32ui.error: # No status bar! ! print problem def update_keymap(self, keymap): --- 62,66 ---- except win32ui.error: # No status bar! ! print(problem) def update_keymap(self, keymap): *************** *** 81,85 **** if id is None: # See if we even have an event of that name!? ! if not self.bindings.has_key(event): return None id = self.bind_command(event) --- 82,86 ---- if id is None: # See if we even have an event of that name!? ! if event not in self.bindings: return None id = self.bind_command(event) *************** *** 139,143 **** else: args = (event_param,) ! rc = apply(binding.handler, args) if handler_args_type==HANDLER_ARGS_IDLE: # Convert to our return code. --- 140,144 ---- else: args = (event_param,) ! rc = binding.handler(*args) if handler_args_type==HANDLER_ARGS_IDLE: # Convert to our return code. *************** *** 147,154 **** rc = 1 except: ! import traceback message = "Firing event '%s' failed." % event ! print message ! traceback.print_exc() self.report_error(message) rc = 1 # Let any default handlers have a go! --- 148,155 ---- rc = 1 except: ! traceback.print_exc(chain=False) message = "Firing event '%s' failed." % event ! print(message) ! self.report_error(message) rc = 1 # Let any default handlers have a go! Index: formatter.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/formatter.py,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -C2 -d -r1.14 -r1.14.2.1 *** formatter.py 9 Aug 2008 16:47:07 -0000 1.14 --- formatter.py 29 Aug 2008 06:16:42 -0000 1.14.2.1 *************** *** 6,10 **** import string import array ! import scintillacon WM_KICKIDLE = 0x036A --- 6,10 ---- import string import array ! from . import scintillacon WM_KICKIDLE = 0x036A *************** *** 101,105 **** assert stylenum is not None, "We must have a style number" assert style.stylenum is None, "Style has already been registered" ! assert not self.styles.has_key(stylenum), "We are reusing a style number!" style.stylenum = stylenum self.styles[style.name] = style --- 101,105 ---- assert stylenum is not None, "We must have a style number" assert style.stylenum is None, "Style has already been registered" ! assert stylenum not in self.styles, "We are reusing a style number!" style.stylenum = stylenum self.styles[style.name] = style *************** *** 153,157 **** defaultStyle.stylenum = scintillacon.STYLE_DEFAULT self._ReformatStyle(defaultStyle) ! for style in self.styles.values(): if style.aliased is None: style.NormalizeAgainstDefault(baseFormat) --- 153,157 ---- defaultStyle.stylenum = scintillacon.STYLE_DEFAULT self._ReformatStyle(defaultStyle) ! for style in list(self.styles.values()): if style.aliased is None: style.NormalizeAgainstDefault(baseFormat) *************** *** 166,170 **** self.bUseFixed = int(self.LoadPreference("Use Fixed", 1)) ! for style in self.styles.values(): new = self.LoadPreference(style.name, str(style.format)) try: --- 166,170 ---- self.bUseFixed = int(self.LoadPreference("Use Fixed", 1)) ! for style in list(self.styles.values()): new = self.LoadPreference(style.name, str(style.format)) try: *************** *** 177,181 **** except: ! print "Error loading style data for", style.name def LoadPreference(self, name, default): --- 177,181 ---- except: ! print("Error loading style data for", style.name) def LoadPreference(self, name, default): *************** *** 186,190 **** self.SavePreference("Base Format Proportional", str(self.baseFormatProp)) self.SavePreference("Use Fixed", self.bUseFixed) ! for style in self.styles.values(): if style.aliased is None: self.SavePreference(style.name, str(style.format)) --- 186,190 ---- self.SavePreference("Base Format Proportional", str(self.baseFormatProp)) self.SavePreference("Use Fixed", self.bUseFixed) ! for style in list(self.styles.values()): if style.aliased is None: self.SavePreference(style.name, str(style.format)) *************** *** 225,229 **** stylenum = self.styles[styleName].stylenum while start<end: ! self.style_buffer[start]=chr(stylenum) start = start+1 #self.scintilla.SCISetStyling(end - start + 1, stylenum) --- 225,229 ---- stylenum = self.styles[styleName].stylenum while start<end: ! self.style_buffer[start]=stylenum start = start+1 #self.scintilla.SCISetStyling(end - start + 1, stylenum) *************** *** 236,240 **** def ColorizeString(self, str, charStart, styleStart): ! raise RuntimeError, "You must override this method" def Colorize(self, start=0, end=-1): --- 236,240 ---- def ColorizeString(self, str, charStart, styleStart): ! raise RuntimeError("You must override this method") def Colorize(self, start=0, end=-1): *************** *** 248,252 **** # trace("Coloring", start, end, end-start, len(stringVal), styleStart, self.scintilla.SCIGetCharAt(start)) scintilla.SCIStartStyling(start, 31) ! self.style_buffer = array.array("c", chr(0)*len(stringVal)) self.ColorizeString(stringVal, styleStart) scintilla.SCISetStylingEx(self.style_buffer) --- 248,252 ---- # trace("Coloring", start, end, end-start, len(stringVal), styleStart, self.scintilla.SCIGetCharAt(start)) scintilla.SCIStartStyling(start, 31) ! self.style_buffer = array.array("b", (0,)*len(stringVal)) self.ColorizeString(stringVal, styleStart) scintilla.SCISetStylingEx(self.style_buffer) |
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17967/tools Modified Files: Tag: py3k TraceCollector.py browseProjects.py browser.py hierlist.py regedit.py regpy.py Log Message: Changes for Python 3 Index: TraceCollector.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools/TraceCollector.py,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** TraceCollector.py 9 Apr 2004 11:30:25 -0000 1.3 --- TraceCollector.py 29 Aug 2008 06:16:42 -0000 1.3.4.1 *************** *** 1,4 **** # win32traceutil like utility for Pythonwin ! import thread import win32trace, win32event, win32api from pywin.framework import winout --- 1,4 ---- # win32traceutil like utility for Pythonwin ! import _thread import win32trace, win32event, win32api from pywin.framework import winout *************** *** 25,35 **** finally: win32trace.TermRead() ! print "Thread dieing" class WindowOutput(winout.WindowOutput): def __init__(self, *args): ! apply(winout.WindowOutput.__init__, (self,)+args) self.hStopThread = win32event.CreateEvent(None, 0, 0, None) ! thread.start_new(CollectorThread, (self.hStopThread, self)) def _StopThread(self): win32event.SetEvent(self.hStopThread) --- 25,35 ---- finally: win32trace.TermRead() ! print("Thread dieing") class WindowOutput(winout.WindowOutput): def __init__(self, *args): ! winout.WindowOutput.__init__(*(self,)+args) self.hStopThread = win32event.CreateEvent(None, 0, 0, None) ! _thread.start_new(CollectorThread, (self.hStopThread, self)) def _StopThread(self): win32event.SetEvent(self.hStopThread) Index: regpy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools/regpy.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** regpy.py 1 Sep 1999 23:33:57 -0000 1.1 --- regpy.py 29 Aug 2008 06:16:42 -0000 1.1.4.1 *************** *** 1,5 **** # (sort-of) Registry editor import win32ui ! import dialog import win32con import commctrl --- 1,5 ---- # (sort-of) Registry editor import win32ui ! from pywin.mfc import dialog import win32con import commctrl *************** *** 46,50 **** self.HookMessage(self.OnActivate, win32con.WM_ACTIVATE) def OnActivate(self, msg): ! print "OnAcivate" def t(): --- 46,50 ---- self.HookMessage(self.OnActivate, win32con.WM_ACTIVATE) def OnActivate(self, msg): ! print("OnAcivate") def t(): *************** *** 52,53 **** --- 52,56 ---- ps.AddPage(RegistryPage()) ps.DoModal() + + if __name__=='__main__': + t() Index: hierlist.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools/hierlist.py,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** hierlist.py 1 Jul 2008 01:23:51 -0000 1.7 --- hierlist.py 29 Aug 2008 06:16:42 -0000 1.7.2.1 *************** *** 14,18 **** # to provide maximum flexibility (but with extra work). ! import win32ui import win32con --- 14,18 ---- # to provide maximum flexibility (but with extra work). ! import sys import win32ui import win32con *************** *** 49,53 **** class HierList(object.Object): def __init__(self, root, bitmapID = win32ui.IDB_HIERFOLDERS, listBoxId = None, bitmapMask = None): # used to create object. ! self.list = None self.bitmapID = bitmapID self.root = root --- 49,53 ---- class HierList(object.Object): def __init__(self, root, bitmapID = win32ui.IDB_HIERFOLDERS, listBoxId = None, bitmapMask = None): # used to create object. ! self.listControl = None self.bitmapID = bitmapID self.root = root *************** *** 56,67 **** self.filledItemHandlesMap = {} self.bitmapMask = bitmapMask def __getattr__(self, attr): ! l = self.__dict__['list'] ! if l is not None: ! return getattr(l, attr) def ItemFromHandle(self, handle): return self.itemHandleMap[handle] def SetStyle(self, newStyle): ! hwnd = self.list.GetSafeHwnd() style = win32api.GetWindowLong(hwnd, win32con.GWL_STYLE); win32api.SetWindowLong(hwnd, win32con.GWL_STYLE, (style | newStyle) ) --- 56,70 ---- self.filledItemHandlesMap = {} self.bitmapMask = bitmapMask + def __getattr__(self, attr): ! try: ! return getattr(self.listControl, attr) ! except AttributeError: ! return getattr(self, attr) ! def ItemFromHandle(self, handle): return self.itemHandleMap[handle] def SetStyle(self, newStyle): ! hwnd = self.listControl.GetSafeHwnd() style = win32api.GetWindowLong(hwnd, win32con.GWL_STYLE); win32api.SetWindowLong(hwnd, win32con.GWL_STYLE, (style | newStyle) ) *************** *** 77,90 **** if listControl is None: if self.listBoxId is None: self.listBoxId = win32ui.IDC_LIST1 ! self.list = parent.GetDlgItem(self.listBoxId) else: ! self.list = listControl lbid = listControl.GetDlgCtrlID() assert self.listBoxId is None or self.listBoxId == lbid, "An invalid listbox control ID has been specified (specified as %s, but exists as %s)" % (self.listBoxId, lbid) self.listBoxId = lbid ! self.list.SetImageList(self.imageList, commctrl.LVSIL_NORMAL) # self.list.AttachObject(self) ! parent.HookNotify(self.OnTreeItemExpanding, commctrl.TVN_ITEMEXPANDING) ! parent.HookNotify(self.OnTreeItemSelChanged, commctrl.TVN_SELCHANGED) parent.HookNotify(self.OnTreeItemDoubleClick, commctrl.NM_DBLCLK) self.notify_parent = parent --- 80,100 ---- if listControl is None: if self.listBoxId is None: self.listBoxId = win32ui.IDC_LIST1 ! self.listControl = parent.GetDlgItem(self.listBoxId) else: ! self.listControl = listControl lbid = listControl.GetDlgCtrlID() assert self.listBoxId is None or self.listBoxId == lbid, "An invalid listbox control ID has been specified (specified as %s, but exists as %s)" % (self.listBoxId, lbid) self.listBoxId = lbid ! self.listControl.SetImageList(self.imageList, commctrl.LVSIL_NORMAL) # self.list.AttachObject(self) ! ! ## ??? Need a better way to do this - either some way to detect if it's compiled with UNICODE ! ## defined, and/or a way to switch the constants based on UNICODE ??? ! if sys.version_info[0] < 3: ! parent.HookNotify(self.OnTreeItemExpanding, commctrl.TVN_ITEMEXPANDINGA) ! parent.HookNotify(self.OnTreeItemSelChanged, commctrl.TVN_SELCHANGEDA) ! else: ! parent.HookNotify(self.OnTreeItemExpanding, commctrl.TVN_ITEMEXPANDINGW) ! parent.HookNotify(self.OnTreeItemSelChanged, commctrl.TVN_SELCHANGEDW) parent.HookNotify(self.OnTreeItemDoubleClick, commctrl.NM_DBLCLK) self.notify_parent = parent *************** *** 94,98 **** def DeleteAllItems(self): ! self.list.DeleteAllItems() self.root = None self.itemHandleMap = {} --- 104,108 ---- def DeleteAllItems(self): ! self.listControl.DeleteAllItems() self.root = None self.itemHandleMap = {} *************** *** 102,123 **** # Dont want notifies as we kill the list. parent = self.notify_parent # GetParentFrame() ! parent.HookNotify(None, commctrl.TVN_ITEMEXPANDING) ! parent.HookNotify(None, commctrl.TVN_SELCHANGED) parent.HookNotify(None, commctrl.NM_DBLCLK) self.DeleteAllItems() ! self.list = None self.notify_parent = None # Break a possible cycle ! def OnTreeItemDoubleClick(self,(hwndFrom, idFrom, code), extra): if idFrom != self.listBoxId: return None ! item = self.itemHandleMap[self.list.GetSelectedItem()] self.TakeDefaultAction(item) return 1 ! def OnTreeItemExpanding(self,(hwndFrom, idFrom, code), extra): if idFrom != self.listBoxId: return None action, itemOld, itemNew, pt = extra itemHandle = itemNew[0] ! if not self.filledItemHandlesMap.has_key(itemHandle): item = self.itemHandleMap[itemHandle] self.AddSubList(itemHandle, self.GetSubList(item)) --- 112,140 ---- # Dont want notifies as we kill the list. parent = self.notify_parent # GetParentFrame() ! if sys.version_info[0] < 3: ! parent.HookNotify(None, commctrl.TVN_ITEMEXPANDINGA) ! parent.HookNotify(None, commctrl.TVN_SELCHANGEDA) ! else: ! parent.HookNotify(None, commctrl.TVN_ITEMEXPANDINGW) ! parent.HookNotify(None, commctrl.TVN_SELCHANGEDW) parent.HookNotify(None, commctrl.NM_DBLCLK) + self.DeleteAllItems() ! self.listControl = None self.notify_parent = None # Break a possible cycle ! def OnTreeItemDoubleClick(self, xxx_todo_changeme, extra): ! (hwndFrom, idFrom, code) = xxx_todo_changeme if idFrom != self.listBoxId: return None ! item = self.itemHandleMap[self.listControl.GetSelectedItem()] self.TakeDefaultAction(item) return 1 ! def OnTreeItemExpanding(self, xxx_todo_changeme1, extra): ! (hwndFrom, idFrom, code) = xxx_todo_changeme1 if idFrom != self.listBoxId: return None action, itemOld, itemNew, pt = extra itemHandle = itemNew[0] ! if itemHandle not in self.filledItemHandlesMap: item = self.itemHandleMap[itemHandle] self.AddSubList(itemHandle, self.GetSubList(item)) *************** *** 125,129 **** return 0 ! def OnTreeItemSelChanged(self,(hwndFrom, idFrom, code), extra): if idFrom != self.listBoxId: return None action, itemOld, itemNew, pt = extra --- 142,147 ---- return 0 ! def OnTreeItemSelChanged(self, xxx_todo_changeme2, extra): ! (hwndFrom, idFrom, code) = xxx_todo_changeme2 if idFrom != self.listBoxId: return None action, itemOld, itemNew, pt = extra *************** *** 146,152 **** bitmapSel = self.GetSelectedBitmapColumn(item) if bitmapSel is None: bitmapSel = bitmapCol ! if type(text) is unicode: ! text = text.encode("mbcs") ! hitem = self.list.InsertItem(parentHandle, hInsertAfter, (None, None, None, text, bitmapCol, bitmapSel, cItems, 0)) self.itemHandleMap[hitem] = item return hitem --- 164,170 ---- bitmapSel = self.GetSelectedBitmapColumn(item) if bitmapSel is None: bitmapSel = bitmapCol ! ## if type(text) is str: ! ## text = text.encode("mbcs") ! hitem = self.listControl.InsertItem(parentHandle, hInsertAfter, (None, None, None, text, bitmapCol, bitmapSel, cItems, 0)) self.itemHandleMap[hitem] = item return hitem *************** *** 155,162 **** ret = [] try: ! handle = self.list.GetChildItem(handle) while 1: ret.append(handle) ! handle = self.list.GetNextItem(handle, commctrl.TVGN_NEXT) except win32ui.error: # out of children --- 173,180 ---- ret = [] try: ! handle = self.listControl.GetChildItem(handle) while 1: ret.append(handle) ! handle = self.listControl.GetNextItem(handle, commctrl.TVGN_NEXT) except win32ui.error: # out of children *************** *** 170,179 **** # (ie, the selected item, expanded items, etc) if hparent is None: hparent = commctrl.TVI_ROOT ! if not self.filledItemHandlesMap.has_key(hparent): # This item has never been expanded, so no refresh can possibly be required. return root_item = self.itemHandleMap[hparent] old_handles = self._GetChildHandles(hparent) ! old_items = map( self.ItemFromHandle, old_handles ) new_items = self.GetSubList(root_item) # Now an inefficient technique for synching the items. --- 188,197 ---- # (ie, the selected item, expanded items, etc) if hparent is None: hparent = commctrl.TVI_ROOT ! if hparent not in self.filledItemHandlesMap: # This item has never been expanded, so no refresh can possibly be required. return root_item = self.itemHandleMap[hparent] old_handles = self._GetChildHandles(hparent) ! old_items = list(map( self.ItemFromHandle, old_handles )) new_items = self.GetSubList(root_item) # Now an inefficient technique for synching the items. *************** *** 198,202 **** # And recursively refresh iold hold = old_handles[iold] ! if self.filledItemHandlesMap.has_key(hold): self.Refresh(hold) else: --- 216,220 ---- # And recursively refresh iold hold = old_handles[iold] ! if hold in self.filledItemHandlesMap: self.Refresh(hold) else: *************** *** 207,213 **** for hchild in self._GetChildHandles(hdelete): del self.itemHandleMap[hchild] ! if self.filledItemHandlesMap.has_key(hchild): del self.filledItemHandlesMap[hchild] ! self.list.DeleteItem(hdelete) hAfter = old_handles[iold] # Fill any remaining new items: --- 225,231 ---- for hchild in self._GetChildHandles(hdelete): del self.itemHandleMap[hchild] ! if hchild in self.filledItemHandlesMap: del self.filledItemHandlesMap[hchild] ! self.listControl.DeleteItem(hdelete) hAfter = old_handles[iold] # Fill any remaining new items: *************** *** 216,220 **** self.AddItem(hparent, newItem) def AcceptRoot(self, root): ! self.list.DeleteAllItems() self.itemHandleMap = {commctrl.TVI_ROOT : root} self.filledItemHandlesMap = {commctrl.TVI_ROOT : root} --- 234,238 ---- self.AddItem(hparent, newItem) def AcceptRoot(self, root): ! self.listControl.DeleteAllItems() self.itemHandleMap = {commctrl.TVI_ROOT : root} self.filledItemHandlesMap = {commctrl.TVI_ROOT : root} *************** *** 234,238 **** def CheckChangedChildren(self): ! return self.list.CheckChangedChildren() def GetText(self,item): return GetItemText(item) --- 252,256 ---- def CheckChangedChildren(self): ! return self.listControl.CheckChangedChildren() def GetText(self,item): return GetItemText(item) Index: browser.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools/browser.py,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -C2 -d -r1.10 -r1.10.2.1 *** browser.py 9 Aug 2008 16:47:08 -0000 1.10 --- browser.py 29 Aug 2008 06:16:42 -0000 1.10.2.1 *************** *** 10,15 **** import win32ui from pywin.mfc import dialog ! ! import hierlist from types import * --- 10,14 ---- import win32ui from pywin.mfc import dialog ! from . import hierlist from types import * *************** *** 66,70 **** ret = [] try: ! for (key, ob) in self.myobject.__dict__.items(): if key not in special_names: ret.append(MakeHLI( ob, key ) ) --- 65,69 ---- ret = [] try: ! for (key, ob) in list(self.myobject.__dict__.items()): if key not in special_names: ret.append(MakeHLI( ob, key ) ) *************** *** 95,99 **** return 1 try: ! for key in self.myobject.__dict__.keys(): if key not in special_names: return 1 --- 94,98 ---- return 1 try: ! for key in list(self.myobject.__dict__.keys()): if key not in special_names: return 1 *************** *** 205,210 **** except AttributeError: pass ! ret.append( MakeHLI( self.myobject.func_code, "Code" )) ! ret.append( MakeHLI( self.myobject.func_globals, "Globals" )) self.InsertDocString(ret) return ret --- 204,209 ---- except AttributeError: pass ! ret.append( MakeHLI( self.myobject.__code__, "Code" )) ! ret.append( MakeHLI( self.myobject.__globals__, "Globals" )) self.InsertDocString(ret) return ret *************** *** 243,247 **** def GetSubList(self): ret = [] ! keys = self.myobject.keys() keys.sort() for key in keys: --- 242,246 ---- def GetSubList(self): ret = [] ! keys = list(self.myobject.keys()) keys.sort() for key in keys: *************** *** 256,274 **** return 0 ! TypeMap = { ClassType : HLIClass, FunctionType: HLIFunction, ! TupleType: HLITuple, ! DictType: HLIDict, ! ListType: HLIList, ModuleType: HLIModule, ! InstanceType : HLIInstance, CodeType : HLICode, BuiltinFunctionType : HLIBuiltinFunction, FrameType : HLIFrame, TracebackType : HLITraceback, ! StringType : HLIString, ! IntType: HLIPythonObject, ! LongType: HLIPythonObject, ! FloatType: HLIPythonObject, } try: --- 255,273 ---- return 0 ! TypeMap = { type : HLIClass, FunctionType: HLIFunction, ! tuple: HLITuple, ! dict: HLIDict, ! list: HLIList, ModuleType: HLIModule, ! ## InstanceType : HLIInstance, CodeType : HLICode, BuiltinFunctionType : HLIBuiltinFunction, FrameType : HLIFrame, TracebackType : HLITraceback, ! str : HLIString, ! int: HLIPythonObject, ! ## LongType: HLIPythonObject, ! float: HLIPythonObject, } try: *************** *** 365,369 **** root = MakeHLI (ob, 'root') if not root.IsExpandable(): ! raise TypeError, "Browse() argument must have __dict__ attribute, or be a Browser supported type" dlg = dynamic_browser (root) --- 364,368 ---- root = MakeHLI (ob, 'root') if not root.IsExpandable(): ! raise TypeError("Browse() argument must have __dict__ attribute, or be a Browser supported type") dlg = dynamic_browser (root) *************** *** 398,402 **** self.SetTitle("Browser: " + root.name) def OnOpenDocument (self, name): ! raise TypeError, "This template can not open files" return 0 --- 397,401 ---- self.SetTitle("Browser: " + root.name) def OnOpenDocument (self, name): ! raise TypeError("This template can not open files") return 0 *************** *** 423,427 **** root = MakeHLI(ob, repr(ob)) if not root.IsExpandable(): ! raise TypeError, "Browse() argument must have __dict__ attribute, or be a Browser supported type" template.OpenObject(root) --- 422,426 ---- root = MakeHLI(ob, repr(ob)) if not root.IsExpandable(): ! raise TypeError("Browse() argument must have __dict__ attribute, or be a Browser supported type") template.OpenObject(root) Index: regedit.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools/regedit.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** regedit.py 9 Oct 1999 23:43:46 -0000 1.2 --- regedit.py 29 Aug 2008 06:16:42 -0000 1.2.4.1 *************** *** 2,6 **** import win32api, win32ui, win32con, commctrl from pywin.mfc import window, docview, dialog ! import hierlist import regutil import string --- 2,6 ---- import win32api, win32ui, win32con, commctrl from pywin.mfc import window, docview, dialog ! from . import hierlist import regutil import string *************** *** 8,14 **** def SafeApply( fn, args, err_desc = "" ): try: ! apply(fn, args) return 1 ! except win32api.error, (rc, fn, msg): msg = "Error " + err_desc + "\r\n\r\n" + msg win32ui.MessageBox(msg) --- 8,15 ---- def SafeApply( fn, args, err_desc = "" ): try: ! fn(*args) return 1 ! except win32api.error as xxx_todo_changeme: ! (rc, fn, msg) = xxx_todo_changeme.args msg = "Error " + err_desc + "\r\n\r\n" + msg win32ui.MessageBox(msg) *************** *** 41,45 **** return 1 ! def OnItemDoubleClick(self,(hwndFrom, idFrom, code), extra): if idFrom==win32ui.AFX_IDW_PANE_FIRST: # Tree control --- 42,47 ---- return 1 ! def OnItemDoubleClick(self, xxx_todo_changeme1, extra): ! (hwndFrom, idFrom, code) = xxx_todo_changeme1 if idFrom==win32ui.AFX_IDW_PANE_FIRST: # Tree control *************** *** 210,214 **** try: newVal = self.GetItemsCurrentValue(item, keyVal) ! except TypeError, details: win32ui.MessageBox(details) return --- 212,216 ---- try: newVal = self.GetItemsCurrentValue(item, keyVal) ! except TypeError as details: win32ui.MessageBox(details) return *************** *** 218,222 **** try: self.SetItemsCurrentValue(item, keyVal, d.newvalue) ! except win32api.error, (rc, fn, desc): win32ui.MessageBox("Error setting value\r\n\n%s" % desc) self.UpdateForRegItem(item) --- 220,225 ---- try: self.SetItemsCurrentValue(item, keyVal, d.newvalue) ! except win32api.error as xxx_todo_changeme2: ! (rc, fn, desc) = xxx_todo_changeme2.args win32ui.MessageBox("Error setting value\r\n\n%s" % desc) self.UpdateForRegItem(item) *************** *** 227,231 **** val, type = win32api.RegQueryValueEx(hkey, valueName) if type != win32con.REG_SZ: ! raise TypeError, "Only strings can be edited" return val finally: --- 230,234 ---- val, type = win32api.RegQueryValueEx(hkey, valueName) if type != win32con.REG_SZ: ! raise TypeError("Only strings can be edited") return val finally: *************** *** 272,276 **** def OnOpenDocument (self, name): ! raise TypeError, "This template can not open files" return 0 --- 275,279 ---- def OnOpenDocument (self, name): ! raise TypeError("This template can not open files") return 0 Index: browseProjects.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/tools/browseProjects.py,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** browseProjects.py 9 Aug 2008 16:47:08 -0000 1.3 --- browseProjects.py 29 Aug 2008 06:16:42 -0000 1.3.2.1 *************** *** 57,61 **** for c in self.super: ret.append(HLICLBRClass(c, " (Parent class)")) ! for meth, lineno in self.methods.items(): ret.append(HLICLBRMethod(meth, self.file, lineno, " (method)")) return ret --- 57,61 ---- for c in self.super: ret.append(HLICLBRClass(c, " (Parent class)")) ! for meth, lineno in list(self.methods.items()): ret.append(HLICLBRMethod(meth, self.file, lineno, " (method)")) return ret *************** *** 104,108 **** if data: ret = [] ! for item in data.values(): if item.__class__ != pyclbr.Class: # ie, it is a pyclbr Function instance (only introduced post 1.5.2) ret.append(HLICLBRFunction( item, " (function)" ) ) --- 104,108 ---- if data: ret = [] ! for item in list(data.values()): if item.__class__ != pyclbr.Class: # ie, it is a pyclbr Function instance (only introduced post 1.5.2) ret.append(HLICLBRFunction( item, " (function)" ) ) *************** *** 166,170 **** ret = MakePathSubList(pathList[0]) else: ! ret = map( HLIDirectoryItem, pathList ) return ret --- 166,170 ---- ret = MakePathSubList(pathList[0]) else: ! ret = list(map( HLIDirectoryItem, pathList )) return ret *************** *** 227,231 **** root = HLIRoot() if not root.IsExpandable(): ! raise TypeError, "Browse() argument must have __dict__ attribute, or be a Browser supported type" dlg = dynamic_browser (root) --- 227,231 ---- root = HLIRoot() if not root.IsExpandable(): ! raise TypeError("Browse() argument must have __dict__ attribute, or be a Browser supported type") dlg = dynamic_browser (root) |
From: Roger U. <ru...@us...> - 2008-08-29 06:16:33
|
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 |
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17967/mfc Modified Files: Tag: py3k activex.py afxres.py dialog.py docview.py object.py thread.py window.py Log Message: Changes for Python 3 Index: window.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/window.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** window.py 5 Jan 2000 04:10:56 -0000 1.2 --- window.py 29 Aug 2008 06:16:42 -0000 1.2.4.1 *************** *** 1,4 **** ! # The MFCish window classes. ! import object import win32ui import win32con --- 1,3 ---- ! from . import object import win32ui import win32con Index: activex.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/activex.py,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** activex.py 18 Apr 2005 13:36:47 -0000 1.3 --- activex.py 29 Aug 2008 06:16:42 -0000 1.3.4.1 *************** *** 29,33 **** def HookOleEvents(self): dict = self._GetEventMap() ! for dispid, methodName in dict.items(): if hasattr(self, methodName): self._obj_.HookOleEvent( getattr(self, methodName), dispid ) --- 29,33 ---- def HookOleEvents(self): dict = self._GetEventMap() ! for dispid, methodName in list(dict.items()): if hasattr(self, methodName): self._obj_.HookOleEvent( getattr(self, methodName), dispid ) Index: dialog.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/dialog.py,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** dialog.py 27 Nov 1999 07:57:38 -0000 1.3 --- dialog.py 29 Aug 2008 06:16:42 -0000 1.3.4.1 *************** *** 7,11 **** import win32ui import win32con ! import window def dllFromDll(dllid): --- 7,11 ---- import win32ui import win32con ! from . import window def dllFromDll(dllid): *************** *** 19,23 **** dllid.GetFileName() except AttributeError: ! raise TypeError, "DLL parameter must be None, a filename or a dll object" return dllid --- 19,23 ---- dllid.GetFileName() except AttributeError: ! raise TypeError("DLL parameter must be None, a filename or a dll object") return dllid *************** *** 60,72 **** self._obj_.datalist.append(args) # Make a dialog object look like a dictionary for the DDX support ! def __nonzero__(self): return 1 def __len__(self): return len(self.data) def __getitem__(self, key): return self.data[key] def __setitem__(self, key, item): self._obj_.data[key] = item# self.UpdateData(0) ! def keys(self): return self.data.keys() ! def items(self): return self.data.items() ! def values(self): return self.data.values() ! def has_key(self, key): return self.data.has_key(key) class PrintDialog(Dialog): --- 60,72 ---- self._obj_.datalist.append(args) # Make a dialog object look like a dictionary for the DDX support ! def __bool__(self): return 1 def __len__(self): return len(self.data) def __getitem__(self, key): return self.data[key] def __setitem__(self, key, item): self._obj_.data[key] = item# self.UpdateData(0) ! def keys(self): return list(self.data.keys()) ! def items(self): return list(self.data.items()) ! def values(self): return list(self.data.values()) ! def has_key(self, key): return key in self.data class PrintDialog(Dialog): *************** *** 83,87 **** self.dll=dllFromDll(dllid) if type(dlgID)==type([]): # a template ! raise TypeError, "dlgID parameter must be an integer resource ID" dlg=win32ui.CreatePrintDialog(dlgID, printSetupOnly, flags, parent, --- 83,87 ---- self.dll=dllFromDll(dllid) if type(dlgID)==type([]): # a template ! raise TypeError("dlgID parameter must be an integer resource ID") dlg=win32ui.CreatePrintDialog(dlgID, printSetupOnly, flags, parent, *************** *** 233,237 **** dlg=DlgSimpleInput( prompt, defValue, title) ! if dlg.DoModal() <> win32con.IDOK: return None return dlg['result'] --- 233,237 ---- dlg=DlgSimpleInput( prompt, defValue, title) ! if dlg.DoModal() != win32con.IDOK: return None return dlg['result'] Index: afxres.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/afxres.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** afxres.py 10 Jan 2006 04:28:40 -0000 1.2 --- afxres.py 29 Aug 2008 06:16:42 -0000 1.2.4.1 *************** *** 54,58 **** AFX_IDW_DOCKBAR_BOTTOM = 0xE81E AFX_IDW_DOCKBAR_FLOAT = 0xE81F ! def AFX_CONTROLBAR_MASK(nIDC): return (1L << (nIDC - AFX_IDW_CONTROLBAR_FIRST)) AFX_IDW_PANE_FIRST = 0xE900 --- 54,58 ---- AFX_IDW_DOCKBAR_BOTTOM = 0xE81E AFX_IDW_DOCKBAR_FLOAT = 0xE81F ! def AFX_CONTROLBAR_MASK(nIDC): return (1 << (nIDC - AFX_IDW_CONTROLBAR_FIRST)) AFX_IDW_PANE_FIRST = 0xE900 Index: object.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/object.py,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** object.py 10 Jan 2006 04:37:14 -0000 1.3 --- object.py 29 Aug 2008 06:16:42 -0000 1.3.4.1 *************** *** 21,29 **** # we dont want this exception if attr[0]!= '_' and attr[-1] != '_': ! raise win32ui.error, "The MFC object has died." except KeyError: # No _obj_ at all - dont report MFC object died when there isnt one! pass ! raise AttributeError, attr def OnAttachedObjectDeath(self): --- 21,29 ---- # we dont want this exception if attr[0]!= '_' and attr[-1] != '_': ! raise win32ui.error("The MFC object has died.") except KeyError: # No _obj_ at all - dont report MFC object died when there isnt one! pass ! raise AttributeError(attr) def OnAttachedObjectDeath(self): *************** *** 31,35 **** self._obj_ = None def close(self): ! if self.__dict__.has_key('_obj_'): if self._obj_ is not None: self._obj_.AttachObject(None) --- 31,35 ---- self._obj_ = None def close(self): ! if '_obj_' in self.__dict__: if self._obj_ is not None: self._obj_.AttachObject(None) Index: docview.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/docview.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** docview.py 1 Sep 1999 23:33:52 -0000 1.1 --- docview.py 29 Aug 2008 06:16:42 -0000 1.1.4.1 *************** *** 2,7 **** import win32ui import win32con ! import object ! import window class View(window.Wnd): --- 2,7 ---- import win32ui import win32con ! from . import object ! from . import window class View(window.Wnd): Index: thread.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/thread.py,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** thread.py 6 May 2000 12:04:10 -0000 1.3 --- thread.py 29 Aug 2008 06:16:42 -0000 1.3.4.1 *************** *** 1,5 **** ! # Thread and application objects ! ! import object import win32ui --- 1,3 ---- ! from . import object import win32ui |
From: Roger U. <ru...@us...> - 2008-08-29 06:16:33
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17967/debugger Modified Files: Tag: py3k __init__.py configui.py dbgcon.py debugger.py fail.py Log Message: Changes for Python 3 Index: fail.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/fail.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** fail.py 1 Sep 1999 23:33:41 -0000 1.1 --- fail.py 29 Aug 2008 06:16:41 -0000 1.1.4.1 *************** *** 39,43 **** d=1 e(d) ! raise ValueError, "Hi" def e(arg): --- 39,43 ---- d=1 e(d) ! raise ValueError("Hi") def e(arg): Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/__init__.py,v retrieving revision 1.5 retrieving revision 1.5.4.1 diff -C2 -d -r1.5 -r1.5.4.1 *** __init__.py 1 Mar 2003 00:25:28 -0000 1.5 --- __init__.py 29 Aug 2008 06:16:41 -0000 1.5.4.1 *************** *** 13,22 **** if isInprocApp: # MAY Need it - may already have one ! need = sys.modules.has_key("pywin.debugger.dbgpyapp")==0 else: need = 0 if need: import pywin.framework.app ! import dbgpyapp pywin.framework.app.CreateDefaultGUI(dbgpyapp.DebuggerPythonApp) --- 13,22 ---- if isInprocApp: # MAY Need it - may already have one ! need = ("pywin.debugger.dbgpyapp" in sys.modules)==0 else: need = 0 if need: import pywin.framework.app ! from . import dbgpyapp pywin.framework.app.CreateDefaultGUI(dbgpyapp.DebuggerPythonApp) *************** *** 34,38 **** if currentDebugger is None: _CheckNeedGUI() ! import debugger currentDebugger = debugger.Debugger() return currentDebugger --- 34,38 ---- if currentDebugger is None: _CheckNeedGUI() ! from . import debugger currentDebugger = debugger.Debugger() return currentDebugger *************** *** 48,52 **** return rc except: ! print "Could not create the debugger!" import traceback traceback.print_exc() --- 48,52 ---- return rc except: ! print("Could not create the debugger!") import traceback traceback.print_exc() *************** *** 64,68 **** def runcall(*args): ! return apply(_GetCurrentDebugger().runcall, args) def set_trace(): --- 64,68 ---- def runcall(*args): ! return _GetCurrentDebugger().runcall(*args) def set_trace(): *************** *** 92,97 **** t = sys.last_traceback except AttributeError: ! print "No traceback can be found from which to perform post-mortem debugging!" ! print "No debugging can continue" return p = _GetCurrentDebugger() --- 92,97 ---- t = sys.last_traceback except AttributeError: ! print("No traceback can be found from which to perform post-mortem debugging!") ! print("No debugging can continue") return p = _GetCurrentDebugger() *************** *** 100,104 **** sys.settrace(None) p.reset() ! while t.tb_next <> None: t = t.tb_next p.bAtPostMortem = 1 p.prep_run(None) --- 100,104 ---- sys.settrace(None) p.reset() ! while t.tb_next != None: t = t.tb_next p.bAtPostMortem = 1 p.prep_run(None) Index: debugger.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/debugger.py,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -C2 -d -r1.17 -r1.17.2.1 *** debugger.py 9 Aug 2008 16:47:07 -0000 1.17 --- debugger.py 29 Aug 2008 06:16:41 -0000 1.17.2.1 *************** *** 29,33 **** #import win32traceutil ! from dbgcon import * error = "pywin.debugger.error" --- 29,33 ---- #import win32traceutil ! from .dbgcon import * error = "pywin.debugger.error" *************** *** 55,59 **** if not name or name == '?' : # See if locals has a '__name__' (ie, a module) ! if self.myobject.f_locals.has_key('__name__'): name = self.myobject.f_locals['__name__'] + " module" else: --- 55,59 ---- if not name or name == '?' : # See if locals has a '__name__' (ie, a module) ! if '__name__' in self.myobject.f_locals: name = self.myobject.f_locals['__name__'] + " module" else: *************** *** 237,241 **** itemDetails = (commctrl.LVCFMT_LEFT, width, title, 0) list.InsertColumn(col, itemDetails) ! parent.HookNotify( self.OnListEndLabelEdit, commctrl.LVN_ENDLABELEDIT) parent.HookNotify(self.OnItemRightClick, commctrl.NM_RCLICK) parent.HookNotify(self.OnItemDoubleClick, commctrl.NM_DBLCLK) --- 237,241 ---- itemDetails = (commctrl.LVCFMT_LEFT, width, title, 0) list.InsertColumn(col, itemDetails) ! parent.HookNotify( self.OnListEndLabelEdit, commctrl.LVN_ENDLABELEDITW) parent.HookNotify(self.OnItemRightClick, commctrl.NM_RCLICK) parent.HookNotify(self.OnItemDoubleClick, commctrl.NM_DBLCLK) *************** *** 295,299 **** def SaveState(self): ! pass def OnListEndLabelEdit(self, std, extra): --- 295,304 ---- def SaveState(self): ! items = [] ! for i in range(self.GetItemCount()): ! items.append(self.GetItemText(i,0)) ! items.append(self.GetItemText(i,1)) ! win32ui.WriteProfileVal("Debugger Windows\\" + self.title, "BreakpointList", "\t".join(items)) ! return 1 def OnListEndLabelEdit(self, std, extra): *************** *** 305,309 **** from bdb import Breakpoint ! for bplist in Breakpoint.bplist.values(): for bp in bplist: if id(bp)==item_id: --- 310,314 ---- from bdb import Breakpoint ! for bplist in list(Breakpoint.bplist.values()): for bp in bplist: if id(bp)==item_id: *************** *** 319,323 **** item_id = self.GetItem(num)[6] from bdb import Breakpoint ! for bplist in Breakpoint.bplist.values(): for bp in bplist: if id(bp)==item_id: --- 324,328 ---- item_id = self.GetItem(num)[6] from bdb import Breakpoint ! for bplist in list(Breakpoint.bplist.values()): for bp in bplist: if id(bp)==item_id: *************** *** 329,343 **** def RespondDebuggerData(self): ! list = self ! list.DeleteAllItems() index = -1 from bdb import Breakpoint ! for bplist in Breakpoint.bplist.values(): for bp in bplist: baseName = os.path.split(bp.file)[1] cond = bp.cond item = index+1, 0, 0, 0, str(cond), 0, id(bp) ! index = list.InsertItem(item) ! list.SetItemText(index, 1, "%s: %s" % (baseName, bp.line)) class DebuggerWatchWindow(DebuggerListViewWindow): --- 334,348 ---- def RespondDebuggerData(self): ! l = self ! l.DeleteAllItems() index = -1 from bdb import Breakpoint ! for bplist in list(Breakpoint.bplist.values()): for bp in bplist: baseName = os.path.split(bp.file)[1] cond = bp.cond item = index+1, 0, 0, 0, str(cond), 0, id(bp) ! index = l.InsertItem(item) ! l.SetItemText(index, 1, "%s: %s" % (baseName, bp.line)) class DebuggerWatchWindow(DebuggerListViewWindow): *************** *** 528,532 **** return self.options[option] except KeyError: ! raise error, "Option %s is not a valid option" % option def prep_run(self, cmd): --- 533,537 ---- return self.options[option] except KeyError: ! raise error("Option %s is not a valid option" % option) def prep_run(self, cmd): *************** *** 572,581 **** self.interaction(frame, None) ! def user_exception(self, frame, (exc_type, exc_value, exc_traceback)): # This function is called if an exception occurs, # but only if we are to stop at or just below this level if self.get_option(OPT_STOP_EXCEPTIONS): frame.f_locals['__exception__'] = exc_type, exc_value ! print "Unhandled exception while debugging..." traceback.print_exception(exc_type, exc_value, exc_traceback) self.interaction(frame, exc_traceback) --- 577,588 ---- self.interaction(frame, None) ! def user_exception(self, frame, exc_info): ! print ('user exception callled !!!!!!!') # This function is called if an exception occurs, # but only if we are to stop at or just below this level + (exc_type, exc_value, exc_traceback) = exc_info if self.get_option(OPT_STOP_EXCEPTIONS): frame.f_locals['__exception__'] = exc_type, exc_value ! print("Unhandled exception while debugging...") traceback.print_exception(exc_type, exc_value, exc_traceback) self.interaction(frame, exc_traceback) *************** *** 587,597 **** --- 594,607 ---- def stop_here(self, frame): if self.isInitialBreakpoint: + print ('skip IsInitialBreakpoint') self.isInitialBreakpoint = 0 self.set_continue() return 0 if frame is self.botframe and self.skipBotFrame == SKIP_RUN: + print ('skip SKIP_RUN') self.set_continue() return 0 if frame is self.botframe and self.skipBotFrame == SKIP_STEP: + print ('skip SKIP_STEP') self.set_step() return 0 *************** *** 599,604 **** def run(self, cmd,globals=None, locals=None, start_stepping = 1): ! if type(cmd) not in [types.StringType, types.CodeType]: ! raise TypeError, "Only strings can be run" self.last_cmd_debugged = cmd if start_stepping: --- 609,614 ---- def run(self, cmd,globals=None, locals=None, start_stepping = 1): ! if type(cmd) not in [bytes, types.CodeType]: ! raise TypeError("Only strings can be run") self.last_cmd_debugged = cmd if start_stepping: *************** *** 615,619 **** self.prep_run(cmd) sys.settrace(self.trace_dispatch) ! if type(cmd) <> types.CodeType: cmd = cmd+'\n' try: --- 625,629 ---- self.prep_run(cmd) sys.settrace(self.trace_dispatch) ! if type(cmd) != types.CodeType: cmd = cmd+'\n' try: *************** *** 622,626 **** else: self.skipBotFrame = SKIP_RUN if sys.version_info > (2,2): ! exec cmd in globals, locals else: _doexec(cmd, globals, locals) --- 632,636 ---- else: self.skipBotFrame = SKIP_RUN if sys.version_info > (2,2): ! exec(cmd, globals, locals) else: _doexec(cmd, globals, locals) *************** *** 647,651 **** try: try: ! exec what in globs, locs except bdb.BdbQuit: pass --- 657,661 ---- try: try: ! exec(what, globs, locs) except bdb.BdbQuit: pass *************** *** 684,690 **** else: fname = "??" ! print `name`, fname, frame.f_lineno, frame else: ! print `name`, "None" def set_trace(self): --- 694,700 ---- else: fname = "??" ! print(repr(name), fname, frame.f_lineno, frame) else: ! print(repr(name), "None") def set_trace(self): *************** *** 700,704 **** # '_debugger_stop_frame_', and we dont go past it # (everything above this is Pythonwin framework code) ! if frame.f_locals.has_key("_debugger_stop_frame_"): self.userbotframe = frame break --- 710,714 ---- # '_debugger_stop_frame_', and we dont go past it # (everything above this is Pythonwin framework code) ! if "_debugger_stop_frame_" in frame.f_locals: self.userbotframe = frame break *************** *** 747,754 **** title = " - break" else: ! raise error, "Invalid debugger state passed!" win32ui.GetMainFrame().SetWindowText(win32ui.LoadString(win32ui.IDR_MAINFRAME) + title) if self.debuggerState == DBGSTATE_QUITTING and state != DBGSTATE_NOT_DEBUGGING: ! print "Ignoring state change cos Im trying to stop!", state return self.debuggerState = state --- 757,764 ---- title = " - break" else: ! raise error("Invalid debugger state passed!") win32ui.GetMainFrame().SetWindowText(win32ui.LoadString(win32ui.IDR_MAINFRAME) + title) if self.debuggerState == DBGSTATE_QUITTING and state != DBGSTATE_NOT_DEBUGGING: ! print("Ignoring state change cos Im trying to stop!", state) return self.debuggerState = state *************** *** 815,819 **** self.GUIAboutToInteract() if self.pumping: ! print "!!! Already pumping - outa here" return self.pumping = 1 --- 825,829 ---- self.GUIAboutToInteract() if self.pumping: ! print("!!! Already pumping - outa here") return self.pumping = 1 *************** *** 950,956 **** import linecache line = linecache.getline(filename, lineno) ! print "%s(%d): %s" % (os.path.basename(filename), lineno, line[:-1].expandtabs(4)) return 0 def _doexec(cmd, globals, locals): ! exec cmd in globals, locals --- 960,966 ---- import linecache line = linecache.getline(filename, lineno) ! print("%s(%d): %s" % (os.path.basename(filename), lineno, line[:-1].expandtabs(4))) return 0 def _doexec(cmd, globals, locals): ! exec(cmd, globals, locals) Index: configui.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/configui.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** configui.py 1 Sep 1999 23:33:41 -0000 1.1 --- configui.py 29 Aug 2008 06:16:41 -0000 1.1.4.1 *************** *** 1,3 **** ! from dbgcon import * from pywin.mfc import dialog --- 1,3 ---- ! from .dbgcon import * from pywin.mfc import dialog *************** *** 17,22 **** self.UpdateData() dirty = 0 ! for key, val in self.items(): ! if self.options.has_key(key): if self.options[key] != val: self.options[key] = val --- 17,22 ---- self.UpdateData() dirty = 0 ! for key, val in list(self.items()): ! if key in self.options: if self.options[key] != val: self.options[key] = val Index: dbgcon.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/dbgcon.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** dbgcon.py 1 Sep 1999 23:33:41 -0000 1.1 --- dbgcon.py 29 Aug 2008 06:16:41 -0000 1.1.4.1 *************** *** 25,28 **** def SaveDebuggerOptions(opts): ! for key, val in opts.items(): win32ui.WriteProfileVal("Debugger Options", key, val) --- 25,28 ---- def SaveDebuggerOptions(opts): ! for key, val in list(opts.items()): win32ui.WriteProfileVal("Debugger Options", key, val) |
From: Roger U. <ru...@us...> - 2008-08-29 06:16:33
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17967/idle Modified Files: Tag: py3k AutoIndent.py CallTips.py FormatParagraph.py PyParse.py Log Message: Changes for Python 3 Index: FormatParagraph.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/FormatParagraph.py,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** FormatParagraph.py 9 Aug 2008 16:47:07 -0000 1.2 --- FormatParagraph.py 29 Aug 2008 06:16:42 -0000 1.2.2.1 *************** *** 52,56 **** # Reformat the comment lines - convert to text sans header. lines = data.split("\n") ! lines = map(lambda st, l=len(comment_header): st[l:], lines) data = "\n".join(lines) # Reformat to 70 chars or a 20 char width, whichever is greater. --- 52,56 ---- # Reformat the comment lines - convert to text sans header. lines = data.split("\n") ! lines = list(map(lambda st, l=len(comment_header): st[l:], lines)) data = "\n".join(lines) # Reformat to 70 chars or a 20 char width, whichever is greater. Index: CallTips.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/CallTips.py,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** CallTips.py 9 Aug 2008 16:47:07 -0000 1.3 --- CallTips.py 29 Aug 2008 06:16:42 -0000 1.3.2.1 *************** *** 101,105 **** # constructor (ie, __init__() ) or None if we can't find one. try: ! return class_ob.__init__.im_func except AttributeError: for base in class_ob.__bases__: --- 101,105 ---- # constructor (ie, __init__() ) or None if we can't find one. try: ! return class_ob.__init__.__func__ except AttributeError: for base in class_ob.__bases__: *************** *** 113,117 **** if ob is not None: argOffset = 0 ! if type(ob)==types.ClassType: # Look for the highest __init__ in the class chain. fob = _find_constructor(ob) --- 113,117 ---- if ob is not None: argOffset = 0 ! if type(ob)==type: # Look for the highest __init__ in the class chain. fob = _find_constructor(ob) *************** *** 123,127 **** # bit of a hack for methods - turn it into a function # but we drop the "self" param. ! fob = ob.im_func argOffset = 1 else: --- 123,127 ---- # bit of a hack for methods - turn it into a function # but we drop the "self" param. ! fob = ob.__func__ argOffset = 1 else: *************** *** 130,141 **** if type(fob) in [types.FunctionType, types.LambdaType]: try: ! realArgs = fob.func_code.co_varnames[argOffset:fob.func_code.co_argcount] ! defaults = fob.func_defaults or [] ! defaults = list(map(lambda name: "=%s" % name, defaults)) defaults = [""] * (len(realArgs)-len(defaults)) + defaults ! items = map(lambda arg, dflt: arg+dflt, realArgs, defaults) ! if fob.func_code.co_flags & 0x4: items.append("...") ! if fob.func_code.co_flags & 0x8: items.append("***") argText = ", ".join(items) --- 130,141 ---- if type(fob) in [types.FunctionType, types.LambdaType]: try: ! realArgs = fob.__code__.co_varnames[argOffset:fob.__code__.co_argcount] ! defaults = fob.__defaults__ or [] ! defaults = list(["=%s" % name for name in defaults]) defaults = [""] * (len(realArgs)-len(defaults)) + defaults ! items = list(map(lambda arg, dflt: arg+dflt, realArgs, defaults)) ! if fob.__code__.co_flags & 0x4: items.append("...") ! if fob.__code__.co_flags & 0x8: items.append("***") argText = ", ".join(items) *************** *** 188,193 **** if get_arg_text(t) != expected: failed.append(t) ! print "%s - expected %s, but got %s" % (t, `expected`, `get_arg_text(t)`) ! print "%d of %d tests failed" % (len(failed), len(tests)) tc = TC() --- 188,193 ---- if get_arg_text(t) != expected: failed.append(t) ! print("%s - expected %s, but got %s" % (t, repr(expected), repr(get_arg_text(t)))) ! print("%d of %d tests failed" % (len(failed), len(tests))) tc = TC() Index: AutoIndent.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/AutoIndent.py,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** AutoIndent.py 9 Aug 2008 16:47:07 -0000 1.3 --- AutoIndent.py 29 Aug 2008 06:16:42 -0000 1.3.2.1 *************** *** 1,39 **** ! #from Tkinter import TclError ! #import tkMessageBox ! #import tkSimpleDialog ! ! ###$ event <<newline-and-indent>> ! ###$ win <Key-Return> ! ###$ win <KP_Enter> ! ###$ unix <Key-Return> ! ###$ unix <KP_Enter> ! ! ###$ event <<indent-region>> ! ###$ win <Control-bracketright> ! ###$ unix <Alt-bracketright> ! ###$ unix <Control-bracketright> ! ! ###$ event <<dedent-region>> ! ###$ win <Control-bracketleft> ! ###$ unix <Alt-bracketleft> ! ###$ unix <Control-bracketleft> ! ! ###$ event <<comment-region>> ! ###$ win <Alt-Key-3> ! ###$ unix <Alt-Key-3> ! ! ###$ event <<uncomment-region>> ! ###$ win <Alt-Key-4> ! ###$ unix <Alt-Key-4> ! ! ###$ event <<tabify-region>> ! ###$ win <Alt-Key-5> ! ###$ unix <Alt-Key-5> ! ! ###$ event <<untabify-region>> ! ###$ win <Alt-Key-6> ! ###$ unix <Alt-Key-6> ! ! import PyParse class AutoIndent: --- 1,4 ---- ! import string ! from . import PyParse class AutoIndent: *************** *** 117,121 **** def config(self, **options): ! for key, value in options.items(): if key == 'usetabs': self.usetabs = value --- 82,86 ---- def config(self, **options): ! for key, value in list(options.items()): if key == 'usetabs': self.usetabs = value *************** *** 127,131 **** self.context_use_ps1 = value else: ! raise KeyError, "bad option name: %s" % `key` # If ispythonsource and guess are true, guess a good value for --- 92,96 ---- self.context_use_ps1 = value else: ! raise KeyError("bad option name: %s" % repr(key)) # If ispythonsource and guess are true, guess a good value for *************** *** 137,141 **** def set_indentation_params(self, ispythonsource, guess=1): if guess and ispythonsource: ! i = self.guess_indent() if 2 <= i <= 8: self.indentwidth = i --- 102,106 ---- def set_indentation_params(self, ispythonsource, guess=1): if guess and ispythonsource: ! i = 4 ## self.guess_indent() if 2 <= i <= 8: self.indentwidth = i *************** *** 255,259 **** for context in self.num_context_lines: startat = max(lno - context, 1) ! startatindex = `startat` + ".0" rawtext = text.get(startatindex, "insert") y.set_str(rawtext) --- 220,224 ---- for context in self.num_context_lines: startat = max(lno - context, 1) ! startatindex = repr(startat) + ".0" rawtext = text.get(startatindex, "insert") y.set_str(rawtext) *************** *** 287,291 **** self.reindent_to(y.compute_backslash_indent()) else: ! assert 0, "bogus continuation type " + `c` return "break" --- 252,256 ---- self.reindent_to(y.compute_backslash_indent()) else: ! assert 0, "bogus continuation type " + repr(c) return "break" *************** *** 493,497 **** elif ch == '\t': raw = raw + 1 ! effective = (effective / tabwidth + 1) * tabwidth else: break --- 458,462 ---- elif ch == '\t': raw = raw + 1 ! effective = (effective // tabwidth + 1) * tabwidth else: break *************** *** 519,545 **** return "" i = self.i = self.i + 1 ! mark = `i` + ".0" if self.text.compare(mark, ">=", "end"): return "" return self.text.get(mark, mark + " lineend+1c") - def tokeneater(self, type, token, start, end, line, - INDENT=_tokenize.INDENT, - NAME=_tokenize.NAME, - OPENERS=('class', 'def', 'for', 'if', 'try', 'while')): - if self.finished: - pass - elif type == NAME and token in OPENERS: - self.blkopenline = line - elif type == INDENT and self.blkopenline: - self.indentedline = line - self.finished = 1 - def run(self): save_tabsize = _tokenize.tabsize _tokenize.tabsize = self.tabwidth try: try: ! _tokenize.tokenize(self.readline, self.tokeneater) except (_tokenize.TokenError, IndentationError): # since we cut off the tokenizer early, we can trigger --- 484,505 ---- return "" i = self.i = self.i + 1 ! mark = repr(i) + ".0" if self.text.compare(mark, ">=", "end"): return "" return self.text.get(mark, mark + " lineend+1c") def run(self): + OPENERS=('class', 'def', 'for', 'if', 'try', 'while') save_tabsize = _tokenize.tabsize _tokenize.tabsize = self.tabwidth try: try: ! for (typ, token, start, end, line) in _tokenize.tokenize(self.readline): ! if typ == NAME and token in OPENERS: ! self.blkopenline = line ! elif type == INDENT and self.blkopenline: ! self.indentedline = line ! break ! except (_tokenize.TokenError, IndentationError): # since we cut off the tokenizer early, we can trigger Index: PyParse.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/PyParse.py,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** PyParse.py 9 Aug 2008 16:47:07 -0000 1.5 --- PyParse.py 29 Aug 2008 06:16:42 -0000 1.5.2.1 *************** *** 3,13 **** import sys - try: - from types import UnicodeType - except ImportError: - from pywintypes import UnicodeType - # Reason last stmt is continued (or C_NONE if it's not). ! C_NONE, C_BACKSLASH, C_STRING, C_BRACKET = range(4) if 0: # for throwaway debugging output --- 3,8 ---- import sys # Reason last stmt is continued (or C_NONE if it's not). ! C_NONE, C_BACKSLASH, C_STRING, C_BRACKET = list(range(4)) if 0: # for throwaway debugging output *************** *** 119,135 **** def set_str(self, str): assert len(str) == 0 or str[-1] == '\n', "Oops - have str %r" % (str,) ! if type(str) == UnicodeType: ! # The parse functions have no idea what to do with Unicode, so ! # replace all Unicode characters with "x". This is "safe" ! # so long as the only characters germane to parsing the structure ! # of Python are 7-bit ASCII. It's *necessary* because Unicode ! # strings don't have a .translate() method that supports ! # deletechars. ! uniphooey = str ! str = [] ! push = str.append ! for raw in map(ord, uniphooey): ! push(raw < 127 and chr(raw) or "x") ! str = "".join(str) self.str = str self.study_level = 0 --- 114,130 ---- def set_str(self, str): assert len(str) == 0 or str[-1] == '\n', "Oops - have str %r" % (str,) ! ## if type(str) == UnicodeType: ! ## # The parse functions have no idea what to do with Unicode, so ! ## # replace all Unicode characters with "x". This is "safe" ! ## # so long as the only characters germane to parsing the structure ! ## # of Python are 7-bit ASCII. It's *necessary* because Unicode ! ## # strings don't have a .translate() method that supports ! ## # deletechars. ! ## uniphooey = str ! ## str = [] ! ## push = str.append ! ## for raw in map(ord, uniphooey): ! ## push(raw < 127 and chr(raw) or "x") ! ## str = "".join(str) self.str = str self.study_level = 0 |
From: Roger U. <ru...@us...> - 2008-08-29 06:16:32
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17967/dialogs Modified Files: Tag: py3k ideoptions.py list.py login.py status.py Log Message: Changes for Python 3 Index: list.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/dialogs/list.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** list.py 1 Sep 1999 23:33:43 -0000 1.1 --- list.py 29 Aug 2008 06:16:41 -0000 1.1.4.1 *************** *** 45,51 **** def OnListItemChange(self,std, extra): (hwndFrom, idFrom, code), (itemNotify, sub, newState, oldState, change, point, lparam) = std, extra ! oldSel = (oldState & commctrl.LVIS_SELECTED)<>0 ! newSel = (newState & commctrl.LVIS_SELECTED)<>0 ! if oldSel <> newSel: try: self.selecteditem = itemNotify --- 45,51 ---- def OnListItemChange(self,std, extra): (hwndFrom, idFrom, code), (itemNotify, sub, newState, oldState, change, point, lparam) = std, extra ! oldSel = (oldState & commctrl.LVIS_SELECTED)!=0 ! newSel = (newState & commctrl.LVIS_SELECTED)!=0 ! if oldSel != newSel: try: self.selecteditem = itemNotify *************** *** 117,121 **** def test(): # print SelectFromList('Single list', [1,2,3]) ! print SelectFromLists('Multi-List', [ ('1',1, 'a'), ('2',2, 'b'), ('3',3, 'c' )], ['Col 1', 'Col 2']) if __name__=='__main__': --- 117,121 ---- def test(): # print SelectFromList('Single list', [1,2,3]) ! print(SelectFromLists('Multi-List', [ ('1',1, 'a'), ('2',2, 'b'), ('3',3, 'c' )], ['Col 1', 'Col 2'])) if __name__=='__main__': Index: ideoptions.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/dialogs/ideoptions.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** ideoptions.py 11 Mar 2000 00:57:53 -0000 1.2 --- ideoptions.py 29 Aug 2008 06:16:41 -0000 1.2.4.1 *************** *** 88,92 **** def ChangeFormat(self, fmtAttribute, fmt): dlg = win32ui.CreateFontDialog(fmt) ! if dlg.DoModal() <> win32con.IDOK: return None return dlg.GetCharFormat() --- 88,92 ---- def ChangeFormat(self, fmtAttribute, fmt): dlg = win32ui.CreateFontDialog(fmt) ! if dlg.DoModal() != win32con.IDOK: return None return dlg.GetCharFormat() Index: login.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/dialogs/login.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** login.py 1 Sep 1999 23:33:43 -0000 1.1 --- login.py 29 Aug 2008 06:16:41 -0000 1.1.4.1 *************** *** 108,121 **** userid, password = GetLogin(title, def_user) if userid == password == None: ! print "User pressed Cancel" else: ! print "User ID: ", userid ! print "Password:", password newpassword = GetPassword("Reenter just for fun", password) if newpassword is None: ! print "User cancelled" else: what = "" if newpassword != password: what = "not " ! print "The passwords did %smatch" % (what) --- 108,121 ---- userid, password = GetLogin(title, def_user) if userid == password == None: ! print("User pressed Cancel") else: ! print("User ID: ", userid) ! print("Password:", password) newpassword = GetPassword("Reenter just for fun", password) if newpassword is None: ! print("User cancelled") else: what = "" if newpassword != password: what = "not " ! print("The passwords did %smatch" % (what)) Index: status.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/dialogs/status.py,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** status.py 5 Mar 2005 03:17:22 -0000 1.3 --- status.py 29 Aug 2008 06:16:41 -0000 1.3.4.1 *************** *** 153,157 **** self._Send(MYWM_SET) ! class ProgressThread(thread.WinThread): def __init__(self, title, msg = "", maxticks = 100, tickincr = 1): self.title = title --- 153,157 ---- self._Send(MYWM_SET) ! class ProgressThread(_thread.WinThread): def __init__(self, title, msg = "", maxticks = 100, tickincr = 1): self.title = title *************** *** 160,164 **** self.tickincr = tickincr self.dialog = None ! thread.WinThread.__init__(self) self.createdEvent = threading.Event() --- 160,164 ---- self.tickincr = tickincr self.dialog = None ! _thread.WinThread.__init__(self) self.createdEvent = threading.Event() *************** *** 171,175 **** pass self.createdEvent.set() ! return thread.WinThread.InitInstance(self) def ExitInstance(self): --- 171,175 ---- pass self.createdEvent.set() ! return _thread.WinThread.InitInstance(self) def ExitInstance(self): |
From: Roger U. <ru...@us...> - 2008-08-29 06:16:32
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/docking In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17967/docking Modified Files: Tag: py3k DockingBar.py Log Message: Changes for Python 3 Index: DockingBar.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/docking/DockingBar.py,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** DockingBar.py 26 Feb 2008 13:11:32 -0000 1.6 --- DockingBar.py 29 Aug 2008 06:16:41 -0000 1.6.2.1 *************** *** 17,26 **** width = rect[2]-rect[0] height = rect[3]-rect[1] ! return rect[0] + width/2, rect[1] + height/2 ! def OffsetRect(rect, (x, y) ): return rect[0]+x, rect[1]+y, rect[2]+x, rect[3]+y ! def DeflateRect(rect, (x,y) ): return rect[0]+x, rect[1]+y, rect[2]-x, rect[3]-y --- 17,28 ---- width = rect[2]-rect[0] height = rect[3]-rect[1] ! return rect[0] + width//2, rect[1] + height//2 ! def OffsetRect(rect, xxx_todo_changeme ): ! (x, y) = xxx_todo_changeme return rect[0]+x, rect[1]+y, rect[2]+x, rect[3]+y ! def DeflateRect(rect, xxx_todo_changeme1 ): ! (x,y) = xxx_todo_changeme1 return rect[0]+x, rect[1]+y, rect[2]-x, rect[3]-y *************** *** 70,74 **** # Create the child dialog ! self.dialog = apply(childCreator, (self,) + childCreatorArgs) # use the dialog dimensions as default base dimensions --- 72,76 ---- # Create the child dialog ! self.dialog = childCreator(*(self,) + childCreatorArgs) # use the dialog dimensions as default base dimensions *************** *** 292,296 **** # def OnBarStyleChange(self, old, new): ! def OnNcCalcSize(self, bCalcValid, (rc0, rc1, rc2, pos)): self.rectBorder = self.GetWindowRect() self.rectBorder = OffsetRect( self.rectBorder, (-self.rectBorder[0], -self.rectBorder[1]) ) --- 294,299 ---- # def OnBarStyleChange(self, old, new): ! def OnNcCalcSize(self, bCalcValid, xxx_todo_changeme2): ! (rc0, rc1, rc2, pos) = xxx_todo_changeme2 self.rectBorder = self.GetWindowRect() self.rectBorder = OffsetRect( self.rectBorder, (-self.rectBorder[0], -self.rectBorder[1]) ) |
From: Roger U. <ru...@us...> - 2008-08-29 06:15:58
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17560/Demos Modified Files: Tag: py3k cmdserver.py demoutils.py dibdemo.py dlgtest.py dyndlg.py fontdemo.py guidemo.py hiertest.py menutest.py objdoc.py openGLDemo.py sliderdemo.py splittst.py threadedgui.py toolbar.py Log Message: Changes for Python 3 Index: dlgtest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/dlgtest.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** dlgtest.py 1 Sep 1999 23:33:35 -0000 1.1 --- dlgtest.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 *************** *** 22,25 **** --- 22,26 ---- def __init__(self, modal=1): dialog.Dialog.__init__(self, IDD_SET_TABSTOPS) + self.counter=0 if modal: *************** *** 27,31 **** else: self.CreateWindow() ! def OnInitDialog(self): # Set the caption of the dialog itself. --- 28,32 ---- else: self.CreateWindow() ! def OnInitDialog(self): # Set the caption of the dialog itself. *************** *** 49,53 **** def OnNotify(self, controlid, code): if code==win32con.EN_CHANGE: ! print "Edit text changed!" return 1 # I handled this, so no need to call defaults! --- 50,54 ---- def OnNotify(self, controlid, code): if code==win32con.EN_CHANGE: ! print("Edit text changed!") return 1 # I handled this, so no need to call defaults! *************** *** 82,88 **** # In this case, we are interested in BN_CLICKED messages. self.HookNotify(self.OnNotify, win32con.BN_CLICKED) - def OnNotify(self, std, extra): ! print "OnNotify", std, extra # Some code that actually uses these objects. --- 83,88 ---- # In this case, we are interested in BN_CLICKED messages. self.HookNotify(self.OnNotify, win32con.BN_CLICKED) def OnNotify(self, std, extra): ! print("OnNotify", std, extra) # Some code that actually uses these objects. *************** *** 130,138 **** dlg = win32ui.CreateDialog(win32ui.IDD_DEBUGGER) dlg.datalist.append((win32ui.IDC_DBG_RADIOSTACK, "radio")) ! print "data list is ", dlg.datalist dlg.data['radio']=1 dlg.DoModal() ! print dlg.data['radio'] if __name__=='__main__': demo(1) --- 130,139 ---- dlg = win32ui.CreateDialog(win32ui.IDD_DEBUGGER) dlg.datalist.append((win32ui.IDC_DBG_RADIOSTACK, "radio")) ! print("data list is ", dlg.datalist) dlg.data['radio']=1 dlg.DoModal() ! print(dlg.data['radio']) if __name__=='__main__': demo(1) + Index: dibdemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/dibdemo.py,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** dibdemo.py 9 Aug 2008 16:46:41 -0000 1.2 --- dibdemo.py 29 Aug 2008 06:16:06 -0000 1.2.2.1 *************** *** 38,44 **** if len(bPBM)>0: magic=f.readline() ! if magic <> "P6\n": ! print "The file is not a PBM format file" ! raise "Failed" # check magic? rowcollist=f.readline().split() --- 38,44 ---- if len(bPBM)>0: magic=f.readline() ! if magic != "P6\n": ! print("The file is not a PBM format file") ! raise ValueError("Failed - The file is not a PBM format file") # check magic? rowcollist=f.readline().split() *************** *** 66,69 **** if __name__=='__main__': ! import demoutils demoutils.NotAScript() \ No newline at end of file --- 66,69 ---- if __name__=='__main__': ! from . import demoutils demoutils.NotAScript() \ No newline at end of file Index: fontdemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/fontdemo.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** fontdemo.py 1 Sep 1999 23:33:35 -0000 1.1 --- fontdemo.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 *************** *** 61,65 **** self.width = right - left self.height = bottom - top ! x, y = self.width / 2, self.height / 2 dc.TextOut (x, y, self.text) --- 61,65 ---- self.width = right - left self.height = bottom - top ! x, y = self.width // 2, self.height // 2 dc.TextOut (x, y, self.text) *************** *** 75,79 **** if __name__=='__main__': ! import demoutils if demoutils.NeedGoodGUI(): FontDemo() --- 75,79 ---- if __name__=='__main__': ! from . import demoutils if demoutils.NeedGoodGUI(): FontDemo() Index: objdoc.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/objdoc.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** objdoc.py 1 Sep 1999 23:33:35 -0000 1.1 --- objdoc.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 *************** *** 15,19 **** # Look for existing open document for doc in self.GetDocumentList(): ! print "document is ", doc if doc.object is object: doc.GetFirstView().ActivateFrame() --- 15,19 ---- # Look for existing open document for doc in self.GetDocumentList(): ! print("document is ", doc) if doc.object is object: doc.GetFirstView().ActivateFrame() *************** *** 32,41 **** self.object = object def OnOpenDocument (self, name): ! raise error, "Should not be called if template strings set up correctly" return 0 class object_view (docview.EditView): def OnInitialUpdate (self): ! self.ReplaceSel("Object is %s" % `self.GetDocument().object`) def demo (): --- 32,41 ---- self.object = object def OnOpenDocument (self, name): ! raise error("Should not be called if template strings set up correctly") return 0 class object_view (docview.EditView): def OnInitialUpdate (self): ! self.ReplaceSel("Object is %s" % repr(self.GetDocument().object)) def demo (): *************** *** 45,49 **** if __name__=='__main__': ! import demoutils if demoutils.NeedGoodGUI(): demo() \ No newline at end of file --- 45,49 ---- if __name__=='__main__': ! from . import demoutils if demoutils.NeedGoodGUI(): demo() \ No newline at end of file Index: dyndlg.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/dyndlg.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** dyndlg.py 1 Sep 1999 23:33:35 -0000 1.1 --- dyndlg.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 *************** *** 27,31 **** 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 ! dlg = [ ["Select Warehouse", (0, 0, 177, 93), style, None, (8, "MS Sans Serif")], ] dlg.append([130, "Current Warehouse:", -1, (7, 7, 69, 9), cs | win32con.SS_LEFT]) dlg.append([130, "ASTORIA", 128, (16, 17, 99, 7), cs | win32con.SS_LEFT]) --- 27,31 ---- 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 ! dlg = [ ["Select Warehouse", (0, 0, 177, 93), style, 0, (8, "MS Sans Serif")], ] dlg.append([130, "Current Warehouse:", -1, (7, 7, 69, 9), cs | win32con.SS_LEFT]) dlg.append([130, "ASTORIA", 128, (16, 17, 99, 7), cs | win32con.SS_LEFT]) Index: demoutils.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/demoutils.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** demoutils.py 1 Sep 1999 23:33:35 -0000 1.1 --- demoutils.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 *************** *** 44,48 **** parent = win32ui.GetMainFrame().GetSafeHwnd() win32api.ShellExecute(parent, None, 'pythonwin.exe', '/app "%s"' % sys.argv[0], None, 1) ! except win32api.error, details: win32ui.MessageBox("Error executing command - %s" % (details), "Demos") --- 44,48 ---- parent = win32ui.GetMainFrame().GetSafeHwnd() win32api.ShellExecute(parent, None, 'pythonwin.exe', '/app "%s"' % sys.argv[0], None, 1) ! except win32api.error as details: win32ui.MessageBox("Error executing command - %s" % (details), "Demos") *************** *** 51,54 **** if __name__=='__main__': ! import demoutils demoutils.NotAScript() --- 51,54 ---- if __name__=='__main__': ! from . import demoutils demoutils.NotAScript() Index: threadedgui.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/threadedgui.py,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** threadedgui.py 6 May 2000 08:29:58 -0000 1.3 --- threadedgui.py 29 Aug 2008 06:16:06 -0000 1.3.4.1 *************** *** 66,70 **** self.width = right - left self.height = bottom - top ! x, y = self.width / 2, self.height / 2 dc.TextOut (x, y, self.text[:self.index]) self.EndPaint(paintStruct) --- 66,70 ---- self.width = right - left self.height = bottom - top ! x, y = self.width // 2, self.height // 2 dc.TextOut (x, y, self.text[:self.index]) self.EndPaint(paintStruct) *************** *** 96,99 **** --- 96,100 ---- self._obj_ = win32ui.CreateMDIChild() self._obj_.AttachObject(self) + self._obj_.CreateWindow(None, title, style, rect, parent) rect = self.GetClientRect() *************** *** 111,114 **** --- 112,116 ---- rect = self.parentWindow.GetClientRect() rect = (0,0,rect[2]-rect[0], rect[3]-rect[1]) + self.child = FontWindow() self.child.Create("FontDemo", win32con.WS_CHILD | win32con.WS_VISIBLE, rect, self.parentWindow) *************** *** 150,154 **** def ThreadedDemo(): rect = win32ui.GetMainFrame().GetMDIClient().GetClientRect() ! rect = rect[0], rect[3]*3/4, rect[2]/4, rect[3] incr = rect[2] for i in range(4): --- 152,156 ---- def ThreadedDemo(): rect = win32ui.GetMainFrame().GetMDIClient().GetClientRect() ! rect = rect[0], int(rect[3]*3/4), int(rect[2]/4), rect[3] incr = rect[2] for i in range(4): Index: toolbar.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/toolbar.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** toolbar.py 5 Mar 2005 03:15:25 -0000 1.2 --- toolbar.py 29 Aug 2008 06:16:06 -0000 1.2.4.1 *************** *** 47,51 **** return # Not handled if (idFrom==win32ui.ID_APP_ABOUT): ! return 0, ("It works!", idFrom, code) return None # not handled. --- 47,51 ---- return # Not handled if (idFrom==win32ui.ID_APP_ABOUT): ! return 0, ("It Works - in unicode yet!", idFrom, code) return None # not handled. *************** *** 57,67 **** def OnSize (self, params): ! print 'OnSize called with ', params def OnNext (self, id, cmd): ! print 'OnNext called' def OnPrevious (self, id, cmd): ! print 'OnPrevious called' msg = """\ --- 57,67 ---- def OnSize (self, params): ! print('OnSize called with ', params) def OnNext (self, id, cmd): ! print('OnNext called') def OnPrevious (self, id, cmd): ! print('OnPrevious called') msg = """\ Index: cmdserver.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/cmdserver.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** cmdserver.py 4 Jun 2000 06:19:32 -0000 1.2 --- cmdserver.py 29 Aug 2008 06:16:06 -0000 1.2.4.1 *************** *** 7,11 **** from pywin.framework import winout ! import thread, sys import traceback --- 7,11 ---- from pywin.framework import winout ! import _thread, sys import traceback *************** *** 19,23 **** def register(self, writer): "Register the writer for the current thread" ! self.writers[thread.get_ident()] = writer if self.origStdOut is None: self.origStdOut = sys.stdout --- 19,23 ---- def register(self, writer): "Register the writer for the current thread" ! self.writers[_thread.get_ident()] = writer if self.origStdOut is None: self.origStdOut = sys.stdout *************** *** 27,31 **** "Remove the writer for the current thread, if any" try: ! del self.writers[thread.get_ident()] except KeyError: pass --- 27,31 ---- "Remove the writer for the current thread, if any" try: ! del self.writers[_thread.get_ident()] except KeyError: pass *************** *** 37,41 **** "Return the current thread's writer, default sys.stdout" try: ! return self.writers[thread.get_ident()] except KeyError: return self.origStdOut --- 37,41 ---- "Return the current thread's writer, default sys.stdout" try: ! return self.writers[_thread.get_ident()] except KeyError: return self.origStdOut *************** *** 48,52 **** num=1 while num<1000: ! print 'Hello there no ' + str(num) win32api.Sleep(50) num = num + 1 --- 48,52 ---- num=1 while num<1000: ! print('Hello there no ' + str(num)) win32api.Sleep(50) num = num + 1 *************** *** 65,74 **** # ServerThread((out, cmd, title, bCloseOnEnd)) # out = sys.stdout ! thread.start_new_thread( ServerThread, (out, cmd, title, bCloseOnEnd) ) def ServerThread(myout, cmd, title, bCloseOnEnd): try: writer.register(myout) ! print 'Executing "%s"\n' % cmd bOK = 1 try: --- 65,74 ---- # ServerThread((out, cmd, title, bCloseOnEnd)) # out = sys.stdout ! _thread.start_new_thread( ServerThread, (out, cmd, title, bCloseOnEnd) ) def ServerThread(myout, cmd, title, bCloseOnEnd): try: writer.register(myout) ! print('Executing "%s"\n' % cmd) bOK = 1 try: *************** *** 78,88 **** bOK = 0 if bOK: ! print "Command terminated without errors." else: t, v, tb = sys.exc_info() ! print t, ': ', v traceback.print_tb(tb) tb = None # prevent a cycle ! print "Command terminated with an unhandled exception" writer.unregister() if bOK and bCloseOnEnd: --- 78,88 ---- bOK = 0 if bOK: ! print("Command terminated without errors.") else: t, v, tb = sys.exc_info() ! print(t, ': ', v) traceback.print_tb(tb) tb = None # prevent a cycle ! print("Command terminated with an unhandled exception") writer.unregister() if bOK and bCloseOnEnd: *************** *** 92,99 **** except: t, v, tb = sys.exc_info() ! print t, ': ', v traceback.print_tb(tb) tb = None ! print "Thread failed" # assist for reloading (when debugging) - use only 1 tracer object, --- 92,99 ---- except: t, v, tb = sys.exc_info() ! print(t, ': ', v) traceback.print_tb(tb) tb = None ! print("Thread failed") # assist for reloading (when debugging) - use only 1 tracer object, *************** *** 104,108 **** # writer=ThreadWriter() if __name__=='__main__': ! import demoutils demoutils.NotAScript() --- 104,108 ---- # writer=ThreadWriter() if __name__=='__main__': ! from . import demoutils demoutils.NotAScript() Index: openGLDemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/openGLDemo.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** openGLDemo.py 11 Mar 2000 00:56:33 -0000 1.2 --- openGLDemo.py 29 Aug 2008 06:16:06 -0000 1.2.4.1 *************** *** 7,12 **** from OpenGL.GLU import * except ImportError: ! print "The OpenGL extensions do not appear to be installed." ! print "This Pythonwin demo can not run" sys.exit(1) --- 7,12 ---- from OpenGL.GLU import * except ImportError: ! print("The OpenGL extensions do not appear to be installed.") ! print("This Pythonwin demo can not run") sys.exit(1) *************** *** 39,43 **** ! threeto8 = [0, 0111>>1, 0222>>1, 0333>>1, 0444>>1, 0555>>1, 0666>>1, 0377] twoto8 = [0, 0x55, 0xaa, 0xff] oneto8 = [0, 255] --- 39,43 ---- ! threeto8 = [0, 0o111>>1, 0o222>>1, 0o333>>1, 0o444>>1, 0o555>>1, 0o666>>1, 0o377] twoto8 = [0, 0x55, 0xaa, 0xff] oneto8 = [0, 255] Index: menutest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/menutest.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** menutest.py 1 Sep 1999 23:33:35 -0000 1.1 --- menutest.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 *************** *** 4,8 **** if __name__=='__main__': ! import demoutils if demoutils.NeedGoodGUI(): win=interact.edit.currentView.GetParent() --- 4,8 ---- if __name__=='__main__': ! from . import demoutils if demoutils.NeedGoodGUI(): win=interact.edit.currentView.GetParent() *************** *** 10,12 **** id=menu.GetMenuItemID(6) menu.EnableMenuItem(id,win32con.MF_BYCOMMAND|win32con.MF_GRAYED) ! print "The interactive window's 'Close' menu item is now disabled." \ No newline at end of file --- 10,12 ---- id=menu.GetMenuItemID(6) menu.EnableMenuItem(id,win32con.MF_BYCOMMAND|win32con.MF_GRAYED) ! print("The interactive window's 'Close' menu item is now disabled.") \ No newline at end of file Index: hiertest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/hiertest.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** hiertest.py 1 Sep 1999 23:33:35 -0000 1.1 --- hiertest.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 *************** *** 17,21 **** def GetSubList(self, item): if os.path.isdir(item): ! ret = map(lambda path, base=item: os.path.join(base, path), os.listdir(item)) else: ret = None --- 17,21 ---- def GetSubList(self, item): if os.path.isdir(item): ! ret = [os.path.join(item, fname) for fname in os.listdir(item)] else: ret = None *************** *** 80,84 **** try: return "%-20s %d bytes" % (os.path.basename(self.filename), os.stat(self.filename)[6]) ! except os.error, details: return "%-20s - %s" % (self.filename, details[1]) --- 80,84 ---- try: return "%-20s %d bytes" % (os.path.basename(self.filename), os.stat(self.filename)[6]) ! except os.error as details: return "%-20s - %s" % (self.filename, details[1]) *************** *** 102,104 **** demoboth() else: ! demodlg() \ No newline at end of file --- 102,104 ---- demoboth() else: ! demodlg() Index: sliderdemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/sliderdemo.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** sliderdemo.py 4 Oct 1999 08:39:31 -0000 1.1 --- sliderdemo.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 *************** *** 39,43 **** return rc def OnCancel(self): ! print "The slider control is at position", self.slider.GetPos() self._obj_.OnCancel() ### --- 39,43 ---- return rc def OnCancel(self): ! print("The slider control is at position", self.slider.GetPos()) self._obj_.OnCancel() ### Index: guidemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/guidemo.py,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** guidemo.py 11 Mar 2000 00:56:06 -0000 1.3 --- guidemo.py 29 Aug 2008 06:16:06 -0000 1.3.4.1 *************** *** 25,29 **** try: # seeif I can locate the demo files. ! import fontdemo except ImportError: # else put the demos direectory on the path (if not already) --- 25,29 ---- try: # seeif I can locate the demo files. ! from . import fontdemo except ImportError: # else put the demos direectory on the path (if not already) *************** *** 31,35 **** instPath = regutil.GetRegistryDefaultValue(regutil.BuildDefaultPythonKey() + "\\InstallPath") except win32api.error: ! print "The InstallPath can not be located, and the Demos directory is not on the path" instPath="." --- 31,35 ---- instPath = regutil.GetRegistryDefaultValue(regutil.BuildDefaultPythonKey() + "\\InstallPath") except win32api.error: ! print("The InstallPath can not be located, and the Demos directory is not on the path") instPath="." *************** *** 40,44 **** else: sys.path.append(demosDir) ! import fontdemo import sys --- 40,44 ---- else: sys.path.append(demosDir) ! from . import fontdemo import sys *************** *** 46,52 **** for name, cmd in demos: try: ! exec cmd except: ! print "Demo of %s failed - %s:%s" % (cmd,sys.exc_info()[0], sys.exc_info()[1]) return # Otherwise allow the user to select the demo to run --- 46,52 ---- for name, cmd in demos: try: ! exec(cmd) except: ! print("Demo of %s failed - %s:%s" % (cmd,sys.exc_info()[0], sys.exc_info()[1])) return # Otherwise allow the user to select the demo to run *************** *** 59,68 **** title, cmd = demos[rc] try: ! exec cmd except: ! print "Demo of %s failed - %s:%s" % (title,sys.exc_info()[0], sys.exc_info()[1]) if __name__==__main__.__name__: ! import demoutils if demoutils.NeedGoodGUI(): demo() --- 59,68 ---- title, cmd = demos[rc] try: ! exec(cmd) except: ! print("Demo of %s failed - %s:%s" % (title,sys.exc_info()[0], sys.exc_info()[1])) if __name__==__main__.__name__: ! from . import demoutils if demoutils.NeedGoodGUI(): demo() Index: splittst.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/splittst.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** splittst.py 11 Mar 2000 00:57:08 -0000 1.2 --- splittst.py 29 Aug 2008 06:16:06 -0000 1.2.4.1 *************** *** 18,23 **** frame_rect = self.GetWindowRect() size = ((frame_rect[2] - frame_rect[0]), ! (frame_rect[3] - frame_rect[1])/2) ! sub_size = (size[0]/2, size[1]) splitter.CreateStatic (self, 2, 1) self.v1 = win32ui.CreateEditView(doc) --- 18,23 ---- frame_rect = self.GetWindowRect() size = ((frame_rect[2] - frame_rect[0]), ! (frame_rect[3] - frame_rect[1])//2) ! sub_size = (size[0]//2, size[1]) splitter.CreateStatic (self, 2, 1) self.v1 = win32ui.CreateEditView(doc) |
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/app In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17560/Demos/app Modified Files: Tag: py3k basictimerapp.py customprint.py demoutils.py dlgappdemo.py dojobapp.py helloapp.py Log Message: Changes for Python 3 Index: dlgappdemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/app/dlgappdemo.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** dlgappdemo.py 10 Dec 2006 21:51:10 -0000 1.2 --- dlgappdemo.py 29 Aug 2008 06:16:05 -0000 1.2.4.1 *************** *** 23,30 **** self.SetWindowText('Test dialog application') self.edit = self.GetDlgItem(win32ui.IDC_EDIT1) ! print "Hello from Python" ! print "args are:", for arg in sys.argv: ! print arg return 1 --- 23,30 ---- self.SetWindowText('Test dialog application') self.edit = self.GetDlgItem(win32ui.IDC_EDIT1) ! print("Hello from Python") ! print("args are:", end=' ') for arg in sys.argv: ! print(arg) return 1 *************** *** 43,47 **** if __name__=='__main__': ! import demoutils demoutils.NeedApp() \ No newline at end of file --- 43,47 ---- if __name__=='__main__': ! from . import demoutils demoutils.NeedApp() \ No newline at end of file Index: customprint.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/app/customprint.py,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** customprint.py 9 Aug 2008 16:46:40 -0000 1.3 --- customprint.py 29 Aug 2008 06:16:05 -0000 1.3.2.1 *************** *** 34,38 **** } self.pens = {} ! for name, color in self.colors.items(): self.pens[name] = win32ui.CreatePen(win32con.PS_SOLID, 5, color) --- 34,38 ---- } self.pens = {} ! for name, color in list(self.colors.items()): self.pens[name] = win32ui.CreatePen(win32con.PS_SOLID, 5, color) *************** *** 49,53 **** x,y = self.size delta = 2 ! colors = self.colors.keys() colors.sort() colors = colors*2 --- 49,53 ---- x,y = self.size delta = 2 ! colors = list(self.colors.keys()) colors.sort() colors = colors*2 *************** *** 169,173 **** def OnInitDialog(self): self.magCtl = self.GetDlgItem(IDC_PRINT_MAG_EDIT) ! self.magCtl.SetWindowText(`self['mag']`) return dialog.PrintDialog.OnInitDialog(self) def OnOK(self): --- 169,173 ---- def OnInitDialog(self): self.magCtl = self.GetDlgItem(IDC_PRINT_MAG_EDIT) ! self.magCtl.SetWindowText(repr(self['mag'])) return dialog.PrintDialog.OnInitDialog(self) def OnOK(self): Index: basictimerapp.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/app/basictimerapp.py,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** basictimerapp.py 9 Aug 2008 16:46:40 -0000 1.4 --- basictimerapp.py 29 Aug 2008 06:16:05 -0000 1.4.2.1 *************** *** 110,118 **** try: exec(self.dlg.doWork) ! print "The last operation completed successfully." except: t, v, tb = sys.exc_info() ! str = "Failed: %s: %s" % (t, `v`) ! print str self.oldErr.write(str) tb = None # Prevent cycle --- 110,118 ---- try: exec(self.dlg.doWork) ! print("The last operation completed successfully.") except: t, v, tb = sys.exc_info() ! str = "Failed: %s: %s" % (t, repr(v)) ! print(str) self.oldErr.write(str) tb = None # Prevent cycle *************** *** 196,210 **** def DoDemoWork(): ! print "Doing the work..." ! print "About to connect" win32api.MessageBeep(win32con.MB_ICONASTERISK) win32api.Sleep(2000) ! print "Doing something else..." win32api.MessageBeep(win32con.MB_ICONEXCLAMATION) win32api.Sleep(2000) ! print "More work." win32api.MessageBeep(win32con.MB_ICONHAND) win32api.Sleep(2000) ! print "The last bit." win32api.MessageBeep(win32con.MB_OK) win32api.Sleep(2000) --- 196,210 ---- def DoDemoWork(): ! print("Doing the work...") ! print("About to connect") win32api.MessageBeep(win32con.MB_ICONASTERISK) win32api.Sleep(2000) ! print("Doing something else...") win32api.MessageBeep(win32con.MB_ICONEXCLAMATION) win32api.Sleep(2000) ! print("More work.") win32api.MessageBeep(win32con.MB_ICONHAND) win32api.Sleep(2000) ! print("The last bit.") win32api.MessageBeep(win32con.MB_OK) win32api.Sleep(2000) *************** *** 218,221 **** if __name__=='__main__': ! import demoutils demoutils.NeedApp() --- 218,221 ---- if __name__=='__main__': ! from . import demoutils demoutils.NeedApp() Index: helloapp.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/app/helloapp.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** helloapp.py 1 Sep 1999 23:33:39 -0000 1.1 --- helloapp.py 29 Aug 2008 06:16:05 -0000 1.1.4.1 *************** *** 33,37 **** # The application object itself. ! class HelloApp(thread.WinApp): def InitInstance(self): --- 33,37 ---- # The application object itself. ! class HelloApp(_thread.WinApp): def InitInstance(self): Index: demoutils.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/app/demoutils.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** demoutils.py 1 Sep 1999 23:33:39 -0000 1.1 --- demoutils.py 29 Aug 2008 06:16:05 -0000 1.1.4.1 *************** *** 44,52 **** parent = win32ui.GetMainFrame().GetSafeHwnd() win32api.ShellExecute(parent, None, 'pythonwin.exe', '/app "%s"' % sys.argv[0], None, 1) ! except win32api.error, details: win32ui.MessageBox("Error executing command - %s" % (details), "Demos") if __name__=='__main__': ! import demoutils demoutils.NotAScript() --- 44,52 ---- parent = win32ui.GetMainFrame().GetSafeHwnd() win32api.ShellExecute(parent, None, 'pythonwin.exe', '/app "%s"' % sys.argv[0], None, 1) ! except win32api.error as details: win32ui.MessageBox("Error executing command - %s" % (details), "Demos") if __name__=='__main__': ! from . import demoutils demoutils.NotAScript() Index: dojobapp.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/app/dojobapp.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** dojobapp.py 1 Sep 1999 23:33:39 -0000 1.1 --- dojobapp.py 29 Aug 2008 06:16:05 -0000 1.1.4.1 *************** *** 59,62 **** if __name__=='__main__': ! import demoutils demoutils.NeedApp() --- 59,62 ---- if __name__=='__main__': ! from . import demoutils demoutils.NeedApp() |
From: Roger U. <ru...@us...> - 2008-08-29 06:15:57
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17560 Modified Files: Tag: py3k __init__.py default.cfg Log Message: Changes for Python 3 Index: default.cfg =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/default.cfg,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** default.cfg 11 Aug 2008 00:49:01 -0000 1.9 --- default.cfg 29 Aug 2008 06:16:06 -0000 1.9.2.1 *************** *** 197,202 **** find.lastSearch.findText = word find.lastSearch.sel = (start,end) ! except Exception, why: ! print repr(why), why find.FindNext() --- 197,202 ---- find.lastSearch.findText = word find.lastSearch.sel = (start,end) ! except Exception as why: ! print (repr(why), why) find.FindNext() Index: __init__.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/__init__.py,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -d -r1.4 -r1.4.4.1 *** __init__.py 26 Jan 2004 04:09:13 -0000 1.4 --- __init__.py 29 Aug 2008 06:16:06 -0000 1.4.4.1 *************** *** 1,5 **** # See if we run in Unicode mode. # This may be referenced all over the place, so we save it globally. ! import win32api, win32con, __builtin__ # This doesn't seem to work correctly on NT - see bug 716708 --- 1,5 ---- # See if we run in Unicode mode. # This may be referenced all over the place, so we save it globally. ! import win32api, win32con, builtins # This doesn't seem to work correctly on NT - see bug 716708 *************** *** 9,11 **** default_scintilla_encoding = "utf-8" # Scintilla _only_ supports this ATM ! del win32api, win32con, __builtin__ --- 9,11 ---- default_scintilla_encoding = "utf-8" # Scintilla _only_ supports this ATM ! del win32api, win32con, builtins |
From: Roger U. <ru...@us...> - 2008-08-29 06:15:57
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/ocx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17560/Demos/ocx Modified Files: Tag: py3k demoutils.py flash.py ocxserialtest.py ocxtest.py webbrowser.py Log Message: Changes for Python 3 Index: webbrowser.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/ocx/webbrowser.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** webbrowser.py 1 Sep 1999 23:33:40 -0000 1.1 --- webbrowser.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 *************** *** 11,15 **** WebBrowserModule = gencache.EnsureModule("{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 0, 1, 1) if WebBrowserModule is None: ! raise ImportError, "IE4 does not appear to be installed." class MyWebBrowser(activex.Control, WebBrowserModule.WebBrowser): --- 11,15 ---- WebBrowserModule = gencache.EnsureModule("{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 0, 1, 1) if WebBrowserModule is None: ! raise ImportError("IE4 does not appear to be installed.") class MyWebBrowser(activex.Control, WebBrowserModule.WebBrowser): Index: demoutils.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/ocx/demoutils.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** demoutils.py 1 Sep 1999 23:33:40 -0000 1.1 --- demoutils.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 *************** *** 44,48 **** parent = win32ui.GetMainFrame().GetSafeHwnd() win32api.ShellExecute(parent, None, 'pythonwin.exe', '/app "%s"' % sys.argv[0], None, 1) ! except win32api.error, details: win32ui.MessageBox("Error executing command - %s" % (details), "Demos") --- 44,48 ---- parent = win32ui.GetMainFrame().GetSafeHwnd() win32api.ShellExecute(parent, None, 'pythonwin.exe', '/app "%s"' % sys.argv[0], None, 1) ! except win32api.error as details: win32ui.MessageBox("Error executing command - %s" % (details), "Demos") *************** *** 51,54 **** if __name__=='__main__': ! import demoutils demoutils.NotAScript() --- 51,54 ---- if __name__=='__main__': ! from . import demoutils demoutils.NotAScript() Index: ocxtest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/ocx/ocxtest.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** ocxtest.py 1 Sep 1999 23:33:40 -0000 1.1 --- ocxtest.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 *************** *** 46,66 **** class MyCal(activex.Control, calendarParentModule.Calendar): def OnAfterUpdate(self): ! print "OnAfterUpdate" def OnClick(self): ! print "OnClick" def OnDblClick(self): ! print "OnDblClick" def OnKeyDown(self, KeyCode, Shift): ! print "OnKeyDown", KeyCode, Shift def OnKeyPress(self, KeyAscii): ! print "OnKeyPress", KeyAscii def OnKeyUp(self, KeyCode, Shift): ! print "OnKeyUp", KeyCode, Shift def OnBeforeUpdate(self, Cancel): ! print "OnBeforeUpdate", Cancel def OnNewMonth(self): ! print "OnNewMonth" def OnNewYear(self): ! print "OnNewYear" rc = dialog.Dialog.OnInitDialog(self) --- 46,66 ---- class MyCal(activex.Control, calendarParentModule.Calendar): def OnAfterUpdate(self): ! print("OnAfterUpdate") def OnClick(self): ! print("OnClick") def OnDblClick(self): ! print("OnDblClick") def OnKeyDown(self, KeyCode, Shift): ! print("OnKeyDown", KeyCode, Shift) def OnKeyPress(self, KeyAscii): ! print("OnKeyPress", KeyAscii) def OnKeyUp(self, KeyCode, Shift): ! print("OnKeyUp", KeyCode, Shift) def OnBeforeUpdate(self, Cancel): ! print("OnBeforeUpdate", Cancel) def OnNewMonth(self): ! print("OnNewMonth") def OnNewYear(self): ! print("OnNewYear") rc = dialog.Dialog.OnInitDialog(self) *************** *** 93,97 **** fnames = glob.glob(os.path.join(win32api.GetWindowsDirectory(), "*.avi")) if not fnames: ! print "No AVI files available in system directory" return None videoControlFileName = fnames[0] --- 93,97 ---- fnames = glob.glob(os.path.join(win32api.GetWindowsDirectory(), "*.avi")) if not fnames: ! print("No AVI files available in system directory") return None videoControlFileName = fnames[0] *************** *** 142,148 **** class MyCal(activex.Control, calendarParentModule.Calendar): def OnAfterUpdate(self): ! print "OnAfterUpdate" def OnClick(self): ! print "OnClick" f = OCXFrame() --- 142,148 ---- class MyCal(activex.Control, calendarParentModule.Calendar): def OnAfterUpdate(self): ! print("OnAfterUpdate") def OnClick(self): ! print("OnClick") f = OCXFrame() *************** *** 153,157 **** klass = GetTestCalendarClass() if klass is None: ! print "Can not test the MSAccess Calendar control - it does not appear to be installed" return --- 153,157 ---- klass = GetTestCalendarClass() if klass is None: ! print("Can not test the MSAccess Calendar control - it does not appear to be installed") return *************** *** 162,167 **** klass = GetTestVideoDialogClass() if klass is None: ! print "Can not test the Video OCX - it does not appear to be installed," ! print "or no AVI files can be found." return d = klass(MakeDlgTemplate() ) --- 162,167 ---- klass = GetTestVideoDialogClass() if klass is None: ! print("Can not test the Video OCX - it does not appear to be installed,") ! print("or no AVI files can be found.") return d = klass(MakeDlgTemplate() ) *************** *** 182,186 **** if __name__=='__main__': ! import demoutils if demoutils.NeedGoodGUI(): testall() --- 182,186 ---- if __name__=='__main__': ! from . import demoutils if demoutils.NeedGoodGUI(): testall() Index: ocxserialtest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/ocx/ocxserialtest.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** ocxserialtest.py 1 Sep 1999 23:33:40 -0000 1.1 --- ocxserialtest.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 *************** *** 19,23 **** win32ui.DoWaitCursor(0) if serialModule is None: ! raise ImportError, "MS COMM Control does not appear to be installed on the PC" --- 19,23 ---- win32ui.DoWaitCursor(0) if serialModule is None: ! raise ImportError("MS COMM Control does not appear to be installed on the PC") *************** *** 48,52 **** class TestSerDialog(dialog.Dialog): def __init__(self, *args): ! apply( dialog.Dialog.__init__, (self,)+args ) self.olectl = None def OnComm(self): --- 48,52 ---- class TestSerDialog(dialog.Dialog): def __init__(self, *args): ! dialog.Dialog.__init__(*(self,)+args) self.olectl = None def OnComm(self): *************** *** 79,84 **** try: self.olectl.PortOpen = 1 ! except pythoncom.com_error, details: ! print "Could not open the specified serial port - %s" % (details[2][2]) self.EndDialog(win32con.IDCANCEL) return rc --- 79,84 ---- try: self.olectl.PortOpen = 1 ! except pythoncom.com_error as details: ! print("Could not open the specified serial port - %s" % (details[2][2])) self.EndDialog(win32con.IDCANCEL) return rc *************** *** 88,93 **** try: self.olectl.PortOpen = 0 ! except pythoncom.com_error, details: ! print "Error closing port - %s" % (details[2][2]) return dialog.Dialog.OnDestroy(self, msg) --- 88,93 ---- try: self.olectl.PortOpen = 0 ! except pythoncom.com_error as details: ! print("Error closing port - %s" % (details[2][2])) return dialog.Dialog.OnDestroy(self, msg) *************** *** 97,101 **** if __name__ == "__main__": ! import demoutils if demoutils.NeedGoodGUI(): test() --- 97,101 ---- if __name__ == "__main__": ! from . import demoutils if demoutils.NeedGoodGUI(): test() Index: flash.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/ocx/flash.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** flash.py 2 Jul 2003 04:09:25 -0000 1.1 --- flash.py 29 Aug 2008 06:16:06 -0000 1.1.4.1 *************** *** 16,20 **** if FlashModule is None: ! raise ImportError, "Flash does not appear to be installed." class MyFlashComponent(activex.Control, FlashModule.ShockwaveFlash): --- 16,20 ---- if FlashModule is None: ! raise ImportError("Flash does not appear to be installed.") class MyFlashComponent(activex.Control, FlashModule.ShockwaveFlash): *************** *** 28,32 **** def OnFSCommand(self, command, args): ! print "FSCommend" , command, args self.x = self.x + 20 self.y = self.y + 20 --- 28,32 ---- def OnFSCommand(self, command, args): ! print("FSCommend" , command, args) self.x = self.x + 20 self.y = self.y + 20 *************** *** 43,50 **** def OnProgress(self, percentDone): ! print "PercentDone", percentDone def OnReadyStateChange(self, newState): # 0=Loading, 1=Uninitialized, 2=Loaded, 3=Interactive, 4=Complete ! print "State", newState --- 43,50 ---- def OnProgress(self, percentDone): ! print("PercentDone", percentDone) def OnReadyStateChange(self, newState): # 0=Loading, 1=Uninitialized, 2=Loaded, 3=Interactive, 4=Complete ! print("State", newState) |
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7141 Modified Files: Tag: py3k Win32app.h Win32uiHostGlue.h dbgthread.cpp ddeconv.cpp ddeitem.cpp ddemodule.cpp ddemodule.h ddeserver.cpp dllmain.cpp pythondoc.h stddde.cpp win32ImageList.cpp win32RichEdit.cpp win32app.cpp win32assoc.cpp win32bitmap.cpp win32cmd.cpp win32cmdui.cpp win32cmdui.h win32control.cpp win32control.h win32ctledit.cpp win32ctrlList.cpp win32ctrlRichEdit.cpp win32ctrlTree.cpp win32dc.cpp win32dlg.cpp win32dlg.h win32dlgbar.cpp win32dll.cpp win32doc.cpp win32menu.cpp win32notify.cpp win32oleDlgInsert.cpp win32prop.cpp win32splitter.cpp win32template.cpp win32thread.cpp win32toolbar.cpp win32toolbar.h win32tooltip.cpp win32ui.h win32uiExt.h win32uimodule.cpp win32uiole.cpp win32uioleClientItem.cpp win32uioledoc.cpp win32uioledoc.h win32util.cpp win32view.cpp win32virt.cpp win32win.cpp win32win.h Log Message: Changes for py3k and to build as UNICODE Index: win32ctledit.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ctledit.cpp,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** win32ctledit.cpp 1 Sep 1999 23:33:00 -0000 1.1 --- win32ctledit.cpp 29 Aug 2008 05:53:29 -0000 1.1.4.1 *************** *** 199,209 **** { CEdit *pEdit = GetEditCtrl(self); ! char *msg; // @pyparm string|text||The text to replace the selection with. ! if (!pEdit || !PyArg_ParseTuple(args, "s:ReplaceSel", &msg)) return NULL; GUI_BGN_SAVE; pEdit->ReplaceSel(msg); // @pyseemfc CEdit|ReplaceSel GUI_END_SAVE; RETURN_NONE; } --- 199,213 ---- { CEdit *pEdit = GetEditCtrl(self); ! TCHAR *msg; ! PyObject *obmsg; // @pyparm string|text||The text to replace the selection with. ! if (!pEdit ! || !PyArg_ParseTuple(args, "O:ReplaceSel", &obmsg) ! || !PyWinObject_AsTCHAR(obmsg, &msg, FALSE)) return NULL; GUI_BGN_SAVE; pEdit->ReplaceSel(msg); // @pyseemfc CEdit|ReplaceSel GUI_END_SAVE; + PyWinObject_FreeTCHAR(msg); RETURN_NONE; } *************** *** 351,355 **** // and handle worst case, and look what happens! CString csBuffer; // use dynamic mem for buffer ! char *buf; int bytesCopied; // this TRACE _always_ returns the length of the first line - hence the --- 355,359 ---- // and handle worst case, and look what happens! CString csBuffer; // use dynamic mem for buffer ! TCHAR *buf; int bytesCopied; // this TRACE _always_ returns the length of the first line - hence the *************** *** 377,381 **** --bytesCopied; buf[bytesCopied] = '\0'; ! return Py_BuildValue("s",buf); } --- 381,385 ---- --bytesCopied; buf[bytesCopied] = '\0'; ! return PyWinObject_FromTCHAR(buf); } Index: win32app.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32app.cpp,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -d -r1.6 -r1.6.2.1 *** win32app.cpp 3 Jun 2007 12:35:57 -0000 1.6 --- win32app.cpp 29 Aug 2008 05:53:29 -0000 1.6.2.1 *************** *** 74,85 **** // FindOpenDocument - if the C++ framework has a document with this name open, // then return a pointer to it, else NULL. ! CDocument *CProtectedWinApp::FindOpenDocument(const char *lpszFileName) { POSITION posTempl = m_pDocManager->GetFirstDocTemplatePosition(); CDocument* pOpenDocument = NULL; ! char szPath[_MAX_PATH]; ! if (!GetFullPath(szPath, lpszFileName)) ! strcpy(szPath, lpszFileName); while (posTempl) { --- 74,85 ---- // FindOpenDocument - if the C++ framework has a document with this name open, // then return a pointer to it, else NULL. ! CDocument *CProtectedWinApp::FindOpenDocument(const TCHAR *lpszFileName) { POSITION posTempl = m_pDocManager->GetFirstDocTemplatePosition(); CDocument* pOpenDocument = NULL; ! TCHAR szPath[_MAX_PATH]; ! if (!AfxFullPath(szPath, lpszFileName)) ! _tcscpy(szPath, lpszFileName); while (posTempl) { *************** *** 189,195 **** ui_open_document_file(PyObject *self, PyObject *args) { ! char *fileName; ! if (!PyArg_ParseTuple(args, "s:OpenDocumentFile", ! &fileName )) // @pyparm string|fileName||The name of the document to open. return NULL; CWinApp *pApp = GetApp(); --- 189,198 ---- ui_open_document_file(PyObject *self, PyObject *args) { ! TCHAR *fileName; ! PyObject *obfileName; ! if (!PyArg_ParseTuple(args, "O:OpenDocumentFile", ! &obfileName )) // @pyparm string|fileName||The name of the document to open. ! return NULL; ! if (!PyWinObject_AsTCHAR(obfileName, &fileName)) return NULL; CWinApp *pApp = GetApp(); *************** *** 202,205 **** --- 205,209 ---- CDocument *pDoc = pApp->OpenDocumentFile(fileName); GUI_END_SAVE; + PyWinObject_FreeTCHAR(fileName); if (PyErr_Occurred()) return NULL; *************** *** 213,226 **** ui_find_open_document(PyObject *self, PyObject *args) { ! char *fileName; // @pyparm string|fileName||The fully qualified filename to search for. ! if (!PyArg_ParseTuple(args,"s", &fileName)) return NULL; CProtectedWinApp *pApp = GetProtectedApp(); if (!pApp) return NULL; // Let MFC framework search for a filename for us. GUI_BGN_SAVE; CDocument *pDoc=pApp->FindOpenDocument(fileName); GUI_END_SAVE; if (pDoc==NULL) RETURN_NONE; --- 217,235 ---- ui_find_open_document(PyObject *self, PyObject *args) { ! TCHAR *fileName; ! PyObject *obfileName; // @pyparm string|fileName||The fully qualified filename to search for. ! if (!PyArg_ParseTuple(args,"O", &obfileName)) return NULL; CProtectedWinApp *pApp = GetProtectedApp(); if (!pApp) return NULL; + + if (!PyWinObject_AsTCHAR(obfileName, &fileName, FALSE)) + return NULL; // Let MFC framework search for a filename for us. GUI_BGN_SAVE; CDocument *pDoc=pApp->FindOpenDocument(fileName); GUI_END_SAVE; + PyWinObject_FreeTCHAR(fileName); if (pDoc==NULL) RETURN_NONE; *************** *** 267,284 **** static PyObject *ui_load_cursor(PyObject *self, PyObject *args) { ! UINT cid; ! char *csid; HCURSOR hc; ! if ( PyArg_ParseTuple(args, "i", ! &cid)) // @pyparm int|cursorId||The ID of the cursor to load. ! hc = GetApp()->LoadCursor(cid); ! else { ! PyErr_Clear(); ! if (PyArg_ParseTuple(args, "s", ! &csid)) // @pyparmalt1 string|cursorId||The ID of the cursor to load. ! hc = GetApp()->LoadCursor(csid); ! else ! RETURN_TYPE_ERR("The first param must be an integer or a string"); ! } if (hc==0) RETURN_API_ERR("LoadCursor"); --- 276,292 ---- static PyObject *ui_load_cursor(PyObject *self, PyObject *args) { ! TCHAR *csid; HCURSOR hc; ! PyObject *obid; ! if (!PyArg_ParseTuple(args, "O:LoadCursor", ! &obid)) // @pyparm <o PyResourceId>|cursorId||The resource id or name of the cursor to load. ! return NULL; ! if (!PyWinObject_AsResourceId(obid, &csid, TRUE)) ! return NULL; ! if (IS_INTRESOURCE(csid)) ! hc = GetApp()->LoadCursor((UINT)csid); ! else ! hc = GetApp()->LoadCursor(csid); ! PyWinObject_FreeResourceId(csid); if (hc==0) RETURN_API_ERR("LoadCursor"); *************** *** 289,306 **** static PyObject *ui_load_standard_cursor(PyObject *self, PyObject *args) { ! UINT cid; ! char *csid; HCURSOR hc; ! if ( PyArg_ParseTuple(args, "i", ! &cid)) // @pyparm int|cursorId||The ID of the cursor to load. ! hc = GetApp()->LoadStandardCursor(MAKEINTRESOURCE(cid)); ! else { ! PyErr_Clear(); ! if (PyArg_ParseTuple(args, "s", // @pyparmalt1 string|cursorId||The ID of the cursor to load. ! &csid)) ! hc = GetApp()->LoadStandardCursor(csid); ! else ! RETURN_TYPE_ERR("The first param must be an integer or a string"); ! } if (hc==0) RETURN_API_ERR("LoadStandardCursor"); --- 297,310 ---- static PyObject *ui_load_standard_cursor(PyObject *self, PyObject *args) { ! PyObject *obid; ! TCHAR *csid; HCURSOR hc; ! if (!PyArg_ParseTuple(args, "O:LoadStandardCursor", ! &obid)) // @pyparm <o PyResourceId>|cursorId||The resource ID or name of the cursor to load. ! return NULL; ! if (!PyWinObject_AsResourceId(obid, &csid, TRUE)) ! return NULL; ! hc = GetApp()->LoadStandardCursor(csid); ! PyWinObject_FreeResourceId(csid); if (hc==0) RETURN_API_ERR("LoadStandardCursor"); *************** *** 313,317 **** UINT cid; HCURSOR hc; ! if ( !PyArg_ParseTuple(args, "i", &cid)) // @pyparm int|cursorId||The ID of the cursor to load. return NULL; --- 317,321 ---- UINT cid; HCURSOR hc; ! if ( !PyArg_ParseTuple(args, "i:LoadOEMCursor", &cid)) // @pyparm int|cursorId||The ID of the cursor to load. return NULL; *************** *** 332,336 **** CWinApp *pApp = GetApp(); if (!pApp) return NULL; ! return Py_BuildValue("i", pApp->LoadIcon(idResource)); } --- 336,340 ---- CWinApp *pApp = GetApp(); if (!pApp) return NULL; ! return PyWinLong_FromHANDLE(pApp->LoadIcon(idResource)); } *************** *** 339,352 **** ui_load_standard_icon(PyObject *self, PyObject *args) { ! char *resName; ! // @pyparm string|resourceName||The name of the standard icon to load. ! if (!PyArg_ParseTuple(args,"s:LoadStandardIcon", &resName)) return NULL; CWinApp *pApp = GetApp(); if (!pApp) return NULL; ! return Py_BuildValue("i", pApp->LoadStandardIcon(resName)); } - // @pymethod int|PyCWinApp|Run|Starts the message pump. Advanced users only static PyObject * --- 343,362 ---- ui_load_standard_icon(PyObject *self, PyObject *args) { ! TCHAR *resName; ! PyObject *obName; ! // @pyparm <o PyResourceId>|resourceName||The resource name or id of the standard icon to load. ! if (!PyArg_ParseTuple(args,"O:LoadStandardIcon", &obName)) return NULL; CWinApp *pApp = GetApp(); if (!pApp) return NULL; ! if (!PyWinObject_AsResourceId(obName, &resName, FALSE)) ! return NULL; ! HICON hicon = pApp->LoadStandardIcon(resName); ! PyWinObject_FreeResourceId(resName); ! if (hicon==0) ! RETURN_API_ERR("LoadStandardIcon"); ! return PyWinLong_FromHANDLE(hicon); } // @pymethod int|PyCWinApp|Run|Starts the message pump. Advanced users only static PyObject * Index: win32win.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32win.cpp,v retrieving revision 1.21 retrieving revision 1.21.2.1 diff -C2 -d -r1.21 -r1.21.2.1 *** win32win.cpp 26 Feb 2008 09:36:22 -0000 1.21 --- win32win.cpp 29 Aug 2008 05:53:30 -0000 1.21.2.1 *************** *** 74,77 **** --- 74,79 ---- PyObject *method; CWnd *pWnd = bInFatalShutdown ? NULL : CWnd::FromHandlePermanent(msg->hwnd); + // is_uiobjects calls python methods, must already hold lock + CEnterLeavePython _celp; if (pWnd && (pObj=ui_assoc_object::GetPyObject(pWnd)) && *************** *** 84,88 **** #endif // Our Python convention is TRUE means "pass it on" ! CEnterLeavePython _celp; return Python_callback(method, msg)==0; } --- 86,90 ---- #endif // Our Python convention is TRUE means "pass it on" ! // CEnterLeavePython _celp; return Python_callback(method, msg)==0; } *************** *** 117,121 **** } else { char buf[128]; ! wsprintf(buf,"Argument must be a %s object, or integer containing a HWND", type.tp_name); RETURN_ERR(buf); } --- 119,123 ---- } else { char buf[128]; ! snprintf(buf, sizeof(buf), "Argument must be a %s object, or integer containing a HWND", type.tp_name); RETURN_ERR(buf); } *************** *** 176,180 **** return FALSE; } ! PyErr_Clear(); // clear any errors, so I can detect my own. // 0 - mask. if ((ob=PyTuple_GetItem(args, 0))==NULL) --- 178,182 ---- return FALSE; } ! assert (!PyErr_Occurred()); // PyErr_Clear(); // clear any errors, so I can detect my own. // 0 - mask. if ((ob=PyTuple_GetItem(args, 0))==NULL) *************** *** 278,288 **** PyObject *obParent; RECT rect; ! const char *szClass, *szWndName; CCreateContext *pCCPass = NULL; PythonCreateContext cc; PyObject *contextObject = Py_None; ! if (!PyArg_ParseTuple(args, "zzi(iiii)Oi|O:CreateWindow", ! &szClass, // @pyparm string|classId||The class ID for the window, or None ! &szWndName, // @pyparm string|windowName||The title for the window, or None &style, // @pyparm int|style||The style for the window. &rect.left,&rect.top,&rect.right,&rect.bottom, --- 280,291 ---- PyObject *obParent; RECT rect; ! TCHAR *szClass=NULL, *szWndName=NULL; ! PyObject *obClass, *obWndName, *ret=NULL; CCreateContext *pCCPass = NULL; PythonCreateContext cc; PyObject *contextObject = Py_None; ! if (!PyArg_ParseTuple(args, "OOi(iiii)Oi|O:CreateWindow", ! &obClass, // @pyparm string|classId||The class ID for the window, or None ! &obWndName, // @pyparm string|windowName||The title for the window, or None &style, // @pyparm int|style||The style for the window. &rect.left,&rect.top,&rect.right,&rect.bottom, *************** *** 310,321 **** return NULL; ! BOOL ok; ! GUI_BGN_SAVE; ! // @pyseemfc CWnd|Create ! ok = pWnd->Create(szClass, szWndName, style, rect, pParent, id, pCCPass); ! GUI_END_SAVE; ! if (!ok) ! RETURN_ERR("CWnd::Create"); ! RETURN_NONE; } --- 313,333 ---- return NULL; ! if (PyWinObject_AsTCHAR(obClass, &szClass, TRUE)&& ! PyWinObject_AsTCHAR(obWndName, &szWndName, TRUE)){ ! BOOL ok; ! GUI_BGN_SAVE; ! // @pyseemfc CWnd|Create ! ok = pWnd->Create(szClass, szWndName, style, rect, pParent, id, pCCPass); ! GUI_END_SAVE; ! if (!ok) ! PyErr_SetString(ui_module_error, "CWnd::Create"); ! else{ ! Py_INCREF(Py_None); ! ret=Py_None; ! } ! } ! PyWinObject_FreeTCHAR(szClass); ! PyWinObject_FreeTCHAR(szWndName); ! return ret; } *************** *** 327,337 **** PyObject *obParent; RECT rect; ! const char *szClass, *szWndName; DWORD dwStyleEx; PyObject *csObject = Py_None; ! if (!PyArg_ParseTuple(args, "iszi(iiii)Oi|O:CreateWindowEx", &dwStyleEx, // @pyparm int|styleEx||The extended style of the window being created. ! &szClass, // @pyparm string|classId||The class ID for the window. May not be None. ! &szWndName, // @pyparm string|windowName||The title for the window, or None &style, // @pyparm int|style||The style for the window. &rect.left,&rect.top,&rect.right,&rect.bottom, --- 339,350 ---- PyObject *obParent; RECT rect; ! TCHAR *szClass=NULL, *szWndName=NULL; ! PyObject *obClass, *obWndName; DWORD dwStyleEx; PyObject *csObject = Py_None; ! if (!PyArg_ParseTuple(args, "iOOi(iiii)Oi|O:CreateWindowEx", &dwStyleEx, // @pyparm int|styleEx||The extended style of the window being created. ! &obClass, // @pyparm string|classId||The class ID for the window. May not be None. ! &obWndName, // @pyparm string|windowName||The title for the window, or None &style, // @pyparm int|style||The style for the window. &rect.left,&rect.top,&rect.right,&rect.bottom, *************** *** 364,367 **** --- 377,386 ---- return NULL; + if (!PyWinObject_AsTCHAR(obClass, &szClass, FALSE)) + return NULL; + if (!PyWinObject_AsTCHAR(obWndName, &szWndName, TRUE)){ + PyWinObject_FreeTCHAR(szClass); + return NULL; + } BOOL ok; GUI_BGN_SAVE; *************** *** 369,372 **** --- 388,393 ---- ok = pWnd->CreateEx(dwStyleEx, szClass, szWndName, style, rect, pParent, id, pcs); GUI_END_SAVE; + PyWinObject_FreeTCHAR(szClass); + PyWinObject_FreeTCHAR(szWndName); if (!ok) RETURN_ERR("CWnd::CreateEx"); *************** *** 396,400 **** PyCWnd::CreateControl(PyObject *self, PyObject *args) { - USES_CONVERSION; PyObject *parent = Py_None; int id; --- 417,420 ---- *************** *** 403,411 **** PyObject *obPersist = Py_None; int bStorage = FALSE; ! const char *szClass, *szWndName; PyObject *obLicKey = Py_None; ! if (!PyArg_ParseTuple(args, "szi(iiii)Oi|OiO", ! &szClass, // @pyparm string|classId||The class ID for the window. ! &szWndName, // @pyparm string|windowName||The title for the window. &style, // @pyparm int|style||The style for the control. // @pyparm (left, top, right, bottom)|rect||The default position of the window. --- 423,432 ---- PyObject *obPersist = Py_None; int bStorage = FALSE; ! TCHAR *szClass=NULL, *szWndName=NULL; ! PyObject *obClass, *obWndName; PyObject *obLicKey = Py_None; ! if (!PyArg_ParseTuple(args, "OOi(iiii)Oi|OiO:CreateControl", ! &obClass, // @pyparm string|classId||The class ID for the window. ! &obWndName, // @pyparm string|windowName||The title for the window. &style, // @pyparm int|style||The style for the control. // @pyparm (left, top, right, bottom)|rect||The default position of the window. *************** *** 418,423 **** --- 439,447 ---- return NULL; + if (!PyWinObject_AsTCHAR(obClass, &szClass, FALSE)) + return NULL; CLSID clsid; HRESULT hr = AfxGetClassIDFromString(szClass, &clsid); + PyWinObject_FreeTCHAR(szClass); if (FAILED(hr)) RETURN_ERR("The CLSID is invalid"); *************** *** 436,443 **** --- 460,470 ---- if (afxOccManager == NULL) RETURN_ERR("win32ui.EnableControlContainer() has not been called yet."); + if (!PyWinObject_AsTCHAR(obWndName, &szWndName, TRUE)) + return NULL; BOOL ok; GUI_BGN_SAVE; ok = pWnd->CreateControl(clsid, szWndName, style, rect, pWndParent, id, NULL, bStorage, bstrLicKey); GUI_END_SAVE; + PyWinObject_FreeTCHAR(szWndName); if (!ok) RETURN_ERR("CreateControl failed"); *************** *** 493,505 **** PyCWnd::FindWindow(PyObject *self, PyObject *args) { ! char *szClassName; ! char *szWndName; ! if (!PyArg_ParseTuple(args, "zz:FindWindow", ! &szClassName, // @pyparm string|className||The window class name to find, else None ! &szWndName)) // @pyparm string|windowName||The window name (ie, title) to find, else None return NULL; GUI_BGN_SAVE; CWnd *pWnd = CWnd::FindWindow( szClassName, szWndName ); GUI_END_SAVE; if (pWnd==NULL) RETURN_ERR("No window can be found."); --- 520,541 ---- PyCWnd::FindWindow(PyObject *self, PyObject *args) { ! TCHAR *szClassName=NULL; ! TCHAR *szWndName=NULL; ! PyObject *obClassName, *obWndName; ! if (!PyArg_ParseTuple(args, "OO:FindWindow", ! &obClassName, // @pyparm string|className||The window class name to find, else None ! &obWndName)) // @pyparm string|windowName||The window name (ie, title) to find, else None ! return NULL; ! if (!PyWinObject_AsTCHAR(obClassName, &szClassName, TRUE)) ! return NULL; ! if (!PyWinObject_AsTCHAR(obWndName, &szWndName, TRUE)){ ! PyWinObject_FreeTCHAR(szClassName); return NULL; + } GUI_BGN_SAVE; CWnd *pWnd = CWnd::FindWindow( szClassName, szWndName ); GUI_END_SAVE; + PyWinObject_FreeTCHAR(szClassName); + PyWinObject_FreeTCHAR(szWndName); if (pWnd==NULL) RETURN_ERR("No window can be found."); *************** *** 512,524 **** PyCWnd::FindWindowEx(PyObject *self, PyObject *args) { ! char *szClassName; ! char *szWndName; PyObject *obParent; PyObject *obChildAfter; ! if (!PyArg_ParseTuple(args, "OOzz:FindWindowEx", &obParent, // @pyparm <o PyCWnd>|parentWindow||The parent whose children will be searched. If None, the desktops window will be used. &obChildAfter, // @pyparm <o PyCWnd>|childAfter||The search begins with the next window in the Z order. If None, all children are searched. ! &szClassName, // @pyparm string|className||The window class name to find, else None ! &szWndName)) // @pyparm string|windowName||The window name (ie, title) to find, else None return NULL; CWnd *pParent = NULL; --- 548,561 ---- PyCWnd::FindWindowEx(PyObject *self, PyObject *args) { ! TCHAR *szClassName=NULL; ! TCHAR *szWndName=NULL; ! PyObject *obClassName, *obWndName, *ret=NULL; PyObject *obParent; PyObject *obChildAfter; ! if (!PyArg_ParseTuple(args, "OOOO:FindWindowEx", &obParent, // @pyparm <o PyCWnd>|parentWindow||The parent whose children will be searched. If None, the desktops window will be used. &obChildAfter, // @pyparm <o PyCWnd>|childAfter||The search begins with the next window in the Z order. If None, all children are searched. ! &obClassName, // @pyparm string|className||The window class name to find, else None ! &obWndName)) // @pyparm string|windowName||The window name (ie, title) to find, else None return NULL; CWnd *pParent = NULL; *************** *** 530,540 **** if ((pChildAfter=GetWndPtrFromParam(obChildAfter, PyCWnd::type))==NULL) return NULL; ! GUI_BGN_SAVE; ! HWND hwnd = ::FindWindowEx(pParent->GetSafeHwnd(), pChildAfter->GetSafeHwnd(), szClassName, szWndName); ! GUI_END_SAVE; ! if (hwnd==NULL) ! RETURN_ERR("No window can be found."); ! return PyCWnd::make( PyCWnd::type, NULL, hwnd)->GetGoodRet(); // @rdesc The result is a <o PyCWnd> (or derived) object, or a win32ui.error exception is raised. } --- 567,584 ---- if ((pChildAfter=GetWndPtrFromParam(obChildAfter, PyCWnd::type))==NULL) return NULL; ! if (PyWinObject_AsTCHAR(obClassName, &szClassName, TRUE) ! &&PyWinObject_AsTCHAR(obWndName, &szWndName, TRUE)){ ! GUI_BGN_SAVE; ! HWND hwnd = ::FindWindowEx(pParent->GetSafeHwnd(), pChildAfter->GetSafeHwnd(), szClassName, szWndName); ! GUI_END_SAVE; ! if (hwnd==NULL) ! PyErr_SetString(ui_module_error, "FindWindowEx: No window can be found."); ! else ! ret = PyCWnd::make( PyCWnd::type, NULL, hwnd)->GetGoodRet(); ! } ! PyWinObject_FreeTCHAR(szClassName); ! PyWinObject_FreeTCHAR(szWndName); ! return ret; // @rdesc The result is a <o PyCWnd> (or derived) object, or a win32ui.error exception is raised. } *************** *** 809,816 **** if (!pWnd) return NULL; ! char *defPath; int nIDListBox, nIDStaticPath, nFileType; ! if (!PyArg_ParseTuple(args,"siii:DlgDirList", ! &defPath, // @pyparm string|defPath||The file spec to fill the list box with &nIDListBox, // @pyparm int|idListbox||The Id of the listbox control to fill. &nIDStaticPath, // @pyparm int|idStaticPath||The Id of the static control used to display the current drive and directory. If idStaticPath is 0, it is assumed that no such control exists. --- 853,861 ---- if (!pWnd) return NULL; ! TCHAR *defPath; ! PyObject *obdefPath; int nIDListBox, nIDStaticPath, nFileType; ! if (!PyArg_ParseTuple(args,"Oiii:DlgDirList", ! &obdefPath, // @pyparm string|defPath||The file spec to fill the list box with &nIDListBox, // @pyparm int|idListbox||The Id of the listbox control to fill. &nIDStaticPath, // @pyparm int|idStaticPath||The Id of the static control used to display the current drive and directory. If idStaticPath is 0, it is assumed that no such control exists. *************** *** 818,823 **** // It can be any combination of DDL_READWRITE, DDL_READONLY, DDL_HIDDEN, DDL_SYSTEM, DDL_DIRECTORY, DDL_ARCHIVE, DDL_POSTMSGS, DDL_DRIVES or DDL_EXCLUSIVE return NULL; ! char pathBuf[MAX_PATH+1]; ! strncpy(pathBuf, defPath, MAX_PATH); pathBuf[MAX_PATH] = '\0'; int rc; --- 863,870 ---- // It can be any combination of DDL_READWRITE, DDL_READONLY, DDL_HIDDEN, DDL_SYSTEM, DDL_DIRECTORY, DDL_ARCHIVE, DDL_POSTMSGS, DDL_DRIVES or DDL_EXCLUSIVE return NULL; ! if (!PyWinObject_AsTCHAR(obdefPath, &defPath, FALSE)) ! return NULL; ! TCHAR pathBuf[MAX_PATH+1]; ! _tcsncpy(pathBuf, defPath, MAX_PATH); pathBuf[MAX_PATH] = '\0'; int rc; *************** *** 826,829 **** --- 873,877 ---- rc = pWnd->DlgDirList( pathBuf, nIDListBox, nIDStaticPath, nFileType); GUI_END_SAVE; + PyWinObject_FreeTCHAR(defPath); if (!rc) RETURN_ERR("DlgDirList failed"); *************** *** 837,846 **** if (!pWnd) return NULL; ! char *defPath; int nIDListBox, nIDStaticPath, nFileType; ! if (!PyArg_ParseTuple(args,"siii:DlgDirListComboBox", &defPath, &nIDListBox, &nIDStaticPath, &nFileType)) return NULL; ! char pathBuf[MAX_PATH+1]; ! strncpy(pathBuf, defPath, MAX_PATH); pathBuf[MAX_PATH] = '\0'; int rc; --- 885,897 ---- if (!pWnd) return NULL; ! TCHAR *defPath; ! PyObject *obdefPath; int nIDListBox, nIDStaticPath, nFileType; ! if (!PyArg_ParseTuple(args,"Oiii:DlgDirListComboBox", &obdefPath, &nIDListBox, &nIDStaticPath, &nFileType)) return NULL; ! if (!PyWinObject_AsTCHAR(obdefPath, &defPath, FALSE)) ! return NULL; ! TCHAR pathBuf[MAX_PATH+1]; ! _tcsncpy(pathBuf, defPath, MAX_PATH); pathBuf[MAX_PATH] = '\0'; int rc; *************** *** 850,853 **** --- 901,905 ---- GUI_END_SAVE; + PyWinObject_FreeTCHAR(defPath); if (!rc) RETURN_ERR("DlgDirListComboBox failed"); *************** *** 867,874 **** return NULL; int rc; ! char buf[MAX_PATH]; GUI_BGN_SAVE; #if _MFC_VER >= 0x0800 ! rc = pWnd->DlgDirSelect( buf, sizeof(buf), nIDListBox); #else rc = pWnd->DlgDirSelect( buf, nIDListBox); --- 919,926 ---- return NULL; int rc; ! TCHAR buf[MAX_PATH]; GUI_BGN_SAVE; #if _MFC_VER >= 0x0800 ! rc = pWnd->DlgDirSelect( buf, sizeof(buf)/sizeof(TCHAR), nIDListBox); #else rc = pWnd->DlgDirSelect( buf, nIDListBox); *************** *** 878,883 **** if (!rc) RETURN_ERR("DlgDirSelect failed"); ! return Py_BuildValue("s", buf); } // @pymethod string|PyCWnd|DlgDirSelectComboBox| // Retrieves the current selection from the list box of a combo box. It assumes that the list box has been filled by the <om PyCWnd.DlgDirListComboBox> member function and that the selection is a drive letter, a file, or a directory name. --- 930,936 ---- if (!rc) RETURN_ERR("DlgDirSelect failed"); ! return PyWinObject_FromTCHAR(buf); } + // @pymethod string|PyCWnd|DlgDirSelectComboBox| // Retrieves the current selection from the list box of a combo box. It assumes that the list box has been filled by the <om PyCWnd.DlgDirListComboBox> member function and that the selection is a drive letter, a file, or a directory name. *************** *** 893,901 **** return NULL; int rc; ! char buf[MAX_PATH]; GUI_BGN_SAVE; // @pyseemfc CWnd|DlgDirSelectComboBox #if _MFC_VER >= 0x0800 ! rc = pWnd->DlgDirSelectComboBox( buf, sizeof(buf), nIDListBox); #else rc = pWnd->DlgDirSelectComboBox( buf, nIDListBox); --- 946,954 ---- return NULL; int rc; ! TCHAR buf[MAX_PATH]; GUI_BGN_SAVE; // @pyseemfc CWnd|DlgDirSelectComboBox #if _MFC_VER >= 0x0800 ! rc = pWnd->DlgDirSelectComboBox( buf, sizeof(buf)/sizeof(TCHAR), nIDListBox); #else rc = pWnd->DlgDirSelectComboBox( buf, nIDListBox); *************** *** 904,908 **** if (!rc) RETURN_ERR("DlgDirSelectComboBox failed"); ! return Py_BuildValue("s", buf); } --- 957,961 ---- if (!rc) RETURN_ERR("DlgDirSelectComboBox failed"); ! return PyWinObject_FromTCHAR(buf); } *************** *** 1020,1034 **** { int id; ! char *szText; // @pyparm int|idControl||The Id of the control // @pyparm string|text||The new text ! if (!PyArg_ParseTuple(args, "is:SetDlgItemText", &id, &szText )) return NULL; CWnd *pWnd = GetWndPtrGoodHWnd(self); if (!pWnd) return NULL; GUI_BGN_SAVE; pWnd->SetDlgItemText(id, szText); GUI_END_SAVE; RETURN_NONE; // @pyseemfc CWnd|SetDlgItemText --- 1073,1091 ---- { int id; ! TCHAR *szText; ! PyObject *obText; // @pyparm int|idControl||The Id of the control // @pyparm string|text||The new text ! if (!PyArg_ParseTuple(args, "iO:SetDlgItemText", &id, &obText )) return NULL; CWnd *pWnd = GetWndPtrGoodHWnd(self); if (!pWnd) return NULL; + if (!PyWinObject_AsTCHAR(obText, &szText, FALSE)) + return NULL; GUI_BGN_SAVE; pWnd->SetDlgItemText(id, szText); GUI_END_SAVE; + PyWinObject_FreeTCHAR(szText); RETURN_NONE; // @pyseemfc CWnd|SetDlgItemText *************** *** 1074,1078 **** pWnd->GetDlgItemText(id, csRet); GUI_END_SAVE; ! return PyString_FromString((char *)(const char *)csRet); // @pyseemfc CWnd|GetDlgItemText } --- 1131,1135 ---- pWnd->GetDlgItemText(id, csRet); GUI_END_SAVE; ! return PyWinObject_FromTCHAR(csRet); // @pyseemfc CWnd|GetDlgItemText } *************** *** 1476,1480 **** pWnd->GetWindowText( csText ); GUI_END_SAVE; ! return Py_BuildValue("s",(const char *)csText); } // @pymethod object|PyCWnd|HookKeyStroke|Hook a key stroke handler --- 1533,1537 ---- pWnd->GetWindowText( csText ); GUI_END_SAVE; ! return PyWinObject_FromTCHAR(csText); } // @pymethod object|PyCWnd|HookKeyStroke|Hook a key stroke handler *************** *** 1641,1652 **** ui_window_message_box(PyObject * self, PyObject * args) { ! char *message; long style = MB_OK; - const char *title = NULL; - ! if (!PyArg_ParseTuple(args, "s|zl:MessageBox", ! &message, // @pyparm string|message||The message to be displayed in the message box. ! &title, // @pyparm string/None|title|None|The title for the message box. If None, the applications title will be used. &style)) // @pyparm int|style|win32con.MB_OK|The style of the message box. return NULL; --- 1698,1708 ---- ui_window_message_box(PyObject * self, PyObject * args) { ! TCHAR *message, *title=NULL; ! PyObject *obmessage, *obtitle=Py_None; long style = MB_OK; ! if (!PyArg_ParseTuple(args, "O|Ol:MessageBox", ! &obmessage, // @pyparm string|message||The message to be displayed in the message box. ! &obtitle, // @pyparm string/None|title|None|The title for the message box. If None, the applications title will be used. &style)) // @pyparm int|style|win32con.MB_OK|The style of the message box. return NULL; *************** *** 1654,1657 **** --- 1710,1719 ---- if (!pWnd) return NULL; + if (!PyWinObject_AsTCHAR(obmessage, &message, FALSE)) + return NULL; + if (!PyWinObject_AsTCHAR(obtitle, &title, TRUE)){ + PyWinObject_FreeTCHAR(message); + return NULL; + } int rc; GUI_BGN_SAVE; *************** *** 1659,1662 **** --- 1721,1726 ---- rc = pWnd->MessageBox(message, title, style); + PyWinObject_FreeTCHAR(message); + PyWinObject_FreeTCHAR(title); GUI_END_SAVE; return Py_BuildValue("i",rc); *************** *** 1861,1871 **** { LRESULT res; ! int msg, wParam, lParam; CRect rect; BOOL bRepaint= TRUE; ! if (!PyArg_ParseTuple(args, "iii:OnWndMsg", &msg, // @pyparm int|msg||The message ! (int *)&wParam, // @pyparm int|wParam||The wParam for the message ! (int *)&lParam)) // @pyparm int|lParam||The lParam for the message return NULL; --- 1925,1938 ---- { LRESULT res; ! int msg; ! WPARAM wParam; ! LPARAM lParam; ! PyObject *obwParam, *oblParam; CRect rect; BOOL bRepaint= TRUE; ! if (!PyArg_ParseTuple(args, "iOO:OnWndMsg", &msg, // @pyparm int|msg||The message ! &obwParam, // @pyparm int|wParam||The wParam for the message ! &oblParam)) // @pyparm int|lParam||The lParam for the message return NULL; *************** *** 1873,1876 **** --- 1940,1947 ---- if (!pWnd) return NULL; + if (!PyWinObject_AsPARAM(obwParam, &wParam)) + return NULL; + if (!PyWinObject_AsPARAM(oblParam, &lParam)) + return NULL; GUI_BGN_SAVE; BOOL rc = pWnd->WndHack::OnWndMsg(msg, wParam, lParam, &res ); *************** *** 2185,2191 **** if (!pWnd) return NULL; ! char *msg; // @pyparm string|text||The windows text. ! if (!PyArg_ParseTuple(args, "s:SetWindowText", &msg)) return NULL; // @pyseemfc CWnd|SetWindowText --- 2256,2265 ---- if (!pWnd) return NULL; ! TCHAR *msg; ! PyObject *obmsg; // @pyparm string|text||The windows text. ! if (!PyArg_ParseTuple(args, "O:SetWindowText", &obmsg)) ! return NULL; ! if (!PyWinObject_AsTCHAR(obmsg, &msg, FALSE)) return NULL; // @pyseemfc CWnd|SetWindowText *************** *** 2193,2196 **** --- 2267,2271 ---- pWnd->SetWindowText(msg); GUI_END_SAVE; + PyWinObject_FreeTCHAR(msg); RETURN_NONE; } *************** *** 3263,3268 **** UINT_PTR numMsg = pMessageHookList ? pMessageHookList->GetCount() : 0; UINT_PTR numKey = pKeyHookList ? pKeyHookList->GetCount() : 0; ! char *hookStr = obKeyStrokeHandler ? " (AllKeys Hook Active)" : ""; ! csRet.Format("%s, mh=%Iu, kh=%Iu%s", (const char *)base_repr, numMsg, numKey, hookStr); return csRet; } --- 3338,3343 ---- UINT_PTR numMsg = pMessageHookList ? pMessageHookList->GetCount() : 0; UINT_PTR numKey = pKeyHookList ? pKeyHookList->GetCount() : 0; ! TCHAR *hookStr = obKeyStrokeHandler ? _T(" (AllKeys Hook Active)") : _T(""); ! csRet.Format(_T("%s, mh=%Iu, kh=%Iu%s"), (const TCHAR *)base_repr, numMsg, numKey, hookStr); return csRet; } *************** *** 3324,3333 **** PyObject *obContext = Py_None; PyObject *obMenuID = Py_None; ! char *szClass=NULL, *szTitle=NULL; DWORD styleEx=0; DWORD style = WS_VISIBLE | WS_OVERLAPPEDWINDOW; ! if(!PyArg_ParseTuple(args, "zs|lOOOOl:Create", ! &szClass, // @pyparm string|wndClass||The window class name, or None ! &szTitle, // @pyparm string|title||The window title &style, // @pyparm int|style| WS_VISIBLE \| WS_OVERLAPPEDWINDOW|The window style &obRect, // @pyparm int, int, int, int|rect|None|The default rectangle --- 3399,3409 ---- PyObject *obContext = Py_None; PyObject *obMenuID = Py_None; ! TCHAR *szClass = NULL, *szTitle = NULL, *szMenuName = NULL; ! PyObject *obClass, *obTitle, *ret=NULL; DWORD styleEx=0; DWORD style = WS_VISIBLE | WS_OVERLAPPEDWINDOW; ! if(!PyArg_ParseTuple(args, "OO|lOOOOl:Create", ! &obClass, // @pyparm string|wndClass||The window class name, or None ! &obTitle, // @pyparm string|title||The window title &style, // @pyparm int|style| WS_VISIBLE \| WS_OVERLAPPEDWINDOW|The window style &obRect, // @pyparm int, int, int, int|rect|None|The default rectangle *************** *** 3344,3355 **** pContext = &cc; } ! if (obRect != Py_None) ! { ! if (!PyArg_ParseTuple(obRect, "iiii", &rect.left, &rect.top, &rect.right,&rect.bottom)) ! { ! PyErr_Clear(); ! RETURN_TYPE_ERR("Rect must be None or a tuple of (iiii)"); ! } } CFrameWnd *pParent = NULL; if (obParent != Py_None) --- 3420,3429 ---- pContext = &cc; } ! ! if (obRect != Py_None){ ! if (!PyArg_ParseTuple(obRect, "iiii:RECT", &rect.left, &rect.top, &rect.right,&rect.bottom)) ! return NULL; } + CFrameWnd *pParent = NULL; if (obParent != Py_None) *************** *** 3359,3380 **** RETURN_TYPE_ERR("The parent window is not a valid PyFrameWnd"); } - char *szMenuName = NULL; - if (obMenuID != Py_None) - { - if (PyInt_Check(obMenuID)) - szMenuName = MAKEINTRESOURCE(PyInt_AsLong(obMenuID)); - else if (PyString_Check(obMenuID)) - szMenuName = PyString_AsString(obMenuID); - else - RETURN_TYPE_ERR("The menu id must be an integer or string"); - } ! GUI_BGN_SAVE; ! // @pyseemfc CFrameWnd|Create ! BOOL ok = pFrame->Create(szClass, szTitle, style, rect,pParent,szMenuName,styleEx,pContext); ! GUI_END_SAVE; ! if (!ok) ! RETURN_ERR("CFrameWnd::Create failed"); ! RETURN_NONE; } --- 3433,3456 ---- RETURN_TYPE_ERR("The parent window is not a valid PyFrameWnd"); } ! if (PyWinObject_AsTCHAR(obClass, &szClass, TRUE) ! &&PyWinObject_AsTCHAR(obTitle, &szTitle, FALSE) ! &&PyWinObject_AsResourceId(obMenuID, &szMenuName, TRUE)){ ! BOOL ok; ! GUI_BGN_SAVE; ! // @pyseemfc CFrameWnd|Create ! ok = pFrame->Create(szClass, szTitle, style, rect,pParent,szMenuName,styleEx,pContext); ! GUI_END_SAVE; ! if (!ok) ! PyErr_SetString(ui_module_error, "CFrameWnd::Create failed"); ! else{ ! Py_INCREF(Py_None); ! ret=Py_None; ! } ! } ! PyWinObject_FreeTCHAR(szClass); ! PyWinObject_FreeTCHAR(szTitle); ! PyWinObject_FreeResourceId(szMenuName); ! return ret; } *************** *** 3416,3433 **** if (!PyArg_ParseTuple(args, "O", &obID)) return NULL; ! char *res; ! if (PyInt_Check(obID)) ! res = MAKEINTRESOURCE(PyInt_AsLong(obID)); ! else if (PyString_Check(obID)) ! res = PyString_AsString(obID); ! else ! RETURN_TYPE_ERR("The param must be an integer or string"); GUI_BGN_SAVE; BOOL ok = pFrame->LoadAccelTable(res); GUI_END_SAVE; if (!ok) RETURN_ERR("LoadAccelTable failed"); RETURN_NONE; } // @pymethod |PyCFrameWnd|LoadFrame|Loads a Windows frame window and associated resources static PyObject * --- 3492,3508 ---- if (!PyArg_ParseTuple(args, "O", &obID)) return NULL; ! // @pyparm <o PyResourceId>|id||Name or id of the resource that contains the table ! TCHAR *res; ! if (!PyWinObject_AsResourceId(obID, &res, FALSE)) ! return NULL; GUI_BGN_SAVE; BOOL ok = pFrame->LoadAccelTable(res); GUI_END_SAVE; + PyWinObject_FreeResourceId(res); if (!ok) RETURN_ERR("LoadAccelTable failed"); RETURN_NONE; } + // @pymethod |PyCFrameWnd|LoadFrame|Loads a Windows frame window and associated resources static PyObject * *************** *** 3603,3613 **** if (!pFrame) return NULL; ! char *profileName; ! if (!PyArg_ParseTuple(args,"s:SaveBarState", ! &profileName)) // @pyparm string|profileName||Name of a section in the initialization file or a key in the Windows registry where state information is stored. return NULL; GUI_BGN_SAVE; pFrame->SaveBarState(profileName); // @pyseemfc CFrameWnd|SaveBarState GUI_END_SAVE; RETURN_NONE; } --- 3678,3692 ---- if (!pFrame) return NULL; ! TCHAR *profileName; ! PyObject *obprofileName; ! if (!PyArg_ParseTuple(args,"O:SaveBarState", ! &obprofileName)) // @pyparm string|profileName||Name of a section in the initialization file or a key in the Windows registry where state information is stored. ! return NULL; ! if (!PyWinObject_AsTCHAR(obprofileName, &profileName, FALSE)) return NULL; GUI_BGN_SAVE; pFrame->SaveBarState(profileName); // @pyseemfc CFrameWnd|SaveBarState GUI_END_SAVE; + PyWinObject_FreeTCHAR(profileName); RETURN_NONE; } *************** *** 3620,3626 **** if (!pFrame) return NULL; ! char *profileName; ! if (!PyArg_ParseTuple(args,"s:LoadBarState", ! &profileName)) // @pyparm string|profileName||Name of a section in the initialization file or a key in the Windows registry where state information is stored. return NULL; GUI_BGN_SAVE; --- 3699,3708 ---- if (!pFrame) return NULL; ! TCHAR *profileName; ! PyObject *obprofileName; ! if (!PyArg_ParseTuple(args,"O:LoadBarState", ! &obprofileName)) // @pyparm string|profileName||Name of a section in the initialization file or a key in the Windows registry where state information is stored. ! return NULL; ! if (!PyWinObject_AsTCHAR(obprofileName, &profileName, FALSE)) return NULL; GUI_BGN_SAVE; *************** *** 3630,3636 **** --- 3712,3720 ---- catch (...) { GUI_BLOCK_THREADS; + PyWinObject_FreeTCHAR(profileName); RETURN_ERR("LoadBarState failed (with win32 exception!)"); } GUI_END_SAVE; + PyWinObject_FreeTCHAR(profileName); RETURN_NONE; } *************** *** 3706,3710 **** pFrame->CFrameWnd::GetMessageString(id, csRet); GUI_END_SAVE; ! return Py_BuildValue("s", (const char *)csRet); } --- 3790,3794 ---- pFrame->CFrameWnd::GetMessageString(id, csRet); GUI_END_SAVE; ! return PyWinObject_FromTCHAR(csRet); } *************** *** 4096,4104 **** PyObject *obParent = Py_None; PyObject *obContext = Py_None; ! char *szClass, *szTitle; DWORD style = WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW; ! if (!PyArg_ParseTuple(args, "zs|lOOO:CreateWindow", ! &szClass, // @pyparm string|wndClass||The window class name, or None ! &szTitle, // @pyparm string|title||The window title &style, // @pyparm int|style|WS_CHILD \| WS_VISIBLE \| WS_OVERLAPPEDWINDOW|The window style &obRect, // @pyparm int, int, int, int|rect|None|The default rectangle --- 4180,4189 ---- PyObject *obParent = Py_None; PyObject *obContext = Py_None; ! TCHAR *szClass=NULL, *szTitle=NULL; ! PyObject *obClass, *obTitle; DWORD style = WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW; ! if (!PyArg_ParseTuple(args, "OO|lOOO:CreateWindow", ! &obClass, // @pyparm string|wndClass||The window class name, or None ! &obTitle, // @pyparm string|title||The window title &style, // @pyparm int|style|WS_CHILD \| WS_VISIBLE \| WS_OVERLAPPEDWINDOW|The window style &obRect, // @pyparm int, int, int, int|rect|None|The default rectangle *************** *** 4113,4121 **** } if (obRect != Py_None) { ! if (!PyArg_ParseTuple(obRect, "iiii", &rect.left, &rect.top, &rect.right, &rect.bottom)) { ! PyErr_Clear(); ! RETURN_TYPE_ERR("Rect must be None or a tuple of (iiii)"); } - } CMDIFrameWnd *pParent = NULL; if (obParent != Py_None) { --- 4198,4204 ---- } if (obRect != Py_None) { ! if (!PyArg_ParseTuple(obRect, "iiii:RECT", &rect.left, &rect.top, &rect.right, &rect.bottom)) ! return NULL; } CMDIFrameWnd *pParent = NULL; if (obParent != Py_None) { *************** *** 4125,4131 **** --- 4208,4223 ---- } + if (!PyWinObject_AsTCHAR(obClass, &szClass, TRUE)) + return NULL; + if (!PyWinObject_AsTCHAR(obTitle, &szTitle, FALSE)){ + PyWinObject_FreeTCHAR(szClass); + return NULL; + } + GUI_BGN_SAVE; BOOL ok = pWnd->Create(szClass, szTitle, style, rect, pParent, pContext); GUI_END_SAVE; + PyWinObject_FreeTCHAR(szClass); + PyWinObject_FreeTCHAR(szTitle); if (!ok) RETURN_ERR("CMDIChildWnd::Create"); Index: win32uioledoc.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uioledoc.h,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** win32uioledoc.h 1 Sep 1999 23:33:03 -0000 1.1 --- win32uioledoc.h 29 Aug 2008 05:53:30 -0000 1.1.4.1 *************** *** 12,13 **** --- 12,24 ---- static ui_type_CObject type; }; + + class PyCOleClientItem : public PyCCmdTarget { + protected: + PyCOleClientItem() {;} + ~PyCOleClientItem() {;} + public: + static COleClientItem *GetOleClientItem(PyObject *self); + + MAKE_PY_CTOR(PyCOleClientItem); + static ui_type_CObject type; + }; \ No newline at end of file Index: win32assoc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32assoc.cpp,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** win32assoc.cpp 24 Feb 2008 16:06:09 -0000 1.9 --- win32assoc.cpp 29 Aug 2008 05:53:29 -0000 1.9.2.1 *************** *** 28,35 **** { #ifdef _DEBUG ! char buf[256]; if (cacheLookups) { // cant use TRACE, as CWinApp may no longer be valid. ! wsprintf(buf, "AssocManager cache hit ratio is %d percent\n", cacheHits * 100 / cacheLookups); OutputDebugString(buf); } --- 28,35 ---- { #ifdef _DEBUG ! TCHAR buf[256]; if (cacheLookups) { // cant use TRACE, as CWinApp may no longer be valid. ! wsprintf(buf, _T("AssocManager cache hit ratio is %d percent\n"), cacheHits * 100 / cacheLookups); OutputDebugString(buf); } *************** *** 107,115 **** // and auto-convert it to the classes AttachedObject. if (ui_type_check && !is_uiobject(self, ui_type_check)) { - CString csRet = "object is not a "; - csRet += ui_type_check->tp_name; TRACE("GetGoodCppObject fails RTTI\n"); ! const char *ret = csRet; ! RETURN_TYPE_ERR((char *)ret); } ui_assoc_object *s = (ui_assoc_object *)self; --- 107,112 ---- // and auto-convert it to the classes AttachedObject. if (ui_type_check && !is_uiobject(self, ui_type_check)) { TRACE("GetGoodCppObject fails RTTI\n"); ! return PyErr_Format(PyExc_TypeError, "object is not a %s", ui_type_check->tp_name); } ui_assoc_object *s = (ui_assoc_object *)self; *************** *** 295,304 **** { CString csRet; ! PyObject *vi_repr = virtualInst ? PyObject_Repr(virtualInst) : NULL; ! // sprintf(buf, " - assoc is %p, vi=%s", assoc, vi_repr ? PyString_AsString(vi_repr) : "<None>" ); ! csRet.Format(" - assoc is %p, vi=%s", assoc, vi_repr ? PyString_AsString(vi_repr) : "<None>" ); ! Py_XDECREF(vi_repr); return ui_base_class::repr() + csRet; } #ifdef _DEBUG void ui_assoc_object::Dump( CDumpContext &dc ) const --- 292,324 ---- { CString csRet; ! static TCHAR *no_repr=_T("<None>"); ! TCHAR *py_repr=NULL; ! BOOL bfree_repr=FALSE; ! ! if (virtualInst == NULL) ! py_repr=no_repr; ! else ! py_repr=_T("??? some object ???"); ! // else{ ! /* PyObject_Repr or PyObject_Str will cause an infinite loop here, since subclasses will inherit ! *this* repr if they don't define __repr__, ! */ ! /* ! PyObject *vi_repr=PyObject_Str(virtualInst); ! if (vi_repr==NULL || !PyWinObject_AsTCHAR(vi_repr, &py_repr, FALSE)){ ! PyErr_Clear(); ! py_repr=no_repr; ! } ! else ! bfree_repr=TRUE; ! Py_XDECREF(vi_repr); ! } ! */ ! csRet.Format(_T(" - assoc is %p, vi=%s"), assoc, py_repr); ! if (bfree_repr) ! PyWinObject_FreeTCHAR(py_repr); return ui_base_class::repr() + csRet; } + #ifdef _DEBUG void ui_assoc_object::Dump( CDumpContext &dc ) const Index: win32ctrlRichEdit.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ctrlRichEdit.cpp,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** win32ctrlRichEdit.cpp 3 Jun 2007 12:35:58 -0000 1.4 --- win32ctrlRichEdit.cpp 29 Aug 2008 05:53:29 -0000 1.4.2.1 *************** *** 424,428 **** // and handle worst case, and look what happens! CString csBuffer; // use dynamic mem for buffer ! char *buf; int bytesCopied; // this TRACE _always_ returns the length of the first line - hence the --- 424,428 ---- // and handle worst case, and look what happens! CString csBuffer; // use dynamic mem for buffer ! TCHAR *buf; int bytesCopied; // this TRACE _always_ returns the length of the first line - hence the *************** *** 450,454 **** // --bytesCopied; buf[bytesCopied] = '\0'; ! return Py_BuildValue("s",buf); } --- 450,454 ---- // --bytesCopied; buf[bytesCopied] = '\0'; ! return PyWinObject_FromTCHAR(buf); } *************** *** 470,480 **** { CRichEditCtrl *pEdit = GetRichEditCtrl(self); ! char *msg; // @pyparm string|text||The text to replace the selection with. ! if (!pEdit || !PyArg_ParseTuple(args, "s:ReplaceSel", &msg)) return NULL; GUI_BGN_SAVE; pEdit->ReplaceSel(msg); // @pyseemfc CRichEditCtrl|ReplaceSel GUI_END_SAVE; RETURN_NONE; } --- 470,484 ---- { CRichEditCtrl *pEdit = GetRichEditCtrl(self); ! TCHAR *msg; ! PyObject *obmsg; // @pyparm string|text||The text to replace the selection with. ! if (!pEdit ! || !PyArg_ParseTuple(args, "O:ReplaceSel", &obmsg) ! || !PyWinObject_AsTCHAR(obmsg, &msg, FALSE)) return NULL; GUI_BGN_SAVE; pEdit->ReplaceSel(msg); // @pyseemfc CRichEditCtrl|ReplaceSel GUI_END_SAVE; + PyWinObject_FreeTCHAR(msg); RETURN_NONE; } Index: win32view.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32view.cpp,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** win32view.cpp 14 Feb 2008 19:05:23 -0000 1.4 --- win32view.cpp 29 Aug 2008 05:53:30 -0000 1.4.2.1 *************** *** 186,191 **** return NULL; - PyErr_Clear(); CView *pActivate = obActivate==Py_None ? NULL : PyCView::GetViewPtr (obActivate); CView *pDevactive = obDeactivate==Py_None ? NULL : PyCView::GetViewPtr (obDeactivate); if (PyErr_Occurred()) --- 186,192 ---- return NULL; CView *pActivate = obActivate==Py_None ? NULL : PyCView::GetViewPtr (obActivate); + if (PyErr_Occurred()) + return NULL; CView *pDevactive = obDeactivate==Py_None ? NULL : PyCView::GetViewPtr (obDeactivate); if (PyErr_Occurred()) *************** *** 640,649 **** { PyObject *doc; ! char *szClass; int style=0; // @pyparm <o PyCDocument>|doc||The document. // @pyparm string|className||The class name of the control // @pyparm int|style|0|Additional style bits ! if (!PyArg_ParseTuple(args, "Os|i:CreateCtrlView", &doc, &szClass, &style)) return NULL; if (!ui_base_class::is_uiobject(doc, &PyCDocument::type)) --- 641,651 ---- { PyObject *doc; ! TCHAR *szClass; ! PyObject *obClass; int style=0; // @pyparm <o PyCDocument>|doc||The document. // @pyparm string|className||The class name of the control // @pyparm int|style|0|Additional style bits ! if (!PyArg_ParseTuple(args, "OO|i:CreateCtrlView", &doc, &obClass, &style)) return NULL; if (!ui_base_class::is_uiobject(doc, &PyCDocument::type)) *************** *** 651,658 **** --- 653,663 ---- CDocument *pDoc = PyCDocument::GetDoc( doc ); CCtrlView *pView; + if (!PyWinObject_AsTCHAR(obClass, &szClass, FALSE)) + return NULL; GUI_BGN_SAVE; pView = new CPythonCtrlView(szClass, style); ((CProtectedView *)pView)->SetDocument(pDoc); GUI_END_SAVE; + PyWinObject_FreeTCHAR(szClass); return ui_assoc_object::make( PyCCtrlView::type, pView, TRUE ); } *************** *** 682,686 **** GET_PY_CTOR(PyCCtrlView)); ! /* Implement an psuedo-inheritance for ControlView */ PyObject * PyCCtrlView::getattr(char *name) --- 687,692 ---- GET_PY_CTOR(PyCCtrlView)); ! /* Inheritance from PyCView and control type is now done via tp_bases */ ! /* PyObject * PyCCtrlView::getattr(char *name) *************** *** 696,699 **** --- 702,706 ---- return retMethod; } + */ ///////////////////////////////////////////////////////////////////// *************** *** 766,772 **** ui_edit_window_load_file(PyObject *self, PyObject *args) { ! char *fileName; // @pyparm string|fileName||The name of the file to be loaded. ! if (!PyArg_ParseTuple(args, "s:LoadFile", &fileName)) return NULL; --- 773,781 ---- ui_edit_window_load_file(PyObject *self, PyObject *args) { ! USES_CONVERSION; ! TCHAR *fileName; ! PyObject *obfileName; // @pyparm string|fileName||The name of the file to be loaded. ! if (!PyArg_ParseTuple(args, "O:LoadFile", &obfileName)) return NULL; *************** *** 774,789 **** if (!(pView=GetEditViewPtr(self))) return NULL; ! CFile file; CFileException fe; if (!file.Open(fileName, CFile::modeRead | CFile::shareDenyWrite, &fe)) { long errCode = fe.m_lOsError; CString csMessage = GetAPIErrorString(errCode); ! if (csMessage.GetLength()) ! PyErr_SetString(PyExc_IOError, (char *)(const char *)csMessage); else PyErr_SetString(PyExc_IOError, "Unknown IO error?"); return NULL; } GUI_BGN_SAVE; pView->DeleteContents(); --- 783,805 ---- if (!(pView=GetEditViewPtr(self))) return NULL; ! if (!PyWinObject_AsTCHAR(obfileName, &fileName, FALSE)) ! return NULL; CFile file; CFileException fe; if (!file.Open(fileName, CFile::modeRead | CFile::shareDenyWrite, &fe)) { + PyWinObject_FreeTCHAR(fileName); long errCode = fe.m_lOsError; CString csMessage = GetAPIErrorString(errCode); ! if (csMessage.GetLength()){ ! LPTSTR msg=csMessage.GetBuffer(csMessage.GetLength()); ! PyErr_SetString(PyExc_IOError, T2A(msg)); ! csMessage.ReleaseBuffer(); ! } else PyErr_SetString(PyExc_IOError, "Unknown IO error?"); return NULL; } + PyWinObject_FreeTCHAR(fileName); + GUI_BGN_SAVE; pView->DeleteContents(); *************** *** 819,825 **** ui_edit_window_save_file(PyObject *self, PyObject *args) { ! char *fileName; // @pyparm string|fileName||The name of the file to be written. ! if (!PyArg_ParseTuple(args, "s:SaveFile", &fileName)) return NULL; --- 835,843 ---- ui_edit_window_save_file(PyObject *self, PyObject *args) { ! USES_CONVERSION; ! TCHAR *fileName; ! PyObject *obfileName; // @pyparm string|fileName||The name of the file to be written. ! if (!PyArg_ParseTuple(args, "O:SaveFile", &obfileName)) return NULL; *************** *** 828,840 **** return NULL; CFile file; CFileException fe; - if (!file.Open(fileName, CFile::modeCreate | CFile::modeReadWrite | CFile::shareExclusive, &fe)) { long errCode = fe.m_lOsError; CString csMessage = GetAPIErrorString(errCode); ! if (csMessage.GetLength()) ! PyErr_SetString(PyExc_IOError, (char *)(const char *)csMessage); else PyErr_SetString(PyExc_IOError, "Unknown IO error?"); --- 846,862 ---- return NULL; + if (!PyWinObject_AsTCHAR(obfileName, &fileName, FALSE)) + return NULL; CFile file; CFileException fe; if (!file.Open(fileName, CFile::modeCreate | CFile::modeReadWrite | CFile::shareExclusive, &fe)) { long errCode = fe.m_lOsError; CString csMessage = GetAPIErrorString(errCode); ! if (csMessage.GetLength()){ ! LPTSTR msg=csMessage.GetBuffer(csMessage.GetLength()); ! PyErr_SetString(PyExc_IOError, T2A(msg)); ! csMessage.ReleaseBuffer(); ! } else PyErr_SetString(PyExc_IOError, "Unknown IO error?"); *************** *** 865,868 **** --- 887,891 ---- if (pDocument) pDocument->SetModifiedFlag(FALSE); // start off with unmodified + PyWinObject_FreeTCHAR(fileName); GUI_END_SAVE; RETURN_NONE; *************** *** 997,1001 **** PyCCtrlView_Type PyCListView::type("PyCListView", &PyCCtrlView::type, // @base PyCListView|PyCCtrlView ! &PyCListCtrl::type, RUNTIME_CLASS(CListView), sizeof(PyCListView), --- 1020,1024 ---- PyCCtrlView_Type PyCListView::type("PyCListView", &PyCCtrlView::type, // @base PyCListView|PyCCtrlView ! &PyCListCtrl::type, // ??? need to add this to tp_bases so PyCListView inherits PyCListCtrl methods ??? RUNTIME_CLASS(CListView), sizeof(PyCListView), *************** *** 1096,1123 **** PyObject * PyCFormView::create(PyObject *self, PyObject *args) { ! PyObject *doc; ! char *szTemplate = NULL; ! int iTemplate; // @pyparm <o PyCDocument>|doc||The document to use with the view. ! // @pyparm int|iTemplate||The ID of the dialog control. ! if (!PyArg_ParseTuple(args, "Oi:CreateFormView", &doc, &iTemplate)) { ! PyErr_Clear(); ! // @pyparmalt1 <o PyCDocument>|doc||The document to use with the view. ! // @pyparmalt1 string|template||The ID of the dialog control. ! if (!PyArg_ParseTuple(args, "Os:CreateFormView", &doc, &szTemplate)) ! return NULL; ! } if (!ui_base_class::is_uiobject(doc, &PyCDocument::type)) RETURN_TYPE_ERR("Argument must be a PyCDocument"); CDocument *pDoc = PyCDocument::GetDoc( doc ); CFormView *pView; ! GUI_BGN_SAVE; ! if (szTemplate) ! pView = new CPythonFormView(szTemplate); else ! pView = new CPythonFormView(iTemplate); ((CProtectedView *)pView)->SetDocument(pDoc); GUI_END_SAVE; return ui_assoc_object::make( PyCFormView::type, pView, TRUE ); } --- 1119,1144 ---- PyObject * PyCFormView::create(PyObject *self, PyObject *args) { ! PyObject *doc, *obTemplate; ! TCHAR *szTemplate = NULL; // @pyparm <o PyCDocument>|doc||The document to use with the view. ! // @pyparm int/str|Template||Name or ID of the dialog template resource ! if (!PyArg_ParseTuple(args, "OO:CreateFormView", &doc, &obTemplate)) ! return NULL; ! if (!ui_base_class::is_uiobject(doc, &PyCDocument::type)) RETURN_TYPE_ERR("Argument must be a PyCDocument"); CDocument *pDoc = PyCDocument::GetDoc( doc ); CFormView *pView; ! if (!PyWinObject_AsResourceId(obTemplate, &szTemplate)) ! return NULL; ! GUI_BGN_SAVE; ! if (IS_INTRESOURCE(szTemplate)) ! pView = new CPythonFormView(MAKEINTRESOURCE(szTemplate)); else ! pView = new CPythonFormView(szTemplate); ((CProtectedView *)pView)->SetDocument(pDoc); GUI_END_SAVE; + PyWinObject_FreeResourceId(szTemplate); return ui_assoc_object::make( PyCFormView::type, pView, TRUE ); } Index: win32dlg.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32dlg.cpp,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -C2 -d -r1.10 -r1.10.2.1 *** win32dlg.cpp 12 Feb 2008 19:26:13 -0000 1.10 --- win32dlg.cpp 29 Aug 2008 05:53:29 -0000 1.10.2.1 *************** *** 87,97 **** if (hGlob==NULL) RETURN_API_ERR("LoadResource"); - - CDialog *pDlg = new CPythonDlg(); - PyCDialog *ret = (PyCDialog *)ui_assoc_object::make( PyCDialog::type, pDlg, TRUE); - if (ret) { - ret->hTemplate = hGlob; - ret->hInstance = hMod; - } return MakeDlgListFromResource(hGlob); } --- 87,90 ---- *************** *** 199,214 **** } PyObject * ! PyCDialog::getattr(char *name) { if (strcmp(name,"data")==0) { Py_INCREF(dddict); return dddict; ! } ! else if (strcmp(name,"datalist")==0) { Py_INCREF(ddlist); return ddlist; ! } ! else ! return ui_base_class::getattr(name); } --- 192,207 ---- } PyObject * ! PyCDialog::getattro(PyObject *obname) { + char *name=PYWIN_ATTR_CONVERT(obname); if (strcmp(name,"data")==0) { Py_INCREF(dddict); return dddict; ! } ! if (strcmp(name,"datalist")==0) { Py_INCREF(ddlist); return ddlist; ! } ! return PyObject_GenericGetAttr(this, obname); } *************** *** 216,220 **** { static char errBuf[256]; ! wsprintf(errBuf, "Data exchange list index %d - %s", index, msg); PyErr_SetString(PyExc_TypeError,errBuf); return NULL; --- 209,213 ---- { static char errBuf[256]; ! snprintf(errBuf, 256, "Data exchange list index %d - %s", index, msg); PyErr_SetString(PyExc_TypeError,errBuf); return NULL; *************** *** 242,249 **** } case 's': { ! char *strVal = NULL; ! if (oldVal && PyString_Check(oldVal)) ! strVal = PyString_AsString(oldVal); ! CString csVal(strVal?strVal:""); GUI_BGN_SAVE; DDX_Text(pDX, id, csVal); --- 235,248 ---- } case 's': { ! CString csVal; ! TCHAR *strVal = NULL; ! if (PyWinObject_AsTCHAR(oldVal, &strVal, TRUE)){ ! csVal=strVal; ! PyWinObject_FreeTCHAR(strVal); ! } ! else{ ! PyErr_Clear(); ! csVal=_T(""); ! } GUI_BGN_SAVE; DDX_Text(pDX, id, csVal); *************** *** 255,259 **** return set_exchange_error("Edit - must be tuple of control_id, key, 's', maxLength", index); } ! newOb = Py_BuildValue("s", (const char *)csVal); break; } --- 254,258 ---- return set_exchange_error("Edit - must be tuple of control_id, key, 's', maxLength", index); } ! newOb = PyWinObject_FromTCHAR(csVal); break; } *************** *** 290,299 **** } case 's': { ! char *strVal = NULL; ! if (oldVal && oldVal != Py_None) { ! if (!PyString_Check(oldVal)) return set_exchange_error("'s' format requires strings", index); ! strVal = PyString_AsString(oldVal); ! } ! CString csVal(strVal?strVal:""); GUI_BGN_SAVE; if (bList) --- 289,298 ---- } case 's': { ! TCHAR *strVal = NULL; ! if (!PyWinObject_AsTCHAR(oldVal, &strVal, TRUE)) ! return set_exchange_error("'s' format requires strings", index); ! CString csVal(strVal ? strVal : _T("")); ! PyWinObject_FreeTCHAR(strVal); ! GUI_BGN_SAVE; if (bList) *************** *** 302,315 **** DDX_CBString(pDX, id, csVal); GUI_END_SAVE; ! newOb = Py_BuildValue("s", (const char *)csVal); break; } case 'S': { ! char *strVal = NULL; ! if (oldVal && oldVal != Py_None) { ! if (!PyString_Check(oldVal)) return set_exchange_error("'S' format requires strings", index); ! strVal = PyString_AsString(oldVal); ! } ! CString csVal(strVal?strVal:""); GUI_BGN_SAVE; if (bList) --- 301,313 ---- DDX_CBString(pDX, id, csVal); GUI_END_SAVE; ! newOb = PyWinObject_FromTCHAR(csVal); break; } case 'S': { ! TCHAR *strVal = NULL; ! if (!PyWinObject_AsTCHAR(oldVal, &strVal, TRUE)) ! return set_exchange_error("'S' form... [truncated message content] |
From: Roger U. <ru...@us...> - 2008-08-29 05:45:51
|
Update of /cvsroot/pywin32/pywin32/SWIG In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4116 Modified Files: Tag: py3k swig.exe Log Message: Generate python 3.0 module init functions (does not handle com_interface_parent yet) Should probably add the source to CVS. Index: swig.exe =================================================================== RCS file: /cvsroot/pywin32/pywin32/SWIG/swig.exe,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 Binary files /tmp/cvs7kKrK2 and /tmp/cvsA7hthE differ |
From: Roger U. <ru...@us...> - 2008-08-29 05:41:31
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2340 Modified Files: Tag: py3k setup.py Log Message: Changes for py3k, set all modules to UNICODE (still needs more work though) Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.81 retrieving revision 1.81.2.1 diff -C2 -d -r1.81 -r1.81.2.1 *** setup.py 9 Aug 2008 01:53:01 -0000 1.81 --- setup.py 29 Aug 2008 05:41:39 -0000 1.81.2.1 *************** *** 71,82 **** import types, glob import re ! import _winreg - # Python version compatibility hacks - try: - True; False - except NameError: - True=0==0 - False=1==0 # The rest of our imports. --- 71,76 ---- import types, glob import re ! import winreg # The rest of our imports. *************** *** 104,110 **** class Log: def debug(self, msg, *args): ! print msg % args def info(self, msg, *args): ! print msg % args log = Log() --- 98,104 ---- class Log: def debug(self, msg, *args): ! print (msg % args) def info(self, msg, *args): ! print (msg % args) log = Log() *************** *** 122,126 **** pywin32_version="%d.%d.%s" % (sys.version_info[0], sys.version_info[1], build_id_patch) ! print "Building pywin32", pywin32_version try: --- 116,120 ---- pywin32_version="%d.%d.%s" % (sys.version_info[0], sys.version_info[1], build_id_patch) ! print ("Building pywin32", pywin32_version) try: *************** *** 151,155 **** if sdkdir: if DEBUG: ! print "PSDK: try %MSSdk%: '%s'" % sdkdir if os.path.isfile(os.path.join(sdkdir, landmark)): return sdkdir --- 145,149 ---- if sdkdir: if DEBUG: ! print ("PSDK: try %MSSdk%: '%s'" % sdkdir) if os.path.isfile(os.path.join(sdkdir, landmark)): return sdkdir *************** *** 159,171 **** # the "Platform SDK for Windows Server 2003 SP1" this is dead end. try: ! key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r"Software\Microsoft\MicrosoftSDK\Directories") ! sdkdir, ignore = _winreg.QueryValueEx(key, "Install Dir") except EnvironmentError: pass else: if DEBUG: ! print r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDK"\ ! "\Directories\Install Dir': '%s'" % sdkdir if os.path.isfile(os.path.join(sdkdir, landmark)): return sdkdir --- 153,165 ---- # the "Platform SDK for Windows Server 2003 SP1" this is dead end. try: ! key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"Software\Microsoft\MicrosoftSDK\Directories") ! sdkdir, ignore = winreg.QueryValueEx(key, "Install Dir") except EnvironmentError: pass else: if DEBUG: ! print (r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDK"\ ! "\Directories\Install Dir': '%s'" % sdkdir) if os.path.isfile(os.path.join(sdkdir, landmark)): return sdkdir *************** *** 175,193 **** # only one with an "Install Dir" sub-value. try: ! key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r"Software\Microsoft\MicrosoftSDK\InstalledSDKs") i = 0 while True: ! guid = _winreg.EnumKey(key, i) ! guidkey = _winreg.OpenKey(key, guid) try: ! sdkdir, ignore = _winreg.QueryValueEx(guidkey, "Install Dir") except EnvironmentError: pass else: if DEBUG: ! print r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDK"\ "\InstallSDKs\%s\Install Dir': '%s'"\ ! % (guid, sdkdir) if os.path.isfile(os.path.join(sdkdir, landmark)): return sdkdir --- 169,187 ---- # only one with an "Install Dir" sub-value. try: ! key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"Software\Microsoft\MicrosoftSDK\InstalledSDKs") i = 0 while True: ! guid = winreg.EnumKey(key, i) ! guidkey = winreg.OpenKey(key, guid) try: ! sdkdir, ignore = winreg.QueryValueEx(guidkey, "Install Dir") except EnvironmentError: pass else: if DEBUG: ! print (r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDK"\ "\InstallSDKs\%s\Install Dir': '%s'"\ ! % (guid, sdkdir)) if os.path.isfile(os.path.join(sdkdir, landmark)): return sdkdir *************** *** 197,209 **** # 4. Vista's SDK try: ! key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r"Software\Microsoft\Microsoft SDKs\Windows") ! sdkdir, ignore = _winreg.QueryValueEx(key, "CurrentInstallFolder") except EnvironmentError: pass else: if DEBUG: ! print r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDKs"\ ! "\Windows\CurrentInstallFolder': '%s'" % sdkdir if os.path.isfile(os.path.join(sdkdir, landmark)): return sdkdir --- 191,203 ---- # 4. Vista's SDK try: ! key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"Software\Microsoft\Microsoft SDKs\Windows") ! sdkdir, ignore = winreg.QueryValueEx(key, "CurrentInstallFolder") except EnvironmentError: pass else: if DEBUG: ! print (r"PSDK: try 'HKLM\Software\Microsoft\MicrosoftSDKs"\ ! "\Windows\CurrentInstallFolder': '%s'" % sdkdir) if os.path.isfile(os.path.join(sdkdir, landmark)): return sdkdir *************** *** 217,221 **** for sdkdir in defaultlocs: if DEBUG: ! print "PSDK: try default location: '%s'" % sdkdir if os.path.isfile(os.path.join(sdkdir, landmark)): return sdkdir --- 211,215 ---- for sdkdir in defaultlocs: if DEBUG: ! print ("PSDK: try default location: '%s'" % sdkdir) if os.path.isfile(os.path.join(sdkdir, landmark)): return sdkdir *************** *** 293,302 **** result = [] for line in open(path).readlines(): ! line = string.rstrip(line) if line and line[0] in string.whitespace: ! tokens = string.split(line) ! if not tokens[0][0] in string.letters: continue ! result.append(string.join(tokens, ',')) return result --- 287,296 ---- result = [] for line in open(path).readlines(): ! line = line.rstrip() if line and line[0] in string.whitespace: ! tokens = line.split() ! if not tokens[0][0] in string.ascii_letters: continue ! result.append(','.join(tokens)) return result *************** *** 390,394 **** class WinExt_pythonwin(WinExt): def __init__ (self, name, **kw): ! if not kw.has_key("dsp_file") and not kw.get("sources"): kw["dsp_file"] = "pythonwin/" + name + ".dsp" kw.setdefault("extra_compile_args", []).extend( --- 384,388 ---- class WinExt_pythonwin(WinExt): def __init__ (self, name, **kw): ! if "dsp_file" not in kw and not kw.get("sources"): kw["dsp_file"] = "pythonwin/" + name + ".dsp" kw.setdefault("extra_compile_args", []).extend( *************** *** 400,404 **** class WinExt_win32(WinExt): def __init__ (self, name, **kw): ! if not kw.has_key("dsp_file") and not kw.get("sources"): kw["dsp_file"] = "win32/" + name + ".dsp" WinExt.__init__(self, name, **kw) --- 394,398 ---- class WinExt_win32(WinExt): def __init__ (self, name, **kw): ! if "dsp_file" not in kw and not kw.get("sources"): kw["dsp_file"] = "win32/" + name + ".dsp" WinExt.__init__(self, name, **kw) *************** *** 414,418 **** class WinExt_win32com(WinExt): def __init__ (self, name, **kw): ! if not kw.has_key("dsp_file") and not kw.get("sources"): kw["dsp_file"] = "com/" + name + ".dsp" kw["libraries"] = kw.get("libraries", "") + " oleaut32 ole32" --- 408,412 ---- class WinExt_win32com(WinExt): def __init__ (self, name, **kw): ! if "dsp_file" not in kw and not kw.get("sources"): kw["dsp_file"] = "com/" + name + ".dsp" kw["libraries"] = kw.get("libraries", "") + " oleaut32 ole32" *************** *** 437,445 **** libs = kw.get("libraries", "") keyname = "SOFTWARE\Microsoft\Exchange\SDK" ! for root in _winreg.HKEY_LOCAL_MACHINE, _winreg.HKEY_CURRENT_USER: try: ! keyob = _winreg.OpenKey(root, keyname) ! value, type_id = _winreg.QueryValueEx(keyob, "INSTALLDIR") ! if type_id == _winreg.REG_SZ: sdk_install_dir = value break --- 431,439 ---- libs = kw.get("libraries", "") keyname = "SOFTWARE\Microsoft\Exchange\SDK" ! for root in winreg.HKEY_LOCAL_MACHINE, winreg.HKEY_CURRENT_USER: try: ! keyob = winreg.OpenKey(root, keyname) ! value, type_id = winreg.QueryValueEx(keyob, "INSTALLDIR") ! if type_id == winreg.REG_SZ: sdk_install_dir = value break *************** *** 479,484 **** f.write("%s\n" % build_id) f.close() ! except EnvironmentError, why: ! print "Failed to open '%s': %s" % (ver_fname, why) class my_build_ext(build_ext): --- 473,478 ---- f.write("%s\n" % build_id) f.close() ! except EnvironmentError as why: ! print ("Failed to open '%s': %s" % (ver_fname, why)) class my_build_ext(build_ext): *************** *** 632,636 **** break else: ! raise RuntimeError, "Can't find a version in Windows.h" if ext.windows_h_version > self.windows_h_version: return "WINDOWS.H with version 0x%x is required, but only " \ --- 626,630 ---- break else: ! raise RuntimeError("Can't find a version in Windows.h") if ext.windows_h_version > self.windows_h_version: return "WINDOWS.H with version 0x%x is required, but only " \ *************** *** 742,746 **** self.package = ext.get_pywin32_dir() except AttributeError: ! raise RuntimeError, "Not a win32 package!" self.build_extension(ext) --- 736,740 ---- self.package = ext.get_pywin32_dir() except AttributeError: ! raise RuntimeError("Not a win32 package!") self.build_extension(ext) *************** *** 751,755 **** self.excluded_extensions.append((ext, why)) assert why, "please give a reason, or None" ! print "Skipping %s: %s" % (ext.name, why) continue --- 745,749 ---- self.excluded_extensions.append((ext, why)) assert why, "please give a reason, or None" ! print ("Skipping %s: %s" % (ext.name, why)) continue *************** *** 757,761 **** self.package = ext.get_pywin32_dir() except AttributeError: ! raise RuntimeError, "Not a win32 package!" self.build_exefile(ext) --- 751,755 ---- self.package = ext.get_pywin32_dir() except AttributeError: ! raise RuntimeError("Not a win32 package!") self.build_exefile(ext) *************** *** 788,797 **** src = os.path.join(os.environ.get('SystemRoot'), 'System32', 'mfc71.dll') if not os.path.isfile(src): ! raise RuntimeError, "Can't find %r" % (src,) self.copy_file(src, target_dir) else: # On a 64bit host, the value we are looking for is actually in # SysWow64Node - but that is only available on xp and later. ! access = _winreg.KEY_READ if sys.getwindowsversion()[0] >= 5: access = access | 512 # KEY_WOW64_32KEY --- 782,791 ---- src = os.path.join(os.environ.get('SystemRoot'), 'System32', 'mfc71.dll') if not os.path.isfile(src): ! raise RuntimeError("Can't find %r" % (src,)) self.copy_file(src, target_dir) else: # On a 64bit host, the value we are looking for is actually in # SysWow64Node - but that is only available on xp and later. ! access = winreg.KEY_READ if sys.getwindowsversion()[0] >= 5: access = access | 512 # KEY_WOW64_32KEY *************** *** 801,817 **** plat_dir = "x86" # Find the redist directory. ! vckey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VC", access) ! val, val_typ = _winreg.QueryValueEx(vckey, "ProductDir") mfc_dir = os.path.join(val, "redist", plat_dir, "Microsoft.VC90.MFC") if not os.path.isdir(mfc_dir): ! raise RuntimeError, "Can't find the redist dir at %r" % (mfc_dir) files = "mfc90.dll mfc90u.dll mfcm90.dll mfcm90u.dll Microsoft.VC90.MFC.manifest".split() for f in files: self.copy_file( os.path.join(mfc_dir, f), target_dir) ! except (EnvironmentError, RuntimeError), exc: ! print "Can't find an installed VC for the MFC DLLs:", exc --- 795,811 ---- plat_dir = "x86" # Find the redist directory. ! vckey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VC", access) ! val, val_typ = winreg.QueryValueEx(vckey, "ProductDir") mfc_dir = os.path.join(val, "redist", plat_dir, "Microsoft.VC90.MFC") if not os.path.isdir(mfc_dir): ! raise RuntimeError("Can't find the redist dir at %r" % (mfc_dir)) files = "mfc90.dll mfc90u.dll mfcm90.dll mfcm90u.dll Microsoft.VC90.MFC.manifest".split() for f in files: self.copy_file( os.path.join(mfc_dir, f), target_dir) ! except (EnvironmentError, RuntimeError) as exc: ! print ("Can't find an installed VC for the MFC DLLs:", exc) *************** *** 820,827 **** sources = ext.sources if sources is None or type(sources) not in (ListType, TupleType): ! raise DistutilsSetupError, \ ("in 'ext_modules' option (extension '%s'), " + "'sources' must be present and must be " + ! "a list of source filenames") % ext.name sources = list(sources) --- 814,821 ---- sources = ext.sources if sources is None or type(sources) not in (ListType, TupleType): ! raise DistutilsSetupError( ("in 'ext_modules' option (extension '%s'), " + "'sources' must be present and must be " + ! "a list of source filenames") % ext.name) sources = list(sources) *************** *** 940,944 **** self.excluded_extensions.append((ext, why)) assert why, "please give a reason, or None" ! print "Skipping %s: %s" % (ext.name, why) return self.current_extension = ext --- 934,938 ---- self.excluded_extensions.append((ext, why)) assert why, "please give a reason, or None" ! print ("Skipping %s: %s" % (ext.name, why)) return self.current_extension = ext *************** *** 995,1000 **** elif name.endswith("win32.perfmondata"): return r"win32\perfmondata" + extra_dll - elif name.endswith("win32.win32popenWin9x"): - return r"win32\win32popenWin9x" + extra_exe elif name.endswith("win32.pythonservice"): return r"win32\pythonservice" + extra_exe --- 989,992 ---- *************** *** 1114,1118 **** # process so the child will wait for us. # XXX - hmm - a closer look at distutils shows it only uses win32api ! # if _winreg fails - and this never should. Need to revisit this! # If self.root has a value, it means we are being "installed" into # some other directory than Python itself (eg, into a temp directory --- 1106,1110 ---- # process so the child will wait for us. # XXX - hmm - a closer look at distutils shows it only uses win32api ! # if winreg fails - and this never should. Need to revisit this! # If self.root has a value, it means we are being "installed" into # some other directory than Python itself (eg, into a temp directory *************** *** 1123,1128 **** filename = os.path.join(os.path.dirname(this_file), "pywin32_postinstall.py") if not os.path.isfile(filename): ! raise RuntimeError, "Can't find '%s'" % (filename,) ! print "Executing post install script..." os.spawnl(os.P_NOWAIT, sys.executable, sys.executable, filename, --- 1115,1120 ---- filename = os.path.join(os.path.dirname(this_file), "pywin32_postinstall.py") if not os.path.isfile(filename): ! raise RuntimeError("Can't find '%s'" % (filename,)) ! print ("Executing post install script...") os.spawnl(os.P_NOWAIT, sys.executable, sys.executable, filename, *************** *** 1135,1139 **** # (otherwise we replace all of build_extension!) def my_new_compiler(**kw): ! if kw.has_key('compiler') and kw['compiler'] in (None, 'msvc'): return my_compiler() return orig_new_compiler(**kw) --- 1127,1131 ---- # (otherwise we replace all of build_extension!) def my_new_compiler(**kw): ! if 'compiler' in kw and kw['compiler'] in (None, 'msvc'): return my_compiler() return orig_new_compiler(**kw) *************** *** 1221,1225 **** try: self.spawn(args) ! except DistutilsExecError, msg: log.info("VersionStamp failed: %s", msg) ok = False --- 1213,1217 ---- try: self.spawn(args) ! except DistutilsExecError as msg: log.info("VersionStamp failed: %s", msg) ok = False *************** *** 1261,1265 **** installobj = self.distribution.get_command_obj('install') self.install_dir = installobj.install_lib ! print 'Installing data files to %s' % self.install_dir install_data.finalize_options(self) --- 1253,1257 ---- installobj = self.distribution.get_command_obj('install') self.install_dir = installobj.install_lib ! print ('Installing data files to %s' % self.install_dir) install_data.finalize_options(self) *************** *** 1285,1304 **** for info in ( ! ("dbi", "", False), ! ("mmapfile", "", False), ! ("odbc", "odbc32 odbccp32 dbi", False), ("perfmon", "", True), ! ("timer", "user32", False), ! ("win2kras", "rasapi32", False, 0x0500), ! ("win32api", "user32 advapi32 shell32 version", False, 0x0500, 'win32/src/win32apimodule.cpp win32/src/win32api_display.cpp'), ("win32cred", "AdvAPI32 credui", True, 0x0501, 'win32/src/win32credmodule.cpp'), ! ("win32crypt", "Crypt32", False, 0x0500, 'win32/src/win32crypt.i win32/src/win32cryptmodule.cpp'), ! ("win32file", "oleaut32", False, 0x0500), ! ("win32event", "user32", False), ! ("win32clipboard", "gdi32 user32 shell32", False), ! ("win32evtlog", "advapi32 oleaut32", False), # win32gui handled below ! ("win32job", "user32", False, 0x0500, 'win32/src/win32job.i win32/src/win32jobmodule.cpp'), ! ("win32lz", "lz32", False), ("win32net", "netapi32 advapi32", True, None, """ win32/src/win32net/win32netfile.cpp win32/src/win32net/win32netgroup.cpp --- 1277,1296 ---- for info in ( ! ("dbi", "", True), ! ("mmapfile", "", True), ! ("odbc", "odbc32 odbccp32 dbi", True), ("perfmon", "", True), ! ("timer", "user32", True), ! ("win2kras", "rasapi32", True, 0x0500), ! ("win32api", "user32 advapi32 shell32 version", True, 0x0500, 'win32/src/win32apimodule.cpp win32/src/win32api_display.cpp'), ("win32cred", "AdvAPI32 credui", True, 0x0501, 'win32/src/win32credmodule.cpp'), ! ("win32crypt", "Crypt32", True, 0x0500, 'win32/src/win32crypt.i win32/src/win32cryptmodule.cpp'), ! ("win32file", "oleaut32", True, 0x0500), ! ("win32event", "user32", True), ! ("win32clipboard", "gdi32 user32 shell32", True), ! ("win32evtlog", "advapi32 oleaut32", True), # win32gui handled below ! ("win32job", "user32", True, 0x0500, 'win32/src/win32job.i win32/src/win32jobmodule.cpp'), ! ("win32lz", "lz32", True), ("win32net", "netapi32 advapi32", True, None, """ win32/src/win32net/win32netfile.cpp win32/src/win32net/win32netgroup.cpp *************** *** 1307,1316 **** win32/src/win32net/win32netuser.cpp """), ! ("win32pdh", "", False), ! ("win32pipe", "", False), ! ("win32print", "winspool user32 gdi32", False, 0x0500), ! ("win32process", "advapi32 user32", False, 0x0500), ("win32profile", "Userenv", True, None, 'win32/src/win32profilemodule.cpp'), ! ("win32ras", "rasapi32 user32", False), ("win32security", "advapi32 user32 netapi32", True, 0x0500, """ win32/src/win32security.i win32/src/win32securitymodule.cpp --- 1299,1308 ---- win32/src/win32net/win32netuser.cpp """), ! ("win32pdh", "", True), ! ("win32pipe", "", True), ! ("win32print", "winspool user32 gdi32", True, 0x0500), ! ("win32process", "advapi32 user32", True, 0x0500), ("win32profile", "Userenv", True, None, 'win32/src/win32profilemodule.cpp'), ! ("win32ras", "rasapi32 user32", True), ("win32security", "advapi32 user32 netapi32", True, 0x0500, """ win32/src/win32security.i win32/src/win32securitymodule.cpp *************** *** 1318,1324 **** """), ("win32service", "advapi32 oleaut32 user32", True, 0x0501), ! ("win32trace", "advapi32", False), ! ("win32wnet", "netapi32 mpr", False), ! ("win32inet", "wininet", False, 0x500, """ win32/src/win32inet.i win32/src/win32inetmodule.cpp win32/src/win32inet_winhttp.cpp""" --- 1310,1316 ---- """), ("win32service", "advapi32 oleaut32 user32", True, 0x0501), ! ("win32trace", "advapi32", True), ! ("win32wnet", "netapi32 mpr", True), ! ("win32inet", "wininet", True, 0x500, """ win32/src/win32inet.i win32/src/win32inetmodule.cpp win32/src/win32inet_winhttp.cpp""" *************** *** 1326,1330 **** ("win32console", "kernel32", True, 0x0501, "win32/src/win32consolemodule.cpp"), ("win32ts", "WtsApi32", True, 0x0501, "win32/src/win32tsmodule.cpp"), ! ("_win32sysloader", "", False, 0x0501, "win32/src/_win32sysloader.cpp"), ("win32transaction", "kernel32", True, 0x0501, "win32/src/win32transactionmodule.cpp"), --- 1318,1322 ---- ("win32console", "kernel32", True, 0x0501, "win32/src/win32consolemodule.cpp"), ("win32ts", "WtsApi32", True, 0x0501, "win32/src/win32tsmodule.cpp"), ! ("_win32sysloader", "", True, 0x0501, "win32/src/_win32sysloader.cpp"), ("win32transaction", "kernel32", True, 0x0501, "win32/src/win32transactionmodule.cpp"), *************** *** 1357,1360 **** --- 1349,1353 ---- libraries="gdi32 user32 comdlg32 comctl32 shell32", define_macros = [("WIN32GUI", None)], + extra_compile_args = ['-DUNICODE', '-D_UNICODE'] ), # winxpgui is built from win32gui.i, but sets up different #defines before *************** *** 1369,1372 **** --- 1362,1366 ---- define_macros = [("WIN32GUI",None), ("WINXPGUI",None)], extra_swig_commands=["-DWINXPGUI"], + extra_compile_args = ['-DUNICODE', '-D_UNICODE'] ), # winxptheme *************** *** 1457,1466 **** # ActiveDebugging is a mess. See the comments in the docstring of this # module for details on getting it built. ! WinExt_win32com('axdebug', ! dsp_file=r"com\Active Debugging.dsp", ! libraries="axscript", ! pch_header = "stdafx.h", ! optional_headers = ["activdbg.h"], ! ), WinExt_win32com('internet'), WinExt_win32com('mapi', libraries="mapi32", pch_header="PythonCOM.h", --- 1451,1460 ---- # ActiveDebugging is a mess. See the comments in the docstring of this # module for details on getting it built. ! ## WinExt_win32com('axdebug', ! ## dsp_file=r"com\Active Debugging.dsp", ! ## libraries="axscript", ! ## pch_header = "stdafx.h", ! ## optional_headers = ["activdbg.h"], ! ## ), WinExt_win32com('internet'), WinExt_win32com('mapi', libraries="mapi32", pch_header="PythonCOM.h", *************** *** 1628,1634 **** W32_exe_files = [ - WinExt_win32("win32popenWin9x", - libraries = "user32", - platforms = ["win32"]), WinExt_win32("pythonservice", dsp_file = "win32/PythonService EXE.dsp", --- 1622,1625 ---- *************** *** 1711,1719 **** flist.exclude_pattern(re.compile(".*\\\\\."), is_regex=1) if not flist.files: ! raise RuntimeError, "No files match '%s'" % file files_use = flist.files else: if not os.path.isfile(file): ! raise RuntimeError, "No file '%s'" % file files_use = (file,) for fname in files_use: --- 1702,1710 ---- flist.exclude_pattern(re.compile(".*\\\\\."), is_regex=1) if not flist.files: ! raise RuntimeError("No files match '%s'" % file) files_use = flist.files else: if not os.path.isfile(file): ! raise RuntimeError("No file '%s'" % file) files_use = (file,) for fname in files_use: *************** *** 1729,1734 **** try: temp = convert_data_files([file]) ! except RuntimeError, details: ! if not str(details).startswith("No file"): raise log.info('NOTE: Optional file %s not found - skipping' % file) --- 1720,1725 ---- try: temp = convert_data_files([file]) ! except RuntimeError as details: ! if not str(details.args[0]).startswith("No file"): raise log.info('NOTE: Optional file %s not found - skipping' % file) *************** *** 1740,1745 **** if len(sys.argv)==1: # distutils will print usage - print our docstring first. ! print __doc__ ! print "Standard usage information follows:" packages=['win32com', --- 1731,1736 ---- if len(sys.argv)==1: # distutils will print usage - print our docstring first. ! print (__doc__) ! print ("Standard usage information follows:") packages=['win32com', *************** *** 1914,1922 **** excluded_extensions = dist.command_obj['build_ext'].excluded_extensions if excluded_extensions: ! print "*** NOTE: The following extensions were NOT %s:" % what_string for ext, why in excluded_extensions: ! print " %s: %s" % (ext.name, why) ! print "For more details on installing the correct libraries and headers," ! print "please execute this script with no arguments (or see the docstring)" else: ! print "All extension modules %s OK" % (what_string,) --- 1905,1913 ---- excluded_extensions = dist.command_obj['build_ext'].excluded_extensions if excluded_extensions: ! print ("*** NOTE: The following extensions were NOT %s:" % what_string) for ext, why in excluded_extensions: ! print (" %s: %s" % (ext.name, why)) ! print ("For more details on installing the correct libraries and headers,") ! print ("please execute this script with no arguments (or see the docstring)") else: ! print ("All extension modules %s OK" % (what_string,)) |
From: Roger U. <ru...@us...> - 2008-08-29 05:00:16
|
Update of /cvsroot/pywin32/pywin32/win32/src/win32wnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16887/win32wnet Modified Files: Tag: py3k Netres.h PyNCB.cpp PyNCB.h PyNetresource.cpp win32wnet.cpp Log Message: Changes to build for Python 3.0 Index: win32wnet.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32wnet/win32wnet.cpp,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** win32wnet.cpp 3 Jun 2007 14:53:07 -0000 1.13 --- win32wnet.cpp 29 Aug 2008 05:00:24 -0000 1.13.2.1 *************** *** 61,65 **** - /**************************************************************************** HELPER FUNCTIONS --- 61,64 ---- *************** *** 130,182 **** // @pymethod |win32wnet|WNetAddConnection2|Creates a connection to a network resource. The function can redirect // a local device to the network resource. ! static ! PyObject * ! PyWNetAddConnection2 (PyObject *self, PyObject *args) ! { ! // @todo Eventually should update this to use a NETRESOURCE object (it was written before PyNETRESOURCE) ! DWORD Type; // @pyparm int|type||The resource type. May be either RESOURCETYPE_DISK, RESOURCETYPE_PRINT, or RESOURCETYPE_ANY (from win32netcon) ! LPSTR LocalName; // @pyparm string|localName||holds the name of a local device to map connection to; may be NULL ! LPSTR RemoteName; // @pyparm string|remoteName||holds the passed in remote machine\service name. ! LPSTR ProviderName = NULL; // @pyparm string|ProviderName|None|holds name of network provider to use (if any): NULL lets OS handle it ! LPSTR Username = NULL; // @pyparm string|userName|None|The user name to connect as. ! LPSTR Password = NULL; // @pyparm string|password|None|The password to use. ! DWORD ErrorNo; // holds the returned error number, if any ! DWORD flags = 0; // @pyparm int|flags|0|Specifies a DWORD value that describes connection options. The following value is currently defined. ! // @flagh Value|Meaning ! // @flag CONNECT_UPDATE_PROFILE|The network resource connection should be remembered. ! // <nl>If this bit flag is set, the operating system automatically attempts to restore the connection when the user logs on. ! // <nl>The operating system remembers only successful connections that redirect local devices. It does not remember connections that are unsuccessful or deviceless connections. (A deviceless connection occurs when the lpLocalName member is NULL or points to an empty string.) ! // <nl>If this bit flag is clear, the operating system does not automatically restore the connection at logon. ! NETRESOURCE NetResource; ! if (!PyArg_ParseTuple(args,"izs|zzzi",&Type,&LocalName,&RemoteName,&ProviderName,&Username,&Password, &flags)) return NULL; ! ! // Build the NETRESOURCE structure ! Py_BEGIN_ALLOW_THREADS ! ! memset((void *)&NetResource, '\0', sizeof(NETRESOURCE)); ! NetResource.dwType = Type; ! NetResource.lpLocalName = LocalName; ! NetResource.lpProvider = ProviderName; ! NetResource.lpRemoteName = RemoteName; ! ! #ifdef _WIN32_WCE_ // Windows CE only has the #3 version...use NULL for HWND to simulate #2 ! ErrorNo = WNetAddConnection3(NULL,&NetResource, Password, Username, flags); ! #else ! ErrorNo = WNetAddConnection2(&NetResource, Password, Username, flags); ! #endif ! Py_END_ALLOW_THREADS ! ! if (ErrorNo != NO_ERROR) ! { ! return ReturnNetError("WNetAddConnection2", ErrorNo); ! } ! ! Py_INCREF(Py_None); ! return Py_None; ! }; --- 129,172 ---- // @pymethod |win32wnet|WNetAddConnection2|Creates a connection to a network resource. The function can redirect // a local device to the network resource. ! // @comm This function previously accepted separate parameters to construct a <o PyNETRESOURCE>. It has been ! // changed to accept a NETRESOURCE object instead of the individual elements. ! // @comm Accepts keyword arguments. ! // @pyseeapi WNetAddConnection2 ! static PyObject *PyWNetAddConnection2 (PyObject *self, PyObject *args, PyObject *kwargs) { ! LPTSTR Username = NULL; ! LPTSTR Password = NULL; ! PyObject *obnr, *obPassword=Py_None, *obUsername=Py_None, *ret=NULL; DWORD ErrorNo; // holds the returned error number, if any ! DWORD flags = 0; ! NETRESOURCE * pNetResource; ! static char *keywords[] = {"NetResource","Password","UserName","Flags", NULL}; ! if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OOk", keywords, ! &obnr, // @pyparm <o PyNETRESOURCE>|NetResource||Describes the network resource for the connection. ! &obPassword, // @pyparm str|Password|None|The password to use. Use None for default credentials. ! &obUsername, // @pyparm str|UserName|None|The user name to connect as. Use None for default credentials. ! &flags)) // @pyparm int|Flags|0|Combination win32netcon.CONNECT_* flags return NULL; ! if (PyWinObject_AsNETRESOURCE(obnr, &pNetResource, FALSE) ! && PyWinObject_AsTCHAR(obPassword, &Password, TRUE) ! && PyWinObject_AsTCHAR(obUsername, &Username, TRUE)){ ! Py_BEGIN_ALLOW_THREADS ! #ifdef _WIN32_WCE_ // Windows CE only has the #3 version...use NULL for HWND to simulate #2 ! ErrorNo = WNetAddConnection3(NULL, pNetResource, Password, Username, flags); ! #else ! ErrorNo = WNetAddConnection2(pNetResource, Password, Username, flags); ! #endif ! Py_END_ALLOW_THREADS ! if (ErrorNo != NO_ERROR) ! ReturnNetError("WNetAddConnection2", ErrorNo); ! else{ ! Py_INCREF(Py_None); ! ret = Py_None; ! } ! } ! PyWinObject_FreeTCHAR(Password); ! PyWinObject_FreeTCHAR(Username); ! return ret; }; *************** *** 186,201 **** PyWNetCancelConnection2 (PyObject *self, PyObject *args) { ! LPSTR lpName; // @pyparm string|name||Name of existing connection to be closed DWORD dwFlags; // @pyparm int|flags||Currently determines if the persisent connection information will be updated as a result of this call. DWORD bForce; // @pyparm int|force||indicates if the close operation should be forced. (i.e. ignore open files and connections) DWORD ErrorNo; ! if(!PyArg_ParseTuple(args, "sii",&lpName, &dwFlags, &bForce)) return NULL; - Py_BEGIN_ALLOW_THREADS ErrorNo = WNetCancelConnection2(lpName, dwFlags, (BOOL)bForce); Py_END_ALLOW_THREADS ! if (ErrorNo != NO_ERROR) { --- 176,193 ---- PyWNetCancelConnection2 (PyObject *self, PyObject *args) { ! LPTSTR lpName; // @pyparm string|name||Name of existing connection to be closed DWORD dwFlags; // @pyparm int|flags||Currently determines if the persisent connection information will be updated as a result of this call. DWORD bForce; // @pyparm int|force||indicates if the close operation should be forced. (i.e. ignore open files and connections) DWORD ErrorNo; ! PyObject *obName; ! if(!PyArg_ParseTuple(args, "Okk", &obName, &dwFlags, &bForce)) ! return NULL; ! if (!PyWinObject_AsTCHAR(obName, &lpName, FALSE)) return NULL; Py_BEGIN_ALLOW_THREADS ErrorNo = WNetCancelConnection2(lpName, dwFlags, (BOOL)bForce); Py_END_ALLOW_THREADS ! PyWinObject_FreeTCHAR(lpName); if (ErrorNo != NO_ERROR) { *************** *** 220,232 **** // @pyparm int|type||Specifies the resource types to enumerate. // @pyparm int|usage||Specifies the resource usage to be enumerated. ! // @pyparm <o NETRESOURCE>|resource||Python NETRESOURCE object. if (!PyArg_ParseTuple(args, "iiiO", &dwScope,&dwType,&dwUsage,&ob_nr)) return NULL; ! if (ob_nr == Py_None) ! p_nr = NULL; ! else if ! (!PyWinObject_AsNETRESOURCE(ob_nr, &p_nr, FALSE)) ! return(ReturnError("failed converting NetResource Object","WNetOpenEnum")); Py_BEGIN_ALLOW_THREADS --- 212,221 ---- // @pyparm int|type||Specifies the resource types to enumerate. // @pyparm int|usage||Specifies the resource usage to be enumerated. ! // @pyparm <o PyNETRESOURCE>|resource||Python NETRESOURCE object. if (!PyArg_ParseTuple(args, "iiiO", &dwScope,&dwType,&dwUsage,&ob_nr)) return NULL; ! if (!PyWinObject_AsNETRESOURCE(ob_nr, &p_nr, TRUE)) ! return NULL; Py_BEGIN_ALLOW_THREADS *************** *** 263,267 **** }; ! // @pymethod [<o NETRESOURCE>, ...]|win32wnet|WNetEnumResource|Enumerates a list of resources static PyObject * --- 252,256 ---- }; ! // @pymethod [<o PyNETRESOURCE>, ...]|win32wnet|WNetEnumResource|Enumerates a list of resources static PyObject * *************** *** 478,482 **** } ! // @pymethod (<o NETRESOURCE>, str)|win32wnet|WNetGetResourceInformation|Finds the type and provider of a network resource // @rdesc Returns a NETRESOURCE and a string containing the trailing part of the remote path PyObject * --- 467,471 ---- } ! // @pymethod (<o PyNETRESOURCE>, str)|win32wnet|WNetGetResourceInformation|Finds the type and provider of a network resource // @rdesc Returns a NETRESOURCE and a string containing the trailing part of the remote path PyObject * *************** *** 494,498 **** if (!PyArg_ParseTuple(args, "O!", &PyNETRESOURCEType, ! &NRT)) // @pyparm <o NETRESOURCE>|NetResource||Describes a network resource. lpRemoteName is required, dwType and lpProvider can be supplied if known return NULL; --- 483,487 ---- if (!PyArg_ParseTuple(args, "O!", &PyNETRESOURCEType, ! &NRT)) // @pyparm <o PyNETRESOURCE>|NetResource||Describes a network resource. lpRemoteName is required, dwType and lpProvider can be supplied if known return NULL; *************** *** 563,567 **** TCHAR errstr[1024], provider[256]; Py_BEGIN_ALLOW_THREADS ! err=WNetGetLastError(&extendederr, errstr, sizeof(errstr), provider, sizeof(provider)); Py_END_ALLOW_THREADS if (err==NO_ERROR) --- 552,556 ---- TCHAR errstr[1024], provider[256]; Py_BEGIN_ALLOW_THREADS ! err=WNetGetLastError(&extendederr, errstr, sizeof(errstr)/sizeof(TCHAR), provider, sizeof(provider)/sizeof(TCHAR)); Py_END_ALLOW_THREADS if (err==NO_ERROR) *************** *** 570,574 **** } ! // @pymethod <o NETRESOURCE>|win32wnet|WNetGetResourceParent|Finds the parent resource of a network resource PyObject *PyWNetGetResourceParent(PyObject *self, PyObject *args) { --- 559,563 ---- } ! // @pymethod <o PyNETRESOURCE>|win32wnet|WNetGetResourceParent|Finds the parent resource of a network resource PyObject *PyWNetGetResourceParent(PyObject *self, PyObject *args) { *************** *** 580,584 **** PyObject *obnr, *ret=NULL; if (!PyArg_ParseTuple(args, "O:WNetGetResourceParent", ! &obnr)) // @pyparm <o NETRESOURCE>|NetResource||Describes a network resource. lpRemoteName and lpProvider are required, dwType is recommended for efficiency return NULL; if (!PyWinObject_AsNETRESOURCE(obnr, &nr, FALSE)) --- 569,573 ---- PyObject *obnr, *ret=NULL; if (!PyArg_ParseTuple(args, "O:WNetGetResourceParent", ! &obnr)) // @pyparm <o PyNETRESOURCE>|NetResource||Describes a network resource. lpRemoteName and lpProvider are required, dwType is recommended for efficiency return NULL; if (!PyWinObject_AsNETRESOURCE(obnr, &nr, FALSE)) *************** *** 621,625 **** {"Netbios", PyWinMethod_Netbios, 1, "Calls the windows Netbios function"}, // @pymeth WNetAddConnection2|Creates a connection to a network resource. ! {"WNetAddConnection2", PyWNetAddConnection2, 1, "type,localname,remotename,provider,username,password (does not use NETRESOURCE)"}, // @pymeth WNetCancelConnection2|Closes network connections made by WNetAddConnection2 or 3 {"WNetCancelConnection2", PyWNetCancelConnection2, 1, "localname,dwflags,bforce"}, --- 610,614 ---- {"Netbios", PyWinMethod_Netbios, 1, "Calls the windows Netbios function"}, // @pymeth WNetAddConnection2|Creates a connection to a network resource. ! {"WNetAddConnection2", (PyCFunction)PyWNetAddConnection2, METH_KEYWORDS|METH_VARARGS, "WNetAddConnection2(NetResource, Password, UserName, Flags)"}, // @pymeth WNetCancelConnection2|Closes network connections made by WNetAddConnection2 or 3 {"WNetCancelConnection2", PyWNetCancelConnection2, 1, "localname,dwflags,bforce"}, *************** *** 643,662 **** }; ! extern "C" __declspec(dllexport) ! void ! initwin32wnet(void) ! { ! PyObject *dict, *module; ! module = Py_InitModule("win32wnet", win32wnet_functions); ! if (!module) return; ! dict = PyModule_GetDict(module); ! if (!dict) return; ! PyWinGlobals_Ensure(); ! PyDict_SetItemString(dict, "error", PyWinExc_ApiError); ! PyDict_SetItemString(dict, "NETRESOURCEType", (PyObject *)&PyNETRESOURCEType); ! PyDict_SetItemString(dict, "NCBType", (PyObject *)&PyNCBType); ! Py_INCREF(PyWinExc_ApiError); ! } --- 632,682 ---- }; ! extern "C" __declspec(dllexport) ! #if (PY_VERSION_HEX < 0x03000000) ! void initwin32wnet(void) ! #else ! PyObject *PyInit_win32wnet(void) ! #endif { ! PyObject *dict, *module; ! #if (PY_VERSION_HEX < 0x03000000) ! module = Py_InitModule("win32wnet", win32wnet_functions); ! if (!module) ! return; ! dict = PyModule_GetDict(module); ! if (!dict) ! return; ! #else ! static PyModuleDef win32wnet_def = { ! PyModuleDef_HEAD_INIT, ! "win32wnet", ! "A module that exposes the Windows Networking API.", ! -1, ! win32wnet_functions ! }; ! module = PyModule_Create(&win32wnet_def); ! if (!module) ! return NULL; ! dict = PyModule_GetDict(module); ! if (!dict) ! return NULL; ! #endif ! ! PyWinGlobals_Ensure(); ! Py_INCREF(PyWinExc_ApiError); ! PyDict_SetItemString(dict, "error", PyWinExc_ApiError); ! ! #if (PY_VERSION_HEX >= 0x03000000) ! if ((PyType_Ready(&PyNETRESOURCEType) == -1) || ! (PyType_Ready(&PyNCBType) == -1)) ! return NULL; ! #endif + PyDict_SetItemString(dict, "NETRESOURCEType", (PyObject *)&PyNETRESOURCEType); + PyDict_SetItemString(dict, "NCBType", (PyObject *)&PyNCBType); + + #if (PY_VERSION_HEX >= 0x03000000) + return module; + #endif; + } Index: PyNetresource.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32wnet/PyNetresource.cpp,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** PyNetresource.cpp 19 Apr 2006 03:15:11 -0000 1.3 --- PyNetresource.cpp 29 Aug 2008 05:00:24 -0000 1.3.4.1 *************** *** 38,42 **** /* Main PYTHON entry point for creating a new reference. Registered by win32wnet module */ ! // @pymethod <o NETRESOURCE>|win32wnet|NETRESOURCE|Creates a new <o NETRESOURCE> object. PyObject *PyWinMethod_NewNETRESOURCE(PyObject *self, PyObject *args) --- 38,42 ---- /* Main PYTHON entry point for creating a new reference. Registered by win32wnet module */ ! // @pymethod <o PyNETRESOURCE>|win32wnet|NETRESOURCE|Creates a new <o NETRESOURCE> object. PyObject *PyWinMethod_NewNETRESOURCE(PyObject *self, PyObject *args) *************** *** 81,90 **** ! // @object NETRESOURCE|A Python object that encapsulates a Win32 NETRESOURCE structure. __declspec(dllexport) PyTypeObject PyNETRESOURCEType = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, "PyNETRESOURCE", sizeof(PyNETRESOURCE), --- 81,89 ---- ! // @object PyNETRESOURCE|A Python object that encapsulates a Win32 NETRESOURCE structure. __declspec(dllexport) PyTypeObject PyNETRESOURCEType = { ! PYWIN_OBJECT_HEAD "PyNETRESOURCE", sizeof(PyNETRESOURCE), *************** *** 92,97 **** PyNETRESOURCE::deallocFunc, /* tp_dealloc */ 0, /* tp_print */ ! PyNETRESOURCE::getattr, /* tp_getattr */ ! PyNETRESOURCE::setattr, /* tp_setattr */ PyNETRESOURCE::compareFunc, /* tp_compare */ 0, /* tp_repr */ --- 91,96 ---- PyNETRESOURCE::deallocFunc, /* tp_dealloc */ 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ PyNETRESOURCE::compareFunc, /* tp_compare */ 0, /* tp_repr */ *************** *** 102,116 **** 0, /* tp_call */ 0, /* tp_str */ }; - #define OFF(e) offsetof(PyNETRESOURCE, e) ! struct memberlist PyNETRESOURCE::memberlist[] = { ! {"dwScope", T_LONG, OFF(m_nr.dwScope), 0}, // @prop integer|dwScope| ! {"dwType", T_LONG, OFF(m_nr.dwType), 0}, // @prop integer|dwType| ! {"dwDisplayType", T_LONG,OFF(m_nr.dwDisplayType), 0}, // @prop integer|dwDisplayType| ! {"dwUsage", T_LONG, OFF(m_nr.dwUsage), 0}, // @prop integer|dwUsage| {"lpLocalName", T_STRING, OFF(m_nr.lpLocalName), 0}, // @prop string|localName| {"lpRemoteName",T_STRING, OFF(m_nr.lpRemoteName), 0},// @prop string|remoteName| --- 101,138 ---- 0, /* tp_call */ 0, /* tp_str */ + PyNETRESOURCE::getattro, /* tp_getattro */ + PyNETRESOURCE::setattro, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + PyNETRESOURCE::members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; #define OFF(e) offsetof(PyNETRESOURCE, e) ! struct PyMemberDef PyNETRESOURCE::members[] = { ! {"dwScope", T_ULONG, OFF(m_nr.dwScope), 0}, // @prop integer|dwScope| ! {"dwType", T_ULONG, OFF(m_nr.dwType), 0}, // @prop integer|dwType| ! {"dwDisplayType", T_ULONG,OFF(m_nr.dwDisplayType), 0}, // @prop integer|dwDisplayType| ! {"dwUsage", T_ULONG, OFF(m_nr.dwUsage), 0}, // @prop integer|dwUsage| ! ! // These are handled by getattro/setattro {"lpLocalName", T_STRING, OFF(m_nr.lpLocalName), 0}, // @prop string|localName| {"lpRemoteName",T_STRING, OFF(m_nr.lpRemoteName), 0},// @prop string|remoteName| *************** *** 125,274 **** _Py_NewReference(this); memset(&m_nr, 0, sizeof(m_nr)); - m_nr.lpLocalName = szLName; - m_nr.lpRemoteName = szRName; - m_nr.lpProvider = szProv; - m_nr.lpComment = szComment; - szLName[0] = _T('\0'); - szRName[0] = _T('\0'); - szProv[0] = _T('\0'); - szComment[0] = _T('\0'); } ! PyNETRESOURCE::PyNETRESOURCE(const NETRESOURCE *pO) { ob_type = &PyNETRESOURCEType; _Py_NewReference(this); ! m_nr.dwScope = pO->dwScope; ! m_nr.dwType = pO->dwType; ! m_nr.dwDisplayType = pO->dwDisplayType; ! m_nr.dwUsage = pO->dwUsage; ! m_nr.lpLocalName = szLName; ! m_nr.lpRemoteName = szRName; ! m_nr.lpProvider = szProv; ! m_nr.lpComment = szComment; ! ! if (pO->lpLocalName == NULL) ! szLName[0] = _T('\0'); ! else ! { ! _tcsncpy(szLName, pO->lpLocalName, MAX_NAME); ! szLName[MAX_NAME-1] = _T('\0'); // explicit termination! ! } ! ! ! if (pO->lpRemoteName == NULL) ! szRName[0] = _T('\0'); ! else ! { ! _tcsncpy(szRName, pO->lpRemoteName, MAX_NAME); ! szRName[MAX_NAME-1] = _T('\0'); // explicit termination! ! } ! ! ! if (pO->lpProvider == NULL) ! szProv[0] = _T('\0'); ! else ! { ! _tcsncpy(szProv, pO->lpProvider, MAX_NAME); ! szProv[MAX_NAME-1] = _T('\0'); // explicit termination! ! } ! ! if (pO->lpComment == NULL) ! szComment[0] = _T('\0'); ! else ! { ! _tcsncpy(szComment, pO->lpComment, MAX_COMMENT); ! szComment[MAX_COMMENT-1] = _T('\0'); ! } } PyNETRESOURCE::~PyNETRESOURCE(void) { ! } ! PyObject *PyNETRESOURCE::getattr(PyObject *self, char *name) { ! #ifdef UNICODE PyNETRESOURCE *This = (PyNETRESOURCE *)self; ! if (strcmp(name, "lpProvider") == 0) ! return PyWinObject_FromWCHAR(This->m_nr.lpProvider); ! else if ! (strcmp(name, "lpRemoteName") == 0) ! return PyWinObject_FromWCHAR(This->m_nr.lpRemoteName); ! else if ! (strcmp(name, "lpLocalName") == 0) ! return PyWinObject_FromWCHAR(This->m_nr.lpLocalName); ! else if ! (strcmp(name, "lpComment") == 0) ! return PyWinObject_FromWCHAR(This->m_nr.lpComment); ! else ! #endif ! return PyMember_Get((char *)self, memberlist, name); } ! ! ! int PyNETRESOURCE::setattr(PyObject *self, char *name, PyObject *v) { - PyNETRESOURCE *This = (PyNETRESOURCE *)self; - if (v == NULL) { PyErr_SetString(PyExc_AttributeError, "can't delete NETRESOURCE attributes"); return -1; } ! // the following specific string attributes can be set, all others generate an error. ! ! if (PyString_Check(v)) ! { ! int ret; ! TCHAR *value; ! if (!PyWinObject_AsTCHAR(v, &value, FALSE)) return -1; ! if (strcmp (name, "lpProvider") == 0) ! { ! _tcsncpy(This->szProv, value, MAX_NAME); // no overflow allowed! ! This->szProv[MAX_NAME-1] = _T('\0'); // make sure NULL terminated! ! ret = 0; ! } ! else ! if (strcmp(name, "lpRemoteName") == 0) ! { ! _tcsncpy(This->szRName, value, MAX_NAME); ! This->szRName[MAX_NAME-1] = _T('\0'); ! ret = 0; } ! else ! if (strcmp(name, "lpLocalName") == 0) ! { ! _tcsncpy(This->szLName, value, MAX_NAME); ! This->szLName[MAX_NAME-1] = _T('\0'); ! ret = 0; } ! else ! if (strcmp(name, "lpComment") == 0) ! { ! _tcsncpy(This->szComment, value, MAX_COMMENT); ! This->szComment[MAX_COMMENT-1] = _T('\0'); ! ret = 0; } ! else ! { ! PyErr_SetString(PyExc_AttributeError, "The attribute is not a PyNETRESOURCE string"); ! ret = -1; } ! PyWinObject_FreeTCHAR(value); ! return ret; ! } // PyString_Check ! ! return PyMember_Set((char *)self, memberlist, name, v); } - void PyNETRESOURCE::deallocFunc(PyObject *ob) { --- 147,241 ---- _Py_NewReference(this); memset(&m_nr, 0, sizeof(m_nr)); } ! PyNETRESOURCE::PyNETRESOURCE(const NETRESOURCE *p_nr) { ob_type = &PyNETRESOURCEType; _Py_NewReference(this); ! m_nr=*p_nr; + // Copy strings so they can be freed in same way as when set via setattro + // No error checking here, no way to return an error from a constructor anyway + if (p_nr->lpProvider) + m_nr.lpProvider=PyWin_CopyString(p_nr->lpProvider); + if (p_nr->lpRemoteName) + m_nr.lpRemoteName=PyWin_CopyString(p_nr->lpRemoteName); + if (p_nr->lpLocalName) + m_nr.lpLocalName=PyWin_CopyString(p_nr->lpLocalName); + if (p_nr->lpComment) + m_nr.lpComment=PyWin_CopyString(p_nr->lpComment); } PyNETRESOURCE::~PyNETRESOURCE(void) { ! PyWinObject_FreeTCHAR(m_nr.lpProvider); ! PyWinObject_FreeTCHAR(m_nr.lpRemoteName); ! PyWinObject_FreeTCHAR(m_nr.lpLocalName); ! PyWinObject_FreeTCHAR(m_nr.lpComment); } ! PyObject *PyNETRESOURCE::getattro(PyObject *self, PyObject *obname) { ! char *name=PYWIN_ATTR_CONVERT(obname); ! if (name==NULL) ! return NULL; PyNETRESOURCE *This = (PyNETRESOURCE *)self; ! if (strcmp(name, "lpProvider")==0) ! return PyWinObject_FromTCHAR(This->m_nr.lpProvider); ! if (strcmp(name, "lpRemoteName")==0) ! return PyWinObject_FromTCHAR(This->m_nr.lpRemoteName); ! if (strcmp(name, "lpLocalName")==0) ! return PyWinObject_FromTCHAR(This->m_nr.lpLocalName); ! if (strcmp(name, "lpComment")==0) ! return PyWinObject_FromTCHAR(This->m_nr.lpComment); ! return PyObject_GenericGetAttr(self, obname); } ! int PyNETRESOURCE::setattro(PyObject *self, PyObject *obname, PyObject *v) { if (v == NULL) { PyErr_SetString(PyExc_AttributeError, "can't delete NETRESOURCE attributes"); return -1; } + char *name=PYWIN_ATTR_CONVERT(obname); + if (name==NULL) + return NULL; + PyNETRESOURCE *This = (PyNETRESOURCE *)self; ! TCHAR *value; ! if (strcmp(name, "lpProvider")==0){ ! if (!PyWinObject_AsTCHAR(v, &value, TRUE)) return -1; ! PyWinObject_FreeTCHAR(This->m_nr.lpProvider); ! This->m_nr.lpProvider=value; ! return 0; } ! if (strcmp(name, "lpRemoteName")==0){ ! if (!PyWinObject_AsTCHAR(v, &value, TRUE)) ! return -1; ! PyWinObject_FreeTCHAR(This->m_nr.lpRemoteName); ! This->m_nr.lpRemoteName=value; ! return 0; } ! if (strcmp(name, "lpLocalName")==0){ ! if (!PyWinObject_AsTCHAR(v, &value, TRUE)) ! return -1; ! PyWinObject_FreeTCHAR(This->m_nr.lpLocalName); ! This->m_nr.lpLocalName=value; ! return 0; } ! if (strcmp(name, "lpComment")==0){ ! if (!PyWinObject_AsTCHAR(v, &value, TRUE)) ! return -1; ! PyWinObject_FreeTCHAR(This->m_nr.lpComment); ! This->m_nr.lpComment=value; ! return 0; } ! return PyObject_GenericSetAttr(self, obname, v); } void PyNETRESOURCE::deallocFunc(PyObject *ob) { *************** *** 281,299 **** if (!PyWinObject_AsNETRESOURCE(ob, &p_nr, FALSE)) // sets error exception ! return NULL; // do integer tests first ! if ((m_nr.dwType != p_nr->dwType) || ! (m_nr.dwScope != p_nr->dwScope) || ! (m_nr.dwUsage != p_nr->dwUsage) || ! (m_nr.dwDisplayType != p_nr->dwDisplayType)) ! return (0); ! ! if ((_tcscmp(szComment, GetComment())) || ! (_tcscmp(szLName, GetLName())) || ! (_tcscmp(szProv, GetProvider())) || ! (_tcscmp(szRName, GetRName()))) ! return 0; ! return 1; }; --- 248,288 ---- if (!PyWinObject_AsNETRESOURCE(ob, &p_nr, FALSE)) // sets error exception ! return -1; // do integer tests first ! if (m_nr.dwType != p_nr->dwType || ! m_nr.dwScope != p_nr->dwScope || ! m_nr.dwUsage != p_nr->dwUsage || ! m_nr.dwDisplayType != p_nr->dwDisplayType) ! return 1; ! if (m_nr.lpComment && p_nr->lpComment){ ! if (_tcscmp(m_nr.lpComment, p_nr->lpComment) != 0) ! return 1; ! } ! else if (m_nr.lpComment || p_nr->lpComment) ! return 1; ! ! if (m_nr.lpLocalName && p_nr->lpLocalName){ ! if (_tcscmp(m_nr.lpLocalName, p_nr->lpLocalName) != 0) ! return 1; ! } ! else if (m_nr.lpLocalName || p_nr->lpLocalName) ! return 1; ! ! if (m_nr.lpProvider && p_nr->lpProvider){ ! if (_tcscmp(m_nr.lpProvider, p_nr->lpProvider) != 0) ! return 1; ! } ! else if (m_nr.lpProvider || p_nr->lpProvider) ! return 1; ! ! if (m_nr.lpRemoteName && p_nr->lpRemoteName){ ! if (_tcscmp(m_nr.lpRemoteName, p_nr->lpRemoteName) != 0) ! return 1; ! } ! else if (m_nr.lpRemoteName || p_nr->lpRemoteName) ! return 1; ! ! return 0; }; Index: PyNCB.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32wnet/PyNCB.h,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** PyNCB.h 28 Mar 2000 11:34:29 -0000 1.2 --- PyNCB.h 29 Aug 2008 05:00:24 -0000 1.2.4.1 *************** *** 33,45 **** static void deallocFunc(PyObject *ob); ! static PyObject *getattr(PyObject *self, char *name); ! static int setattr(PyObject *self, char *name, PyObject *v); ! ! ! #pragma warning( disable : 4251 ) ! static struct memberlist memberlist[]; ! #pragma warning( default : 4251 ) - NCB m_ncb; DWORD dwStatus; // status of this object (used during copy construct) --- 33,41 ---- static void deallocFunc(PyObject *ob); ! static PyObject *getattro(PyObject *self, PyObject *obname); ! static int setattro(PyObject *self, PyObject *obname, PyObject *v); ! static struct PyMemberDef members[]; ! static struct PyMethodDef methods[]; NCB m_ncb; DWORD dwStatus; // status of this object (used during copy construct) Index: PyNCB.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32wnet/PyNCB.cpp,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -d -r1.4 -r1.4.4.1 *** PyNCB.cpp 21 Oct 2005 06:14:04 -0000 1.4 --- PyNCB.cpp 29 Aug 2008 05:00:24 -0000 1.4.4.1 *************** *** 30,34 **** #endif ! #include <windows.h> #include "python.h" --- 30,34 ---- #endif ! #include "Pywintypes.h" #include <windows.h> #include "python.h" *************** *** 40,60 **** __declspec(dllexport)PyTypeObject PyNCBType = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, "PyNCB", sizeof(PyNCB), 0, ! PyNCB::deallocFunc, /* tp_dealloc */ ! 0, /* tp_print */ ! PyNCB::getattr, /* tp_getattr */ ! PyNCB::setattr, /* tp_setattr */ ! // PyNCB::compareFunc, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* hash? */ ! 0, /* tp_call */ ! 0, /* tp_str */ }; --- 40,81 ---- __declspec(dllexport)PyTypeObject PyNCBType = { ! PYWIN_OBJECT_HEAD "PyNCB", sizeof(PyNCB), 0, ! PyNCB::deallocFunc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyNCB::getattro, /* tp_getattro */ ! PyNCB::setattro, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! PyNCB::methods, /* tp_methods */ ! PyNCB::members, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! 0, /* tp_new */ }; *************** *** 69,73 **** } ! static struct PyMethodDef PyUnicode_methods[] = { { "Reset", PyNCB_Reset, METH_VARARGS }, { NULL }, --- 90,94 ---- } ! struct PyMethodDef PyNCB::methods[] = { { "Reset", PyNCB_Reset, METH_VARARGS }, { NULL }, *************** *** 76,80 **** // @object NCB|A Python object that encapsulates a Win32 NCB structure. #define OFF(e) offsetof(PyNCB, e) ! struct memberlist PyNCB::memberlist[] = { {"Command", T_UBYTE, OFF(m_ncb.ncb_command), 0}, // @prop int|Command| --- 97,101 ---- // @object NCB|A Python object that encapsulates a Win32 NCB structure. #define OFF(e) offsetof(PyNCB, e) ! struct PyMemberDef PyNCB::members[] = { {"Command", T_UBYTE, OFF(m_ncb.ncb_command), 0}, // @prop int|Command| *************** *** 184,191 **** /*********************************************************************/ ! PyObject *PyNCB::getattr(PyObject *self, char *name) { PyNCB *This = (PyNCB *)self; ! if (strcmp(name, "Callname") == 0) // these "strings" are not null terminated so build // a local representation of them and return --- 205,214 ---- /*********************************************************************/ ! PyObject *PyNCB::getattro(PyObject *self, PyObject *obname) { PyNCB *This = (PyNCB *)self; ! char *name=PYWIN_ATTR_CONVERT(obname); ! if (name==NULL) ! return NULL; if (strcmp(name, "Callname") == 0) // these "strings" are not null terminated so build // a local representation of them and return *************** *** 214,229 **** return PyBuffer_FromMemory(This->m_ncb.ncb_buffer, This->m_ncb.ncb_length); } ! else { ! PyObject *ret = PyMember_Get((char *)self, memberlist, name); ! if (ret==NULL) { ! PyErr_Clear(); ! ret = Py_FindMethod(PyUnicode_methods, self, name); ! } ! return ret; ! } }; /********************************************************************/ ! int PyNCB::setattr(PyObject *self, char *name, PyObject *v) { if (v == NULL) { --- 237,245 ---- return PyBuffer_FromMemory(This->m_ncb.ncb_buffer, This->m_ncb.ncb_length); } ! return PyObject_GenericGetAttr(self, obname); }; /********************************************************************/ ! int PyNCB::setattro(PyObject *self, PyObject *obname, PyObject *v) { if (v == NULL) { *************** *** 231,311 **** return -1; } ! // the following specific string attributes can be set ! if (PyString_Check(v)) ! { ! PyNCB *This = (PyNCB *)self; ! ! if (strcmp(name, "Callname") == 0) ! { ! int srclen = lstrlenA(PyString_AsString(v)); ! if (srclen > NCBNAMSZ) // cap string length at NCBNAMSZ(16) ! srclen = NCBNAMSZ; ! ! memset (This->m_ncb.ncb_callname, ' ', NCBNAMSZ); // make sure that the name is space padded ! strncpy ((char *)This->m_ncb.ncb_callname, PyString_AsString(v), srclen); ! if (srclen == 0) // source was null string ! This->m_ncb.ncb_callname[0] = '\0'; ! return 0; } - else - if (strcmp(name, "Name") == 0) - { - int srclen = lstrlenA(PyString_AsString(v)); - if (srclen > NCBNAMSZ) - srclen = NCBNAMSZ; ! memset (This->m_ncb.ncb_name, ' ', NCBNAMSZ); ! strncpy ((char *)This->m_ncb.ncb_name, PyString_AsString(v), srclen); ! if (srclen == 0) // source was null string ! This->m_ncb.ncb_callname[0] = '\0'; ! return 0; } - } // PyString_Check if (strcmp(name, "Buffer") == 0) { PyNCB *This = (PyNCB *)self; ! PyObject *ob_buf = v; ! if (PyInstance_Check(v)) { ! ob_buf = PyObject_GetAttrString(v, "_buffer_"); ! if (ob_buf==NULL) { ! PyErr_Clear(); ! PyErr_SetString(PyExc_TypeError, "The instance must have a _buffer_ attribute"); ! return -1; } ! } ! PyBufferProcs *pb = ob_buf->ob_type->tp_as_buffer; ! if ( pb == NULL || pb->bf_getwritebuffer == NULL || ! pb->bf_getsegcount == NULL ) { ! PyErr_SetString(PyExc_TypeError, "The object must support the write-buffer interface"); ! return -1; ! } ! if ( (*pb->bf_getsegcount)(ob_buf, NULL) != 1 ) { ! PyErr_SetString(PyExc_TypeError, "The object must be a single-segment write-buffer"); return -1; ! } ! This->m_ncb.ncb_length = pb->bf_getwritebuffer(ob_buf, 0, (void **)&This->m_ncb.ncb_buffer); ! if (This->m_ncb.ncb_length==-1) { ! This->m_ncb.ncb_length = 0; return -1; ! } Py_XDECREF(This->m_obbuffer); Py_XDECREF(This->m_obuserbuffer); - This->m_obbuffer = ob_buf; - Py_INCREF(ob_buf); - This->m_obuserbuffer = v; Py_INCREF(v); ! if (ob_buf != v) ! Py_DECREF(ob_buf); // for the temp refcount from the GetAttrString return 0; } ! ! ! ! return PyMember_Set((char *)self, memberlist, name, v); } ! #endif \ No newline at end of file --- 247,317 ---- return -1; } + char *name=PYWIN_ATTR_CONVERT(obname); + if (name==NULL) + return NULL; + PyNCB *This = (PyNCB *)self; ! if (strcmp(name, "Callname") == 0){ ! char *value; ! Py_ssize_t valuelen; ! if (PyString_AsStringAndSize(v, &value, &valuelen)==-1) ! return -1; ! if (valuelen > NCBNAMSZ) // cap string length at NCBNAMSZ(16) ! valuelen = NCBNAMSZ; ! memset (This->m_ncb.ncb_callname, ' ', NCBNAMSZ); // make sure that the name is space padded ! strncpy ((char *)This->m_ncb.ncb_callname, value, valuelen); ! if (valuelen == 0) // source was null string ! This->m_ncb.ncb_callname[0] = '\0'; ! return 0; } ! if (strcmp(name, "Name") == 0){ ! char *value; ! Py_ssize_t valuelen; ! if (PyString_AsStringAndSize(v, &value, &valuelen)==-1) ! return -1; ! if (valuelen > NCBNAMSZ) // cap string length at NCBNAMSZ(16) ! valuelen = NCBNAMSZ; ! memset (This->m_ncb.ncb_name, ' ', NCBNAMSZ); ! strncpy ((char *)This->m_ncb.ncb_name, value, valuelen); ! if (valuelen == 0) // source was null string ! This->m_ncb.ncb_callname[0] = '\0'; ! return 0; } if (strcmp(name, "Buffer") == 0) { PyNCB *This = (PyNCB *)self; ! PyObject *ob_buf = PyObject_GetAttrString(v, "_buffer_"); ! if (ob_buf==NULL){ ! PyErr_Clear(); ! ob_buf=v; ! Py_INCREF(ob_buf); } ! ! void *buf; ! DWORD buflen; ! if (!PyWinObject_AsWriteBuffer(ob_buf, &buf, &buflen)){ ! Py_DECREF(ob_buf); return -1; ! } ! if (buflen > USHRT_MAX){ ! Py_DECREF(ob_buf); ! PyErr_Format(PyExc_ValueError, "Buffer can be at most %d bytes", USHRT_MAX); return -1; ! } Py_XDECREF(This->m_obbuffer); + This->m_obbuffer=ob_buf; Py_XDECREF(This->m_obuserbuffer); Py_INCREF(v); ! This->m_obuserbuffer=v; ! This->m_ncb.ncb_length = (WORD)buflen; ! This->m_ncb.ncb_buffer = (PUCHAR)buf; return 0; } ! return PyObject_GenericSetAttr(self, obname, v); } ! #endif Index: Netres.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32wnet/Netres.h,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** Netres.h 19 Apr 2006 03:15:10 -0000 1.2 --- Netres.h 29 Aug 2008 05:00:24 -0000 1.2.4.1 *************** *** 30,37 **** public: NETRESOURCE *GetNetresource() {return &m_nr;} - LPTSTR GetComment() {return szComment;} - LPTSTR GetLName() {return szLName;} - LPTSTR GetRName() {return szRName;} - LPTSTR GetProvider() {return szProv;} PyNETRESOURCE(void); --- 30,33 ---- *************** *** 43,66 **** static void deallocFunc(PyObject *ob); ! static PyObject *getattr(PyObject *self, char *name); ! static int setattr(PyObject *self, char *name, PyObject *v); static int compareFunc(PyObject *ob1, PyObject *ob2); ! ! ! #pragma warning( disable : 4251 ) ! static struct memberlist memberlist[]; ! #pragma warning( default : 4251 ) protected: ! /* NETRESOURCE contains pointer to strings (LPTSTR) to four items. we are ! copying the values to strings local to each NETRESOURCE instance, thereby keeping ! each NETRESOURCE object self contained. Note that the NETRESOURCE Object's ! strings are not Python Strings!*/ ! ! NETRESOURCE m_nr; ! TCHAR szLName[MAX_NAME]; // length?? ! TCHAR szRName[MAX_NAME]; // probably overkill ! TCHAR szProv[MAX_NAME]; ! TCHAR szComment[MAX_COMMENT]; }; --- 39,52 ---- static void deallocFunc(PyObject *ob); ! static PyObject *getattro(PyObject *self, PyObject *obname); ! static int setattro(PyObject *self, PyObject *obname, PyObject *v); static int compareFunc(PyObject *ob1, PyObject *ob2); ! static struct PyMemberDef members[]; protected: ! /* NETRESOURCE contains pointer to strings (LPTSTR) to four items. ! These are allocated and released by PyWinObject_AsWCHAR and PyWinObject_FreeWCHAR ! */ ! NETRESOURCE m_nr; }; *************** *** 71,73 **** __declspec(dllexport) BOOL PyWinObject_AsNETRESOURCE(PyObject *ob, NETRESOURCE **ppNetresource, BOOL bNoneOK = TRUE); __declspec(dllexport) PyObject *PyWinObject_FromNETRESOURCE(const NETRESOURCE *pNetresource); - --- 57,58 ---- |
From: Roger U. <ru...@us...> - 2008-08-29 05:00:15
|
Update of /cvsroot/pywin32/pywin32/win32/src/PerfMon In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16887/PerfMon Modified Files: Tag: py3k MappingManager.cpp PerfCounterDefn.cpp PerfObjectType.cpp PyPerfMon.cpp pyperfmon.h Log Message: Changes to build for Python 3.0 Index: PerfCounterDefn.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/PerfCounterDefn.cpp,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** PerfCounterDefn.cpp 2 Sep 1999 00:24:54 -0000 1.1 --- PerfCounterDefn.cpp 29 Aug 2008 05:00:24 -0000 1.1.4.1 *************** *** 97,101 **** // excessive tests for lack of performance monitor functionality. // However, the method <om PyPERF_COUNTER_DEFINITION.Get> will raise a ValueError exception in this case. ! static struct PyMethodDef PyPERF_COUNTER_DEFINITION_methods[] = { {"Increment", PyPERF_COUNTER_DEFINITION::Increment, 1}, // @pymeth Increment|Increments the value of the performance counter {"Decrement", PyPERF_COUNTER_DEFINITION::Decrement, 1}, // @pymeth Decrement|Decrements the value of the performance counter --- 97,101 ---- // excessive tests for lack of performance monitor functionality. // However, the method <om PyPERF_COUNTER_DEFINITION.Get> will raise a ValueError exception in this case. ! struct PyMethodDef PyPERF_COUNTER_DEFINITION::methods[] = { {"Increment", PyPERF_COUNTER_DEFINITION::Increment, 1}, // @pymeth Increment|Increments the value of the performance counter {"Decrement", PyPERF_COUNTER_DEFINITION::Decrement, 1}, // @pymeth Decrement|Decrements the value of the performance counter *************** *** 108,128 **** PyTypeObject PyPERF_COUNTER_DEFINITION::type = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, "PyPERF_COUNTER_DEFINITION", sizeof(PyPERF_COUNTER_DEFINITION), 0, PyPERF_COUNTER_DEFINITION::deallocFunc, /* tp_dealloc */ ! 0, /* tp_print */ ! PyPERF_COUNTER_DEFINITION::getattr, /* tp_getattr */ ! PyPERF_COUNTER_DEFINITION::setattr, /* tp_setattr */ ! 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ ! 0, 0, /* tp_call */ ! 0, /* tp_str */ }; --- 108,149 ---- PyTypeObject PyPERF_COUNTER_DEFINITION::type = { ! PYWIN_OBJECT_HEAD "PyPERF_COUNTER_DEFINITION", sizeof(PyPERF_COUNTER_DEFINITION), 0, PyPERF_COUNTER_DEFINITION::deallocFunc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ ! 0, /* tp_hash */ 0, /* tp_call */ ! 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! PyObject_GenericSetAttr, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! PyPERF_COUNTER_DEFINITION::methods, /* tp_methods */ ! PyPERF_COUNTER_DEFINITION::members, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! 0, /* tp_new */ }; *************** *** 130,134 **** ! /*static*/ struct memberlist PyPERF_COUNTER_DEFINITION::memberlist[] = { {"DefaultScale", T_LONG, OFF(m_DefaultScale)}, // @prop integer|DefaultScale|The default scale of the counter. {"DetailLevel", T_LONG, OFF(m_DetailLevel)}, // @prop integer|DetailLevel|The detail level of the counter. --- 151,155 ---- ! /*static*/ struct PyMemberDef PyPERF_COUNTER_DEFINITION::members[] = { {"DefaultScale", T_LONG, OFF(m_DefaultScale)}, // @prop integer|DefaultScale|The default scale of the counter. {"DetailLevel", T_LONG, OFF(m_DetailLevel)}, // @prop integer|DetailLevel|The detail level of the counter. *************** *** 190,213 **** } - PyObject *PyPERF_COUNTER_DEFINITION::getattr(PyObject *self, char *name) - { - PyObject *res; - - res = Py_FindMethod(PyPERF_COUNTER_DEFINITION_methods, self, name); - if (res != NULL) - return res; - PyErr_Clear(); - return PyMember_Get((char *)self, memberlist, name); - } - - int PyPERF_COUNTER_DEFINITION::setattr(PyObject *self, char *name, PyObject *v) - { - if (v == NULL) { - PyErr_SetString(PyExc_AttributeError, "can't delete PERF_COUNTER_DEFINITION attributes"); - return -1; - } - return PyMember_Set((char *)self, memberlist, name, v); - } - /*static*/ void PyPERF_COUNTER_DEFINITION::deallocFunc(PyObject *ob) { --- 211,214 ---- Index: MappingManager.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/MappingManager.cpp,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** MappingManager.cpp 5 Mar 2005 04:50:47 -0000 1.3 --- MappingManager.cpp 29 Aug 2008 05:00:24 -0000 1.3.4.1 *************** *** 60,64 **** _tcscat(szGlobalMapping, szMappingName); ! m_hMappedObject = CreateFileMapping((HANDLE)0xFFFFFFFF, NULL, PAGE_READWRITE, --- 60,64 ---- _tcscat(szGlobalMapping, szMappingName); ! m_hMappedObject = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, *************** *** 179,183 **** // @object PyPerfMonManager|A Python object ! static struct PyMethodDef PyPerfMonManager_methods[] = { {"Close", PyPerfMonManager::Close, 1}, // @pymeth Close|Closes all counters. {NULL} --- 179,183 ---- // @object PyPerfMonManager|A Python object ! struct PyMethodDef PyPerfMonManager::methods[] = { {"Close", PyPerfMonManager::Close, 1}, // @pymeth Close|Closes all counters. {NULL} *************** *** 186,213 **** PyTypeObject PyPerfMonManager::type = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, "PyPerfMonManager", sizeof(PyPerfMonManager), 0, PyPerfMonManager::deallocFunc, /* tp_dealloc */ ! 0, /* tp_print */ ! PyPerfMonManager::getattr, /* tp_getattr */ ! PyPerfMonManager::setattr, /* tp_setattr */ ! 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ ! 0, 0, /* tp_call */ ! 0, /* tp_str */ }; - #define OFF(e) offsetof(PyPerfMonManager, e) ! /*static*/ struct memberlist PyPerfMonManager::memberlist[] = { {NULL} /* Sentinel */ }; --- 186,233 ---- PyTypeObject PyPerfMonManager::type = { ! PYWIN_OBJECT_HEAD "PyPerfMonManager", sizeof(PyPerfMonManager), 0, PyPerfMonManager::deallocFunc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ ! 0, /* tp_hash */ 0, /* tp_call */ ! 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! PyObject_GenericSetAttr, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! PyPerfMonManager::methods, /* tp_methods */ ! PyPerfMonManager::members, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! 0, /* tp_new */ }; #define OFF(e) offsetof(PyPerfMonManager, e) ! /*static*/ struct PyMemberDef PyPerfMonManager::members[] = { {NULL} /* Sentinel */ }; *************** *** 270,293 **** } - PyObject *PyPerfMonManager::getattr(PyObject *self, char *name) - { - PyObject *res; - - res = Py_FindMethod(PyPerfMonManager_methods, self, name); - if (res != NULL) - return res; - PyErr_Clear(); - return PyMember_Get((char *)self, memberlist, name); - } - - int PyPerfMonManager::setattr(PyObject *self, char *name, PyObject *v) - { - if (v == NULL) { - PyErr_SetString(PyExc_AttributeError, "can't delete PERF_OBJECT_TYPE attributes"); - return -1; - } - return PyMember_Set((char *)self, memberlist, name, v); - } - /*static*/ void PyPerfMonManager::deallocFunc(PyObject *ob) { --- 290,293 ---- Index: pyperfmon.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/pyperfmon.h,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** pyperfmon.h 2 Sep 1999 00:24:54 -0000 1.1 --- pyperfmon.h 29 Aug 2008 05:00:24 -0000 1.1.4.1 *************** *** 40,46 **** static void deallocFunc(PyObject *ob); ! static PyObject *getattr(PyObject *self, char *name); ! static int setattr(PyObject *self, char *name, PyObject *v); ! static struct memberlist memberlist[]; static PyTypeObject type; protected: --- 40,45 ---- static void deallocFunc(PyObject *ob); ! static struct PyMemberDef members[]; ! static struct PyMethodDef methods[]; static PyTypeObject type; protected: *************** *** 69,74 **** static void deallocFunc(PyObject *ob); ! static PyObject *getattr(PyObject *self, char *name); ! static int setattr(PyObject *self, char *name, PyObject *v); static PyObject *Increment(PyObject *self, PyObject *args); --- 68,73 ---- static void deallocFunc(PyObject *ob); ! static PyObject *getattro(PyObject *self, PyObject *obname); ! static int setattro(PyObject *self, PyObject *obname, PyObject *v); static PyObject *Increment(PyObject *self, PyObject *args); *************** *** 77,84 **** static PyObject *Get(PyObject *self, PyObject *args); ! // #pragma warning( disable : 4251 ) ! static struct memberlist memberlist[]; static PyTypeObject type; - #pragma warning( default : 4251 ) protected: --- 76,82 ---- static PyObject *Get(PyObject *self, PyObject *args); ! static struct PyMemberDef members[]; ! static struct PyMethodDef methods[]; static PyTypeObject type; protected: *************** *** 115,128 **** /* Python support */ static void deallocFunc(PyObject *ob); - - static PyObject *getattr(PyObject *self, char *name); - static int setattr(PyObject *self, char *name, PyObject *v); - static PyObject *Close(PyObject *self, PyObject *args); ! ! // #pragma warning( disable : 4251 ) ! static struct memberlist memberlist[]; static PyTypeObject type; - #pragma warning( default : 4251 ) protected: --- 113,120 ---- /* Python support */ static void deallocFunc(PyObject *ob); static PyObject *Close(PyObject *self, PyObject *args); ! static struct PyMemberDef members[]; ! static struct PyMethodDef methods[]; static PyTypeObject type; protected: Index: PyPerfMon.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/PyPerfMon.cpp,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** PyPerfMon.cpp 9 Feb 2001 07:35:59 -0000 1.2 --- PyPerfMon.cpp 29 Aug 2008 05:00:24 -0000 1.2.4.1 *************** *** 86,90 **** /* List of functions exported by this module */ ! // @module perfmon|A module which supports common Windows types. static struct PyMethodDef perfmon_functions[] = { {"LoadPerfCounterTextStrings", PyLoadPerfCounterTextStrings, 1}, // @pymeth LoadPerfCounterTextStrings| --- 86,90 ---- /* List of functions exported by this module */ ! // @module perfmon|A module which wraps Performance Monitor functions. static struct PyMethodDef perfmon_functions[] = { {"LoadPerfCounterTextStrings", PyLoadPerfCounterTextStrings, 1}, // @pymeth LoadPerfCounterTextStrings| *************** *** 98,109 **** ! extern "C" __declspec(dllexport) void ! initperfmon(void) { ! PyObject *dict, *module; ! module = Py_InitModule("perfmon", perfmon_functions); ! if (!module) return; ! dict = PyModule_GetDict(module); } --- 98,130 ---- ! extern "C" __declspec(dllexport) ! #if (PY_VERSION_HEX < 0x03000000) ! void initperfmon(void) { ! PyObject *dict, *module; ! module = Py_InitModule("perfmon", perfmon_functions); ! if (!module) return; ! dict = PyModule_GetDict(module); } + #else + PyObject *PyInit_perfmon(void) + { + PyObject *dict, *module; + static PyModuleDef permon_def = { + PyModuleDef_HEAD_INIT, + "perfmon", + "Contains functions and objects wrapping the Performance Monitor APIs", + -1, + perfmon_functions + }; + module = PyModule_Create(&permon_def); + if (!module) + return NULL; + dict = PyModule_GetDict(module); + if (!dict) + return NULL; + return module; + } + #endif Index: PerfObjectType.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PerfMon/PerfObjectType.cpp,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** PerfObjectType.cpp 2 Sep 1999 00:24:54 -0000 1.1 --- PerfObjectType.cpp 29 Aug 2008 05:00:24 -0000 1.1.4.1 *************** *** 57,61 **** // @object PyPERF_OBJECT_TYPE|A Python object, representing a PERF_OBJECT_TYPE structure ! static struct PyMethodDef PyPERF_OBJECT_TYPE_methods[] = { {"Close", PyPERF_OBJECT_TYPE::Close, 1}, // @pymeth Close|Closes all counters. {NULL} --- 57,61 ---- // @object PyPERF_OBJECT_TYPE|A Python object, representing a PERF_OBJECT_TYPE structure ! struct PyMethodDef PyPERF_OBJECT_TYPE::methods[] = { {"Close", PyPERF_OBJECT_TYPE::Close, 1}, // @pymeth Close|Closes all counters. {NULL} *************** *** 65,85 **** PyTypeObject PyPERF_OBJECT_TYPE::type = { ! PyObject_HEAD_INIT(&PyType_Type) ! 0, "PyPERF_OBJECT_TYPE", sizeof(PyPERF_OBJECT_TYPE), 0, ! PyPERF_OBJECT_TYPE::deallocFunc, /* tp_dealloc */ ! 0, /* tp_print */ ! PyPERF_OBJECT_TYPE::getattr, /* tp_getattr */ ! PyPERF_OBJECT_TYPE::setattr, /* tp_setattr */ ! 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ ! 0, 0, /* tp_call */ ! 0, /* tp_str */ }; --- 65,106 ---- PyTypeObject PyPERF_OBJECT_TYPE::type = { ! PYWIN_OBJECT_HEAD "PyPERF_OBJECT_TYPE", sizeof(PyPERF_OBJECT_TYPE), 0, ! PyPERF_OBJECT_TYPE::deallocFunc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ ! 0, /* tp_hash */ 0, /* tp_call */ ! 0, /* tp_str */ ! PyObject_GenericGetAttr, /* tp_getattro */ ! PyObject_GenericSetAttr, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! PyPERF_OBJECT_TYPE::methods, /* tp_methods */ ! PyPERF_OBJECT_TYPE::members, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_dictoffset */ ! 0, /* tp_init */ ! 0, /* tp_alloc */ ! 0, /* tp_new */ }; *************** *** 87,95 **** ! /*static*/ struct memberlist PyPERF_OBJECT_TYPE::memberlist[] = { {"ObjectNameTitleIndex", T_LONG, OFF(m_ObjectNameTitleIndex)}, // @prop integer|ObjectNameTitleIndex| {"ObjectHelpTitleIndex", T_LONG, OFF(m_ObjectHelpTitleIndex)}, // @prop integer|ObjectHelpTitleIndex| {"DefaultCounterIndex", T_LONG, OFF(m_DefaultCounter)}, // @prop integer|DefaultCounterIndex| ! {NULL} /* Sentinel */ }; --- 108,116 ---- ! /*static*/ struct PyMemberDef PyPERF_OBJECT_TYPE::members[] = { {"ObjectNameTitleIndex", T_LONG, OFF(m_ObjectNameTitleIndex)}, // @prop integer|ObjectNameTitleIndex| {"ObjectHelpTitleIndex", T_LONG, OFF(m_ObjectHelpTitleIndex)}, // @prop integer|ObjectHelpTitleIndex| {"DefaultCounterIndex", T_LONG, OFF(m_DefaultCounter)}, // @prop integer|DefaultCounterIndex| ! {NULL} }; *************** *** 241,264 **** } - PyObject *PyPERF_OBJECT_TYPE::getattr(PyObject *self, char *name) - { - PyObject *res; - - res = Py_FindMethod(PyPERF_OBJECT_TYPE_methods, self, name); - if (res != NULL) - return res; - PyErr_Clear(); - return PyMember_Get((char *)self, memberlist, name); - } - - int PyPERF_OBJECT_TYPE::setattr(PyObject *self, char *name, PyObject *v) - { - if (v == NULL) { - PyErr_SetString(PyExc_AttributeError, "can't delete PERF_OBJECT_TYPE attributes"); - return -1; - } - return PyMember_Set((char *)self, memberlist, name, v); - } - /*static*/ void PyPERF_OBJECT_TYPE::deallocFunc(PyObject *ob) { --- 262,265 ---- |
From: Roger U. <ru...@us...> - 2008-08-29 05:00:15
|
Update of /cvsroot/pywin32/pywin32/win32/src/win32print In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16887/win32print Modified Files: Tag: py3k win32print.cpp Log Message: Changes to build for Python 3.0 Index: win32print.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32print/win32print.cpp,v retrieving revision 1.30 retrieving revision 1.30.2.1 diff -C2 -d -r1.30 -r1.30.2.1 *** win32print.cpp 10 Feb 2008 13:35:33 -0000 1.30 --- win32print.cpp 29 Aug 2008 05:00:24 -0000 1.30.2.1 *************** *** 2585,2589 **** /* List of functions exported by this module */ ! // @module win32print|A module, encapsulating the Windows Win32 API. static struct PyMethodDef win32print_functions[] = { {"OpenPrinter", PyOpenPrinter, 1}, // @pymeth OpenPrinter|Retrieves a handle to a printer. --- 2585,2589 ---- /* List of functions exported by this module */ ! // @module win32print|A module encapsulating the Windows printing API. static struct PyMethodDef win32print_functions[] = { {"OpenPrinter", PyOpenPrinter, 1}, // @pymeth OpenPrinter|Retrieves a handle to a printer. *************** *** 2646,2658 **** ! extern "C" __declspec(dllexport) void ! initwin32print(void) { PyObject *module, *dict; PyWinGlobals_Ensure(); ! module = Py_InitModule("win32print", win32print_functions); ! if (!module) return; ! dict = PyModule_GetDict(module); ! if (!dict) return; AddConstant(dict, "PRINTER_INFO_1", 1); AddConstant(dict, "PRINTER_ENUM_LOCAL", PRINTER_ENUM_LOCAL); --- 2646,2682 ---- ! extern "C" __declspec(dllexport) ! #if (PY_VERSION_HEX < 0x03000000) ! void initwin32print(void) ! #else ! PyObject *PyInit_win32print(void) ! #endif { PyObject *module, *dict; PyWinGlobals_Ensure(); ! ! #if (PY_VERSION_HEX < 0x03000000) ! module = Py_InitModule("win32print", win32print_functions); ! if (!module) ! return; ! dict = PyModule_GetDict(module); ! if (!dict) ! return; ! #else ! static PyModuleDef win32print_def = { ! PyModuleDef_HEAD_INIT, ! "win32print", ! "A module encapsulating the Windows printing API.", ! -1, ! win32print_functions ! }; ! module = PyModule_Create(&win32print_def); ! if (!module) ! return NULL; ! dict = PyModule_GetDict(module); ! if (!dict) ! return NULL; ! #endif ! AddConstant(dict, "PRINTER_INFO_1", 1); AddConstant(dict, "PRINTER_ENUM_LOCAL", PRINTER_ENUM_LOCAL); *************** *** 2836,2839 **** } dummy_tuple=PyTuple_New(0); - } --- 2860,2866 ---- } dummy_tuple=PyTuple_New(0); + #if (PY_VERSION_HEX >= 0x03000000) + return module; + #endif + } |
From: Roger U. <ru...@us...> - 2008-08-29 05:00:15
|
Update of /cvsroot/pywin32/pywin32/win32/src/win32net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16887/win32net Modified Files: Tag: py3k win32netmodule.cpp Log Message: Changes to build for Python 3.0 Index: win32netmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32net/win32netmodule.cpp,v retrieving revision 1.26 retrieving revision 1.26.2.1 diff -C2 -d -r1.26 -r1.26.2.1 *** win32netmodule.cpp 4 Jun 2008 08:18:55 -0000 1.26 --- win32netmodule.cpp 29 Aug 2008 05:00:24 -0000 1.26.2.1 *************** *** 1159,1171 **** } ! extern "C" __declspec(dllexport) void ! initwin32net(void) { ! PyObject *dict, *module; ! module = Py_InitModule("win32net", win32net_functions); ! if (!module) return; ! dict = PyModule_GetDict(module); ! if (!dict) return; PyWinGlobals_Ensure(); PyDict_SetItemString(dict, "error", PyWinExc_ApiError); PyDict_SetItemString(dict, "SERVICE_SERVER", PyUnicode_FromWideChar(SERVICE_SERVER,wcslen(SERVICE_SERVER))); --- 1159,1195 ---- } ! extern "C" __declspec(dllexport) ! #if (PY_VERSION_HEX < 0x03000000) ! void initwin32net(void) ! #else ! PyObject *PyInit_win32net(void) ! #endif { ! PyObject *module, *dict; PyWinGlobals_Ensure(); + + #if (PY_VERSION_HEX < 0x03000000) + module = Py_InitModule("win32net", win32net_functions); + if (!module) + return; + dict = PyModule_GetDict(module); + if (!dict) + return; + #else + static PyModuleDef win32net_def = { + PyModuleDef_HEAD_INIT, + "win32net", + "A module encapsulating the Windows Network API.", + -1, + win32net_functions + }; + module = PyModule_Create(&win32net_def); + if (!module) + return NULL; + dict = PyModule_GetDict(module); + if (!dict) + return NULL; + #endif + PyDict_SetItemString(dict, "error", PyWinExc_ApiError); PyDict_SetItemString(dict, "SERVICE_SERVER", PyUnicode_FromWideChar(SERVICE_SERVER,wcslen(SERVICE_SERVER))); *************** *** 1191,1193 **** --- 1215,1221 ---- } #endif + + #if (PY_VERSION_HEX >= 0x03000000) + return module; + #endif } |
Update of /cvsroot/pywin32/pywin32/win32/Demos In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15490/Demos Modified Files: Tag: py3k BackupRead_BackupWrite.py BackupSeek_streamheaders.py CopyFileEx.py CreateFileTransacted_MiniVersion.py FileSecurityTest.py GetSaveFileName.py OpenEncryptedFileRaw.py RegRestoreKey.py SystemParametersInfo.py cerapi.py desktopmanager.py eventLogDemo.py getfilever.py mmapfile_demo.py print_desktop.py rastest.py timer_demo.py win32clipboardDemo.py win32comport_demo.py win32console_demo.py win32cred_demo.py win32fileDemo.py win32gui_demo.py win32gui_devicenotify.py win32gui_dialog.py win32gui_menu.py win32gui_taskbar.py win32netdemo.py win32rcparser_demo.py win32servicedemo.py win32ts_logoff_disconnected.py winprocess.py Log Message: Changes to build for Python 3.0 Index: CreateFileTransacted_MiniVersion.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/CreateFileTransacted_MiniVersion.py,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** CreateFileTransacted_MiniVersion.py 8 Nov 2007 20:02:30 -0000 1.2 --- CreateFileTransacted_MiniVersion.py 29 Aug 2008 04:59:23 -0000 1.2.2.1 *************** *** 22,26 **** tempdir=win32api.GetTempPath() tempfile=win32api.GetTempFileName(tempdir,'cft')[0] ! print tempfile f=open(tempfile,'w') f.write('This is original file.\n') --- 22,26 ---- tempdir=win32api.GetTempPath() tempfile=win32api.GetTempFileName(tempdir,'cft')[0] ! print(tempfile) f=open(tempfile,'w') f.write('This is original file.\n') *************** *** 46,50 **** win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE, None, win32con.OPEN_EXISTING, 0 , None, Transaction=trans, MiniVersion=base_ver) ! print 'version:',base_ver,win32file.ReadFile(hfile_0, 100) hfile_0.Close() --- 46,50 ---- win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE, None, win32con.OPEN_EXISTING, 0 , None, Transaction=trans, MiniVersion=base_ver) ! print('version:',base_ver,win32file.ReadFile(hfile_0, 100)) hfile_0.Close() *************** *** 52,56 **** win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE, None, win32con.OPEN_EXISTING, 0 , None, Transaction=trans, MiniVersion=ver_1) ! print 'version:',ver_1,win32file.ReadFile(hfile_1, 100) hfile_1.Close() --- 52,56 ---- win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE, None, win32con.OPEN_EXISTING, 0 , None, Transaction=trans, MiniVersion=ver_1) ! print('version:',ver_1,win32file.ReadFile(hfile_1, 100)) hfile_1.Close() *************** *** 58,62 **** win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE, None, win32con.OPEN_EXISTING, 0 , None, Transaction=trans, MiniVersion=ver_2) ! print 'version:',ver_2,win32file.ReadFile(hfile_2, 100) hfile_2.Close() --- 58,62 ---- win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE, None, win32con.OPEN_EXISTING, 0 , None, Transaction=trans, MiniVersion=ver_2) ! print('version:',ver_2,win32file.ReadFile(hfile_2, 100)) hfile_2.Close() Index: BackupSeek_streamheaders.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/BackupSeek_streamheaders.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** BackupSeek_streamheaders.py 7 Jan 2005 00:20:24 -0000 1.1 --- BackupSeek_streamheaders.py 29 Aug 2008 04:59:23 -0000 1.1.4.1 *************** *** 19,23 **** tempdir=win32api.GetTempPath() tempfile=win32api.GetTempFileName(tempdir,'bkr')[0] ! print 'Filename:',tempfile f=open(tempfile,'w') --- 19,23 ---- tempdir=win32api.GetTempPath() tempfile=win32api.GetTempFileName(tempdir,'bkr')[0] ! print('Filename:',tempfile) f=open(tempfile,'w') *************** *** 59,63 **** def parse_stream_header(h,ctxt,data): stream_type, stream_attributes, stream_size, stream_name_size=struct.unpack(win32_stream_id_format,data) ! print '\nType:',stream_type,stream_types[stream_type], 'Attributes:', stream_attributes, 'Size:', stream_size, 'Name len:',stream_name_size if stream_name_size>0: ## ??? sdk says this size is in characters, but it appears to be number of bytes ??? --- 59,63 ---- def parse_stream_header(h,ctxt,data): stream_type, stream_attributes, stream_size, stream_name_size=struct.unpack(win32_stream_id_format,data) ! print('\nType:',stream_type,stream_types[stream_type], 'Attributes:', stream_attributes, 'Size:', stream_size, 'Name len:',stream_name_size) if stream_name_size>0: ## ??? sdk says this size is in characters, but it appears to be number of bytes ??? *************** *** 66,70 **** else: stream_name='Unnamed' ! print 'Name:'+stream_name return ctxt, stream_type, stream_attributes, stream_size, stream_name_size, stream_name --- 66,70 ---- else: stream_name='Unnamed' ! print('Name:'+stream_name) return ctxt, stream_type, stream_attributes, stream_size, stream_name_size, stream_name *************** *** 79,83 **** if stream_size>0: bytes_moved=win32file.BackupSeek(h, stream_size, ctxt) ! print 'Moved: ',bytes_moved win32file.BackupRead(h, win32_stream_id_size, win32_stream_id_buf, True, True, ctxt) --- 79,83 ---- if stream_size>0: bytes_moved=win32file.BackupSeek(h, stream_size, ctxt) ! print('Moved: ',bytes_moved) win32file.BackupRead(h, win32_stream_id_size, win32_stream_id_buf, True, True, ctxt) Index: CopyFileEx.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/CopyFileEx.py,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** CopyFileEx.py 8 Nov 2007 20:02:29 -0000 1.2 --- CopyFileEx.py 29 Aug 2008 04:59:23 -0000 1.2.2.1 *************** *** 5,10 **** def ProgressRoutine(TotalFileSize, TotalBytesTransferred, StreamSize, StreamBytesTransferred, StreamNumber, CallbackReason, SourceFile, DestinationFile, Data): ! print Data ! print TotalFileSize, TotalBytesTransferred, StreamSize, StreamBytesTransferred, StreamNumber, CallbackReason, SourceFile, DestinationFile ##if TotalBytesTransferred > 100000: ## return win32file.PROGRESS_STOP --- 5,10 ---- def ProgressRoutine(TotalFileSize, TotalBytesTransferred, StreamSize, StreamBytesTransferred, StreamNumber, CallbackReason, SourceFile, DestinationFile, Data): ! print(Data) ! print(TotalFileSize, TotalBytesTransferred, StreamSize, StreamBytesTransferred, StreamNumber, CallbackReason, SourceFile, DestinationFile) ##if TotalBytesTransferred > 100000: ## return win32file.PROGRESS_STOP *************** *** 14,18 **** fsrc=win32api.GetTempFileName(temp_dir,'cfe')[0] fdst=win32api.GetTempFileName(temp_dir,'cfe')[0] ! print fsrc, fdst f=open(fsrc,'w') --- 14,18 ---- fsrc=win32api.GetTempFileName(temp_dir,'cfe')[0] fdst=win32api.GetTempFileName(temp_dir,'cfe')[0] ! print(fsrc, fdst) f=open(fsrc,'w') Index: RegRestoreKey.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/RegRestoreKey.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** RegRestoreKey.py 30 Nov 2006 07:05:24 -0000 1.1 --- RegRestoreKey.py 29 Aug 2008 04:59:23 -0000 1.1.4.1 *************** *** 5,9 **** temp_dir=win32api.GetTempPath() fname=win32api.GetTempFileName(temp_dir,'rsk')[0] ! print fname ## file can't exist os.remove(fname) --- 5,9 ---- temp_dir=win32api.GetTempPath() fname=win32api.GetTempFileName(temp_dir,'rsk')[0] ! print(fname) ## file can't exist os.remove(fname) Index: win32cred_demo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32cred_demo.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** win32cred_demo.py 13 Sep 2006 07:44:27 -0000 1.1 --- win32cred_demo.py 29 Aug 2008 04:59:23 -0000 1.1.4.1 *************** *** 14,18 **** attrs=[ ! {'Keyword':'attr1', 'Flags':0, 'Value':u'unicode data'}, {'Keyword':'attr2', 'Flags':0, 'Value':'character data'} ] --- 14,18 ---- attrs=[ ! {'Keyword':'attr1', 'Flags':0, 'Value':'unicode data'}, {'Keyword':'attr2', 'Flags':0, 'Value':'character data'} ] *************** *** 23,27 **** win32cred.CredWrite(cred) pwd=None ! print win32cred.CredRead(target, win32cred.CRED_TYPE_DOMAIN_PASSWORD) ## Marshal saved credential and use it to log on --- 23,27 ---- win32cred.CredWrite(cred) pwd=None ! print(win32cred.CredRead(target, win32cred.CRED_TYPE_DOMAIN_PASSWORD)) ## Marshal saved credential and use it to log on *************** *** 29,33 **** th=win32security.LogonUser(mc,None,'',win32con.LOGON32_LOGON_INTERACTIVE, win32con.LOGON32_PROVIDER_DEFAULT) win32security.ImpersonateLoggedOnUser(th) ! print 'GetUserName:',win32api.GetUserName() win32security.RevertToSelf() --- 29,33 ---- th=win32security.LogonUser(mc,None,'',win32con.LOGON32_LOGON_INTERACTIVE, win32con.LOGON32_PROVIDER_DEFAULT) win32security.ImpersonateLoggedOnUser(th) ! print('GetUserName:',win32api.GetUserName()) win32security.RevertToSelf() Index: OpenEncryptedFileRaw.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/OpenEncryptedFileRaw.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** OpenEncryptedFileRaw.py 18 Sep 2006 07:17:29 -0000 1.1 --- OpenEncryptedFileRaw.py 29 Aug 2008 04:59:23 -0000 1.1.4.1 *************** *** 7,11 **** f.write(input_buffer) ## python 2.3 throws an error if return value is a plain int ! return long(winerror.ERROR_SUCCESS) def WriteCallback(output_buffer, data, buflen): --- 7,11 ---- f.write(input_buffer) ## python 2.3 throws an error if return value is a plain int ! return int(winerror.ERROR_SUCCESS) def WriteCallback(output_buffer, data, buflen): *************** *** 22,30 **** os.remove(dst_dir) os.mkdir(dst_dir) ! print 'Destination dir:', dst_dir ## create an encrypted file fname=win32api.GetTempFileName(dst_dir,'ref')[0] ! print 'orig file:',fname f=open(fname,'w') f.write('xxxxxxxxxxxxxxxx\n'*32768) --- 22,30 ---- os.remove(dst_dir) os.mkdir(dst_dir) ! print('Destination dir:', dst_dir) ## create an encrypted file fname=win32api.GetTempFileName(dst_dir,'ref')[0] ! print('orig file:',fname) f=open(fname,'w') f.write('xxxxxxxxxxxxxxxx\n'*32768) *************** *** 41,45 **** ## backup raw data of encrypted file bkup_fname=win32api.GetTempFileName(dst_dir,'bef')[0] ! print 'backup file:', bkup_fname f=open(bkup_fname,'wb') ctxt=win32file.OpenEncryptedFileRaw(fname,0) --- 41,45 ---- ## backup raw data of encrypted file bkup_fname=win32api.GetTempFileName(dst_dir,'bef')[0] ! print('backup file:', bkup_fname) f=open(bkup_fname,'wb') ctxt=win32file.OpenEncryptedFileRaw(fname,0) *************** *** 53,57 **** ## restore data from backup to new encrypted file dst_fname=win32api.GetTempFileName(dst_dir,'wef')[0] ! print 'restored file:', dst_fname f=open(bkup_fname,'rb') ctxtout=win32file.OpenEncryptedFileRaw(dst_fname, win32file.CREATE_FOR_IMPORT) --- 53,57 ---- ## restore data from backup to new encrypted file dst_fname=win32api.GetTempFileName(dst_dir,'wef')[0] ! print('restored file:', dst_fname) f=open(bkup_fname,'rb') ctxtout=win32file.OpenEncryptedFileRaw(dst_fname, win32file.CREATE_FOR_IMPORT) Index: win32clipboardDemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32clipboardDemo.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** win32clipboardDemo.py 3 Feb 2003 00:30:29 -0000 1.2 --- win32clipboardDemo.py 29 Aug 2008 04:59:23 -0000 1.2.4.1 *************** *** 7,16 **** if not __debug__: ! print "WARNING: The test code in this module uses assert" ! print "This instance of Python has asserts disabled, so many tests will be skipped" cf_names = {} # Build map of CF_* constants to names. ! for name, val in win32con.__dict__.items(): if name[:3]=="CF_" and name != "CF_SCREENFONTS": # CF_SCREEN_FONTS==CF_TEXT!?!? cf_names[val] = name --- 7,16 ---- if not __debug__: ! print("WARNING: The test code in this module uses assert") ! print("This instance of Python has asserts disabled, so many tests will be skipped") cf_names = {} # Build map of CF_* constants to names. ! for name, val in list(win32con.__dict__.items()): if name[:3]=="CF_" and name != "CF_SCREENFONTS": # CF_SCREEN_FONTS==CF_TEXT!?!? cf_names[val] = name *************** *** 41,45 **** got = GetClipboardData(win32con.CF_UNICODETEXT) assert got == text, "Didnt get the correct result back - '%r'." % (got,) ! assert type(got)==types.UnicodeType, "Didnt get the correct result back - '%r'." % (got,) got = GetClipboardData(win32con.CF_OEMTEXT) --- 41,45 ---- got = GetClipboardData(win32con.CF_UNICODETEXT) assert got == text, "Didnt get the correct result back - '%r'." % (got,) ! assert type(got)==str, "Didnt get the correct result back - '%r'." % (got,) got = GetClipboardData(win32con.CF_OEMTEXT) *************** *** 48,52 **** # Unicode tests EmptyClipboard() ! text = u"Hello from Python unicode" # Now set the Unicode value SetClipboardData(win32con.CF_UNICODETEXT, text) --- 48,52 ---- # Unicode tests EmptyClipboard() ! text = "Hello from Python unicode" # Now set the Unicode value SetClipboardData(win32con.CF_UNICODETEXT, text) *************** *** 54,58 **** got = GetClipboardData(win32con.CF_UNICODETEXT) assert got == text, "Didnt get the correct result back - '%r'." % (got,) ! assert type(got)==types.UnicodeType, "Didnt get the correct result back - '%r'." % (got,) # Close and open the clipboard to ensure auto-conversions take place. --- 54,58 ---- got = GetClipboardData(win32con.CF_UNICODETEXT) assert got == text, "Didnt get the correct result back - '%r'." % (got,) ! assert type(got)==str, "Didnt get the correct result back - '%r'." % (got,) # Close and open the clipboard to ensure auto-conversions take place. *************** *** 68,75 **** # Make sure we get back the correct types. got = GetClipboardData(win32con.CF_UNICODETEXT) ! assert type(got)==types.UnicodeType, "Didnt get the correct result back - '%r'." % (got,) got = GetClipboardData(win32con.CF_OEMTEXT) assert got == text, "Didnt get the correct result back - '%r'." % (got,) ! print "Clipboard text tests worked correctly" finally: CloseClipboard() --- 68,75 ---- # Make sure we get back the correct types. got = GetClipboardData(win32con.CF_UNICODETEXT) ! assert type(got)==str, "Didnt get the correct result back - '%r'." % (got,) got = GetClipboardData(win32con.CF_OEMTEXT) assert got == text, "Didnt get the correct result back - '%r'." % (got,) ! print("Clipboard text tests worked correctly") finally: CloseClipboard() *************** *** 92,97 **** n = "unknown (%s)" % (enum,) ! print "Have format", n ! print "Clipboard enumerator tests worked correctly" finally: CloseClipboard() --- 92,97 ---- n = "unknown (%s)" % (enum,) ! print("Have format", n) ! print("Clipboard enumerator tests worked correctly") finally: CloseClipboard() *************** *** 108,120 **** # Just for the fun of it pickle Python objects through the clipboard fmt = RegisterClipboardFormat("Python Pickle Format") ! import cPickle pickled_object = Foo(a=1, b=2, Hi=3) ! SetClipboardData(fmt, cPickle.dumps( pickled_object ) ) # Now read it back. data = GetClipboardData(fmt) ! loaded_object = cPickle.loads(data) ! assert cPickle.loads(data) == pickled_object, "Didnt get the correct data!" ! print "Clipboard custom format tests worked correctly" finally: CloseClipboard() --- 108,120 ---- # Just for the fun of it pickle Python objects through the clipboard fmt = RegisterClipboardFormat("Python Pickle Format") ! import pickle pickled_object = Foo(a=1, b=2, Hi=3) ! SetClipboardData(fmt, pickle.dumps( pickled_object ) ) # Now read it back. data = GetClipboardData(fmt) ! loaded_object = pickle.loads(data) ! assert pickle.loads(data) == pickled_object, "Didnt get the correct data!" ! print("Clipboard custom format tests worked correctly") finally: CloseClipboard() Index: win32ts_logoff_disconnected.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32ts_logoff_disconnected.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** win32ts_logoff_disconnected.py 5 Jul 2006 15:25:57 -0000 1.1 --- win32ts_logoff_disconnected.py 29 Aug 2008 04:59:23 -0000 1.1.4.1 *************** *** 10,13 **** sessionid=session['SessionId'] username=win32ts.WTSQuerySessionInformation(win32ts.WTS_CURRENT_SERVER_HANDLE, sessionid, win32ts.WTSUserName) ! print 'Logging off disconnected user:',username win32ts.WTSLogoffSession(win32ts.WTS_CURRENT_SERVER_HANDLE, sessionid, True) --- 10,13 ---- sessionid=session['SessionId'] username=win32ts.WTSQuerySessionInformation(win32ts.WTS_CURRENT_SERVER_HANDLE, sessionid, win32ts.WTSUserName) ! print('Logging off disconnected user:',username) win32ts.WTSLogoffSession(win32ts.WTS_CURRENT_SERVER_HANDLE, sessionid, True) Index: win32fileDemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32fileDemo.py,v retrieving revision 1.6 retrieving revision 1.6.4.1 diff -C2 -d -r1.6 -r1.6.4.1 *** win32fileDemo.py 5 May 2003 01:01:20 -0000 1.6 --- win32fileDemo.py 29 Aug 2008 04:59:23 -0000 1.6.4.1 *************** *** 29,33 **** handle.Close() if data == test_data: ! print "Successfully wrote and read a file" os.unlink(testName) --- 29,33 ---- handle.Close() if data == test_data: ! print("Successfully wrote and read a file") os.unlink(testName) Index: win32gui_dialog.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32gui_dialog.py,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** win32gui_dialog.py 4 Jan 2007 08:30:33 -0000 1.7 --- win32gui_dialog.py 29 Aug 2008 04:59:23 -0000 1.7.2.1 *************** *** 24,28 **** import struct, array import commctrl ! import Queue import os --- 24,28 ---- import struct, array import commctrl ! import queue import os *************** *** 44,55 **** else: full_fmt += fmt ! for name, val in kw.items(): ! if not self.__dict__.has_key(name): ! raise ValueError, "LVITEM structures do not have an item '%s'" % (name,) self.__dict__[name] = val def __setattr__(self, attr, val): ! if not attr.startswith("_") and not self.__dict__.has_key(attr): ! raise AttributeError, attr self.__dict__[attr] = val --- 44,55 ---- else: full_fmt += fmt ! for name, val in list(kw.items()): ! if name not in self.__dict__: ! raise ValueError("LVITEM structures do not have an item '%s'" % (name,)) self.__dict__[name] = val def __setattr__(self, attr, val): ! if not attr.startswith("_") and attr not in self.__dict__: ! raise AttributeError(attr) self.__dict__[attr] = val *************** *** 72,76 **** vals.append(0) else: ! str_buf = array.array("c", val+'\0') vals.append(str_buf.buffer_info()[0]) vals.append(len(val)) --- 72,76 ---- vals.append(0) else: ! str_buf = array.array("b", val+'\0') vals.append(str_buf.buffer_info()[0]) vals.append(len(val)) *************** *** 81,85 **** vals.append(val) full_fmt += fmt ! return apply(struct.pack, (full_fmt,) + tuple(vals) ) --- 81,85 ---- vals.append(val) full_fmt += fmt ! return struct.pack(*(full_fmt,) + tuple(vals)) *************** *** 139,144 **** try: classAtom = win32gui.RegisterClass(wc) ! except win32gui.error, err_info: ! if err_info[0]!=winerror.ERROR_CLASS_ALREADY_EXISTS: raise return className --- 139,144 ---- try: classAtom = win32gui.RegisterClass(wc) ! except win32gui.error as err_info: ! if err_info.args[0]!=winerror.ERROR_CLASS_ALREADY_EXISTS: raise return className *************** *** 150,154 **** # Window frame and title ! dlg = [ [title, (0, 0, 210, 250), style, None, (8, "MS Sans Serif"), None, dlgClassName], ] # ID label and text box --- 150,154 ---- # Window frame and title ! dlg = [ [title, (0, 0, 210, 250), style, 0, (8, "MS Sans Serif"), None, dlgClassName], ] # ID label and text box *************** *** 248,253 **** l,t,r,b = win32gui.GetWindowRect(self.hwnd) dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop) ! centre_x, centre_y = win32gui.ClientToScreen( desktop, ( (dt_r-dt_l)/2, (dt_b-dt_t)/2) ) ! win32gui.MoveWindow(hwnd, centre_x-(r/2), centre_y-(b/2), r-l, b-t, 0) self._SetupList() l,t,r,b = win32gui.GetClientRect(self.hwnd) --- 248,253 ---- l,t,r,b = win32gui.GetWindowRect(self.hwnd) dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop) ! centre_x, centre_y = win32gui.ClientToScreen( desktop, ( (dt_r-dt_l)//2, (dt_b-dt_t)//2) ) ! win32gui.MoveWindow(hwnd, centre_x-(r//2), centre_y-(b//2), r-l, b-t, 0) self._SetupList() l,t,r,b = win32gui.GetClientRect(self.hwnd) *************** *** 286,295 **** while 1: params = self.result_queue.get(0) ! apply(self.AddListItem, params) ! except Queue.Empty: pass def OnSearchFinished(self, hwnd, msg, wparam, lparam): ! print "OnSearchFinished" def OnNotify(self, hwnd, msg, wparam, lparam): --- 286,295 ---- while 1: params = self.result_queue.get(0) ! self.AddListItem(*params) ! except queue.Empty: pass def OnSearchFinished(self, hwnd, msg, wparam, lparam): ! print("OnSearchFinished") def OnNotify(self, hwnd, msg, wparam, lparam): *************** *** 305,309 **** code += commctrl.PY_0U if code == commctrl.NM_DBLCLK: ! print "Double click on item", iItem+1 return 1 --- 305,309 ---- code += commctrl.PY_0U if code == commctrl.NM_DBLCLK: ! print("Double click on item", iItem+1) return 1 *************** *** 321,331 **** import threading ! self.result_queue = Queue.Queue() thread = threading.Thread(target = fill_slowly, args=(self.result_queue, self.hwnd) ) thread.start() elif id == IDC_BUTTON_DISPLAY: ! print "Display button selected" sel = win32gui.SendMessage(self.hwndList, commctrl.LVM_GETNEXTITEM, -1, commctrl.LVNI_SELECTED) ! print "The selected item is", sel+1 # These function differ based on how the window is used, so may be overridden --- 321,331 ---- import threading ! self.result_queue = queue.Queue() thread = threading.Thread(target = fill_slowly, args=(self.result_queue, self.hwnd) ) thread.start() elif id == IDC_BUTTON_DISPLAY: ! print("Display button selected") sel = win32gui.SendMessage(self.hwndList, commctrl.LVM_GETNEXTITEM, -1, commctrl.LVNI_SELECTED) ! print("The selected item is", sel+1) # These function differ based on how the window is used, so may be overridden Index: SystemParametersInfo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/SystemParametersInfo.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** SystemParametersInfo.py 16 Oct 2005 17:17:10 -0000 1.1 --- SystemParametersInfo.py 29 Aug 2008 04:59:23 -0000 1.1.4.1 *************** *** 14,25 **** "SPI_GETFONTSMOOTHINGCONTRAST", "SPI_GETFONTSMOOTHINGTYPE", "SPI_GETFOCUSBORDERHEIGHT", "SPI_GETFOCUSBORDERWIDTH", "SPI_GETMOUSECLICKLOCKTIME"): ! print pname cget=getattr(win32con,pname) cset=getattr(win32con,pname.replace('_GET','_SET')) orig_value=win32gui.SystemParametersInfo(cget) ! print '\toriginal setting:',orig_value win32gui.SystemParametersInfo(cset, orig_value+1) new_value=win32gui.SystemParametersInfo(cget) ! print '\tnew value:',new_value assert new_value==orig_value+1 win32gui.SystemParametersInfo(cset, orig_value) --- 14,25 ---- "SPI_GETFONTSMOOTHINGCONTRAST", "SPI_GETFONTSMOOTHINGTYPE", "SPI_GETFOCUSBORDERHEIGHT", "SPI_GETFOCUSBORDERWIDTH", "SPI_GETMOUSECLICKLOCKTIME"): ! print(pname) cget=getattr(win32con,pname) cset=getattr(win32con,pname.replace('_GET','_SET')) orig_value=win32gui.SystemParametersInfo(cget) ! print('\toriginal setting:',orig_value) win32gui.SystemParametersInfo(cset, orig_value+1) new_value=win32gui.SystemParametersInfo(cget) ! print('\tnew value:',new_value) assert new_value==orig_value+1 win32gui.SystemParametersInfo(cset, orig_value) *************** *** 35,46 **** "SPI_GETTOOLTIPANIMATION", "SPI_GETTOOLTIPFADE", "SPI_GETUIEFFECTS", "SPI_GETACTIVEWINDOWTRACKING", "SPI_GETACTIVEWNDTRKZORDER"): ! print pname cget=getattr(win32con,pname) cset=getattr(win32con,pname.replace('_GET','_SET')) orig_value=win32gui.SystemParametersInfo(cget) ! print orig_value win32gui.SystemParametersInfo(cset, not orig_value) new_value=win32gui.SystemParametersInfo(cget) ! print new_value assert orig_value!=new_value win32gui.SystemParametersInfo(cset, orig_value) --- 35,46 ---- "SPI_GETTOOLTIPANIMATION", "SPI_GETTOOLTIPFADE", "SPI_GETUIEFFECTS", "SPI_GETACTIVEWINDOWTRACKING", "SPI_GETACTIVEWNDTRKZORDER"): ! print(pname) cget=getattr(win32con,pname) cset=getattr(win32con,pname.replace('_GET','_SET')) orig_value=win32gui.SystemParametersInfo(cget) ! print(orig_value) win32gui.SystemParametersInfo(cset, not orig_value) new_value=win32gui.SystemParametersInfo(cget) ! print(new_value) assert orig_value!=new_value win32gui.SystemParametersInfo(cset, orig_value) *************** *** 54,65 **** "SPI_GETKEYBOARDPREF","SPI_GETSCREENSAVEACTIVE","SPI_GETMENUDROPALIGNMENT", "SPI_GETDRAGFULLWINDOWS", "SPI_GETSHOWIMEUI"): ! print pname cget=getattr(win32con,pname) cset=getattr(win32con,pname.replace('_GET','_SET')) orig_value=win32gui.SystemParametersInfo(cget) ! print orig_value win32gui.SystemParametersInfo(cset, not orig_value) new_value=win32gui.SystemParametersInfo(cget) ! print new_value assert orig_value!=new_value win32gui.SystemParametersInfo(cset, orig_value) --- 54,65 ---- "SPI_GETKEYBOARDPREF","SPI_GETSCREENSAVEACTIVE","SPI_GETMENUDROPALIGNMENT", "SPI_GETDRAGFULLWINDOWS", "SPI_GETSHOWIMEUI"): ! print(pname) cget=getattr(win32con,pname) cset=getattr(win32con,pname.replace('_GET','_SET')) orig_value=win32gui.SystemParametersInfo(cget) ! print(orig_value) win32gui.SystemParametersInfo(cset, not orig_value) new_value=win32gui.SystemParametersInfo(cget) ! print(new_value) assert orig_value!=new_value win32gui.SystemParametersInfo(cset, orig_value) *************** *** 68,81 **** ! print "SPI_GETICONTITLELOGFONT" lf=win32gui.SystemParametersInfo(win32con.SPI_GETICONTITLELOGFONT) orig_height=lf.lfHeight orig_italic=lf.lfItalic ! print 'Height:', orig_height, 'Italic:',orig_italic lf.lfHeight+=2 lf.lfItalic=not lf.lfItalic win32gui.SystemParametersInfo(win32con.SPI_SETICONTITLELOGFONT, lf) new_lf=win32gui.SystemParametersInfo(win32con.SPI_GETICONTITLELOGFONT) ! print 'New Height:', new_lf.lfHeight, 'New Italic:',new_lf.lfItalic assert new_lf.lfHeight==orig_height+2 assert new_lf.lfItalic!=orig_italic --- 68,81 ---- ! print("SPI_GETICONTITLELOGFONT") lf=win32gui.SystemParametersInfo(win32con.SPI_GETICONTITLELOGFONT) orig_height=lf.lfHeight orig_italic=lf.lfItalic ! print('Height:', orig_height, 'Italic:',orig_italic) lf.lfHeight+=2 lf.lfItalic=not lf.lfItalic win32gui.SystemParametersInfo(win32con.SPI_SETICONTITLELOGFONT, lf) new_lf=win32gui.SystemParametersInfo(win32con.SPI_GETICONTITLELOGFONT) ! print('New Height:', new_lf.lfHeight, 'New Italic:',new_lf.lfItalic) assert new_lf.lfHeight==orig_height+2 assert new_lf.lfItalic!=orig_italic *************** *** 90,98 **** ! print "SPI_GETMOUSEHOVERWIDTH, SPI_GETMOUSEHOVERHEIGHT, SPI_GETMOUSEHOVERTIME" w=win32gui.SystemParametersInfo(win32con.SPI_GETMOUSEHOVERWIDTH) h=win32gui.SystemParametersInfo(win32con.SPI_GETMOUSEHOVERHEIGHT) t=win32gui.SystemParametersInfo(win32con.SPI_GETMOUSEHOVERTIME) ! print 'w,h,t:', w,h,t win32gui.SystemParametersInfo(win32con.SPI_SETMOUSEHOVERWIDTH,w+1) --- 90,98 ---- ! print("SPI_GETMOUSEHOVERWIDTH, SPI_GETMOUSEHOVERHEIGHT, SPI_GETMOUSEHOVERTIME") w=win32gui.SystemParametersInfo(win32con.SPI_GETMOUSEHOVERWIDTH) h=win32gui.SystemParametersInfo(win32con.SPI_GETMOUSEHOVERHEIGHT) t=win32gui.SystemParametersInfo(win32con.SPI_GETMOUSEHOVERTIME) ! print('w,h,t:', w,h,t) win32gui.SystemParametersInfo(win32con.SPI_SETMOUSEHOVERWIDTH,w+1) *************** *** 102,106 **** new_h=win32gui.SystemParametersInfo(win32con.SPI_GETMOUSEHOVERHEIGHT) new_t=win32gui.SystemParametersInfo(win32con.SPI_GETMOUSEHOVERTIME) ! print 'new w,h,t:', new_w, new_h, new_t assert new_w==w+1 assert new_h==h+2 --- 102,106 ---- new_h=win32gui.SystemParametersInfo(win32con.SPI_GETMOUSEHOVERHEIGHT) new_t=win32gui.SystemParametersInfo(win32con.SPI_GETMOUSEHOVERTIME) ! print('new w,h,t:', new_w, new_h, new_t) assert new_w==w+1 assert new_h==h+2 *************** *** 119,131 **** ! print "SPI_SETDOUBLECLKWIDTH, SPI_SETDOUBLECLKHEIGHT" x=win32api.GetSystemMetrics(win32con.SM_CXDOUBLECLK) y=win32api.GetSystemMetrics(win32con.SM_CYDOUBLECLK) ! print 'x,y:', x, y win32gui.SystemParametersInfo(win32con.SPI_SETDOUBLECLKWIDTH, x+1) win32gui.SystemParametersInfo(win32con.SPI_SETDOUBLECLKHEIGHT, y+2) new_x=win32api.GetSystemMetrics(win32con.SM_CXDOUBLECLK) new_y=win32api.GetSystemMetrics(win32con.SM_CYDOUBLECLK) ! print 'new x,y:', new_x, new_y assert new_x==x+1 assert new_y==y+2 --- 119,131 ---- ! print("SPI_SETDOUBLECLKWIDTH, SPI_SETDOUBLECLKHEIGHT") x=win32api.GetSystemMetrics(win32con.SM_CXDOUBLECLK) y=win32api.GetSystemMetrics(win32con.SM_CYDOUBLECLK) ! print('x,y:', x, y) win32gui.SystemParametersInfo(win32con.SPI_SETDOUBLECLKWIDTH, x+1) win32gui.SystemParametersInfo(win32con.SPI_SETDOUBLECLKHEIGHT, y+2) new_x=win32api.GetSystemMetrics(win32con.SM_CXDOUBLECLK) new_y=win32api.GetSystemMetrics(win32con.SM_CYDOUBLECLK) ! print('new x,y:', new_x, new_y) assert new_x==x+1 assert new_y==y+2 *************** *** 139,151 **** ! print "SPI_SETDRAGWIDTH, SPI_SETDRAGHEIGHT" dw=win32api.GetSystemMetrics(win32con.SM_CXDRAG) dh=win32api.GetSystemMetrics(win32con.SM_CYDRAG) ! print 'dw,dh:', dw, dh win32gui.SystemParametersInfo(win32con.SPI_SETDRAGWIDTH,dw+1) win32gui.SystemParametersInfo(win32con.SPI_SETDRAGHEIGHT,dh+2) new_dw=win32api.GetSystemMetrics(win32con.SM_CXDRAG) new_dh=win32api.GetSystemMetrics(win32con.SM_CYDRAG) ! print 'new dw,dh:', new_dw, new_dh assert new_dw==dw+1 assert new_dh==dh+2 --- 139,151 ---- ! print("SPI_SETDRAGWIDTH, SPI_SETDRAGHEIGHT") dw=win32api.GetSystemMetrics(win32con.SM_CXDRAG) dh=win32api.GetSystemMetrics(win32con.SM_CYDRAG) ! print('dw,dh:', dw, dh) win32gui.SystemParametersInfo(win32con.SPI_SETDRAGWIDTH,dw+1) win32gui.SystemParametersInfo(win32con.SPI_SETDRAGHEIGHT,dh+2) new_dw=win32api.GetSystemMetrics(win32con.SM_CXDRAG) new_dh=win32api.GetSystemMetrics(win32con.SM_CYDRAG) ! print('new dw,dh:', new_dw, new_dh) assert new_dw==dw+1 assert new_dh==dh+2 *************** *** 160,168 **** orig_wallpaper=win32gui.SystemParametersInfo(Action=win32con.SPI_GETDESKWALLPAPER) ! print 'Original: ',orig_wallpaper for bmp in glob.glob(os.path.join(os.environ['windir'],'*.bmp')): ! print bmp win32gui.SystemParametersInfo(win32con.SPI_SETDESKWALLPAPER, Param=bmp) ! print win32gui.SystemParametersInfo(Action=win32con.SPI_GETDESKWALLPAPER) time.sleep(1) --- 160,168 ---- orig_wallpaper=win32gui.SystemParametersInfo(Action=win32con.SPI_GETDESKWALLPAPER) ! print('Original: ',orig_wallpaper) for bmp in glob.glob(os.path.join(os.environ['windir'],'*.bmp')): ! print(bmp) win32gui.SystemParametersInfo(win32con.SPI_SETDESKWALLPAPER, Param=bmp) ! print(win32gui.SystemParametersInfo(Action=win32con.SPI_GETDESKWALLPAPER)) time.sleep(1) Index: win32gui_devicenotify.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32gui_devicenotify.py,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** win32gui_devicenotify.py 4 May 2008 10:45:54 -0000 1.1 --- win32gui_devicenotify.py 29 Aug 2008 04:59:23 -0000 1.1.2.1 *************** *** 15,22 **** # using the self-identifying data inside the DEV_BROADCAST_HDR. info = win32gui_struct.UnpackDEV_BROADCAST(lp) ! print "Device change notification:", wp, info if wp==win32con.DBT_DEVICEQUERYREMOVE and info.devicetype==win32con.DBT_DEVTYP_HANDLE: # Our handle is stored away in the structure - just close it ! print "Device being removed - closing handle" win32file.CloseHandle(info.handle) # and cancel our notifications - if it gets plugged back in we get --- 15,22 ---- # using the self-identifying data inside the DEV_BROADCAST_HDR. info = win32gui_struct.UnpackDEV_BROADCAST(lp) ! print("Device change notification:", wp, info) if wp==win32con.DBT_DEVICEQUERYREMOVE and info.devicetype==win32con.DBT_DEVTYP_HANDLE: # Our handle is stored away in the structure - just close it ! print("Device being removed - closing handle") win32file.CloseHandle(info.handle) # and cancel our notifications - if it gets plugged back in we get *************** *** 63,72 **** # now start a message pump and wait for messages to be delivered. ! print "Watching", len(hdevs), "handles - press Ctrl+C to terminate, or" ! print "add and remove some USB devices..." if not dir_names: ! print "(Note you can also pass paths to watch on the command-line - eg," ! print "pass the root of an inserted USB stick to see events specific to" ! print "that volume)" while 1: win32gui.PumpWaitingMessages() --- 63,72 ---- # now start a message pump and wait for messages to be delivered. ! print("Watching", len(hdevs), "handles - press Ctrl+C to terminate, or") ! print("add and remove some USB devices...") if not dir_names: ! print("(Note you can also pass paths to watch on the command-line - eg,") ! print("pass the root of an inserted USB stick to see events specific to") ! print("that volume)") while 1: win32gui.PumpWaitingMessages() Index: FileSecurityTest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/FileSecurityTest.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** FileSecurityTest.py 3 Feb 2003 00:30:29 -0000 1.2 --- FileSecurityTest.py 29 Aug 2008 04:59:23 -0000 1.2.4.1 *************** *** 9,28 **** if not os.path.exists(name): ! print name, "does not exist!" sys.exit() ! print "On file " , name, "\n" # get owner SID ! print "OWNER" sd= win32security.GetFileSecurity(name, win32security.OWNER_SECURITY_INFORMATION) sid= sd.GetSecurityDescriptorOwner() ! print " ", win32security.LookupAccountSid(None, sid) # get group SID ! print "GROUP" sd= win32security.GetFileSecurity(name, win32security.GROUP_SECURITY_INFORMATION) sid= sd.GetSecurityDescriptorGroup() ! print " ", win32security.LookupAccountSid(None, sid) # get ACEs --- 9,28 ---- if not os.path.exists(name): ! print(name, "does not exist!") sys.exit() ! print("On file " , name, "\n") # get owner SID ! print("OWNER") sd= win32security.GetFileSecurity(name, win32security.OWNER_SECURITY_INFORMATION) sid= sd.GetSecurityDescriptorOwner() ! print(" ", win32security.LookupAccountSid(None, sid)) # get group SID ! print("GROUP") sd= win32security.GetFileSecurity(name, win32security.GROUP_SECURITY_INFORMATION) sid= sd.GetSecurityDescriptorGroup() ! print(" ", win32security.LookupAccountSid(None, sid)) # get ACEs *************** *** 30,50 **** dacl= sd.GetSecurityDescriptorDacl() if dacl == None: ! print "No Discretionary ACL" else: for ace_no in range(0, dacl.GetAceCount()): ace= dacl.GetAce(ace_no) ! print "ACE", ace_no ! print " -Type" for i in ("ACCESS_ALLOWED_ACE_TYPE", "ACCESS_DENIED_ACE_TYPE", "SYSTEM_AUDIT_ACE_TYPE", "SYSTEM_ALARM_ACE_TYPE"): if getattr(ntsecuritycon, i) == ace[0][0]: ! print " ", i ! print " -Flags", hex(ace[0][1]) for i in ("OBJECT_INHERIT_ACE", "CONTAINER_INHERIT_ACE", "NO_PROPAGATE_INHERIT_ACE", "INHERIT_ONLY_ACE", "SUCCESSFUL_ACCESS_ACE_FLAG", "FAILED_ACCESS_ACE_FLAG"): if getattr(ntsecuritycon, i) & ace[0][1] == getattr(ntsecuritycon, i): ! print " ", i ! print " -mask", hex(ace[1]) # files and directories do permissions differently --- 30,50 ---- dacl= sd.GetSecurityDescriptorDacl() if dacl == None: ! print("No Discretionary ACL") else: for ace_no in range(0, dacl.GetAceCount()): ace= dacl.GetAce(ace_no) ! print("ACE", ace_no) ! print(" -Type") for i in ("ACCESS_ALLOWED_ACE_TYPE", "ACCESS_DENIED_ACE_TYPE", "SYSTEM_AUDIT_ACE_TYPE", "SYSTEM_ALARM_ACE_TYPE"): if getattr(ntsecuritycon, i) == ace[0][0]: ! print(" ", i) ! print(" -Flags", hex(ace[0][1])) for i in ("OBJECT_INHERIT_ACE", "CONTAINER_INHERIT_ACE", "NO_PROPAGATE_INHERIT_ACE", "INHERIT_ONLY_ACE", "SUCCESSFUL_ACCESS_ACE_FLAG", "FAILED_ACCESS_ACE_FLAG"): if getattr(ntsecuritycon, i) & ace[0][1] == getattr(ntsecuritycon, i): ! print(" ", i) ! print(" -mask", hex(ace[1])) # files and directories do permissions differently *************** *** 64,68 **** if getattr(ntsecuritycon, i) & ace[1] == getattr(ntsecuritycon, i): calc_mask= calc_mask | getattr(ntsecuritycon, i) ! print " ", i ! print " ", "Calculated Check Mask=", hex(calc_mask) ! print " -SID\n ", win32security.LookupAccountSid(None, ace[2]) --- 64,68 ---- if getattr(ntsecuritycon, i) & ace[1] == getattr(ntsecuritycon, i): calc_mask= calc_mask | getattr(ntsecuritycon, i) ! print(" ", i) ! print(" ", "Calculated Check Mask=", hex(calc_mask)) ! print(" -SID\n ", win32security.LookupAccountSid(None, ace[2])) Index: win32servicedemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32servicedemo.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** win32servicedemo.py 3 Feb 2003 00:30:29 -0000 1.2 --- win32servicedemo.py 29 Aug 2008 04:59:23 -0000 1.2.4.1 *************** *** 18,22 **** statuses = win32service.EnumServicesStatus(hscm, typeFilter, stateFilter) for (short_name, desc, status) in statuses: ! print short_name, desc, status --- 18,22 ---- statuses = win32service.EnumServicesStatus(hscm, typeFilter, stateFilter) for (short_name, desc, status) in statuses: ! print(short_name, desc, status) Index: getfilever.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/getfilever.py,v retrieving revision 1.1 retrieving revision 1.1.4.1 diff -C2 -d -r1.1 -r1.1.4.1 *** getfilever.py 18 Oct 2003 06:15:48 -0000 1.1 --- getfilever.py 29 Aug 2008 04:59:23 -0000 1.1.4.1 *************** *** 8,13 **** d=win32api.GetFileVersionInfo(fname, '\\') ## backslash as parm returns dictionary of numeric info corresponding to VS_FIXEDFILEINFO struc ! for n, v in d.items(): ! print n, v pairs=win32api.GetFileVersionInfo(fname, '\\VarFileInfo\\Translation') --- 8,13 ---- d=win32api.GetFileVersionInfo(fname, '\\') ## backslash as parm returns dictionary of numeric info corresponding to VS_FIXEDFILEINFO struc ! for n, v in list(d.items()): ! print(n, v) pairs=win32api.GetFileVersionInfo(fname, '\\VarFileInfo\\Translation') *************** *** 15,23 **** ## any other must be of the form \StringfileInfo\%04X%04X\parm_name, middle two are language/codepage pair returned from above for lang, codepage in pairs: ! print 'lang: ', lang, 'codepage:', codepage for ver_string in ver_strings: ! str_info=u'\\StringFileInfo\\%04X%04X\\%s' %(lang,codepage,ver_string) ## print str_info ! print ver_string, win32api.GetFileVersionInfo(fname, str_info) --- 15,23 ---- ## any other must be of the form \StringfileInfo\%04X%04X\parm_name, middle two are language/codepage pair returned from above for lang, codepage in pairs: ! print('lang: ', lang, 'codepage:', codepage) for ver_string in ver_strings: ! str_info='\\StringFileInfo\\%04X%04X\\%s' %(lang,codepage,ver_string) ## print str_info ! print(ver_string, win32api.GetFileVersionInfo(fname, str_info)) Index: print_desktop.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/print_desktop.py,v retrieving revision 1.5 retrieving revision 1.5.4.1 diff -C2 -d -r1.5 -r1.5.4.1 *** print_desktop.py 19 Dec 2006 13:51:22 -0000 1.5 --- print_desktop.py 29 Aug 2008 04:59:23 -0000 1.5.4.1 *************** *** 2,8 **** pname=win32print.GetDefaultPrinter() ! print pname p=win32print.OpenPrinter(pname) ! print 'Printer handle: ',p print_processor=win32print.GetPrinter(p,2)['pPrintProcessor'] ## call with last parm set to 0 to get total size needed for printer's DEVMODE --- 2,8 ---- pname=win32print.GetDefaultPrinter() ! print(pname) p=win32print.OpenPrinter(pname) ! print('Printer handle: ',p) print_processor=win32print.GetPrinter(p,2)['pPrintProcessor'] ## call with last parm set to 0 to get total size needed for printer's DEVMODE Index: cerapi.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/cerapi.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** cerapi.py 3 Feb 2003 00:30:29 -0000 1.2 --- cerapi.py 29 Aug 2008 04:59:23 -0000 1.2.4.1 *************** *** 10,14 **** import sys import getopt ! from repr import repr --- 10,14 ---- import sys import getopt ! from reprlib import repr *************** *** 17,24 **** h = wincerapi.CeRegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, "Software\\Python\\PythonCore\\%s\\PythonPath" % sys.winver) except win32api.error: ! print "The remote device does not appear to have Python installed" return 0 path, typ = wincerapi.CeRegQueryValueEx(h, None) ! print "The remote PythonPath is '%s'" % (str(path), ) h.Close() return 1 --- 17,24 ---- h = wincerapi.CeRegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, "Software\\Python\\PythonCore\\%s\\PythonPath" % sys.winver) except win32api.error: ! print("The remote device does not appear to have Python installed") return 0 path, typ = wincerapi.CeRegQueryValueEx(h, None) ! print("The remote PythonPath is '%s'" % (str(path), )) h.Close() return 1 *************** *** 35,39 **** except win32api.error: break ! print "%s%s=%s" % (level_prefix, name, repr(str(data))) index = index+1 # Now enumerate all keys. --- 35,39 ---- except win32api.error: break ! print("%s%s=%s" % (level_prefix, name, repr(str(data)))) index = index+1 # Now enumerate all keys. *************** *** 44,48 **** except win32api.error: break ! print "%s%s\\" % (level_prefix, name) subkey = wincerapi.CeRegOpenKeyEx(root, name) DumpRegistry(subkey, level+1) --- 44,48 ---- except win32api.error: break ! print("%s%s\\" % (level_prefix, name)) subkey = wincerapi.CeRegOpenKeyEx(root, name) DumpRegistry(subkey, level+1) *************** *** 57,65 **** cefile = wincerapi.CeCreateFile("TestPython", win32con.GENERIC_READ, 0, None, win32con.OPEN_EXISTING, 0, None) if wincerapi.CeReadFile(cefile, 100) != "Hello from Python": ! print "Couldnt read the data from the device!" cefile.Close() # Delete the test file wincerapi.CeDeleteFile("TestPython") ! print "Created, wrote to, read from and deleted a test file!" def DemoCreateProcess(): --- 57,65 ---- cefile = wincerapi.CeCreateFile("TestPython", win32con.GENERIC_READ, 0, None, win32con.OPEN_EXISTING, 0, None) if wincerapi.CeReadFile(cefile, 100) != "Hello from Python": ! print("Couldnt read the data from the device!") cefile.Close() # Delete the test file wincerapi.CeDeleteFile("TestPython") ! print("Created, wrote to, read from and deleted a test file!") def DemoCreateProcess(): *************** *** 71,77 **** hp.Close() ht.Close() ! print "Python is running on the remote device!" ! except win32api.error, (hr, fn, msg): ! print "Couldnt execute remote process -", msg def DumpRemoteMachineStatus(): --- 71,78 ---- hp.Close() ht.Close() ! print("Python is running on the remote device!") ! except win32api.error as xxx_todo_changeme: ! (hr, fn, msg) = xxx_todo_changeme.args ! print("Couldnt execute remote process -", msg) def DumpRemoteMachineStatus(): *************** *** 86,123 **** else: batPerc = BatteryLifePercent ! print "The batteries are at %s%%, and is currently being powered by %s" % (batPerc, power) memLoad, totalPhys, availPhys, totalPage, availPage, totalVirt, availVirt = \ wincerapi.CeGlobalMemoryStatus() ! print "The memory is %d%% utilized." % (memLoad) ! print "%-20s%-10s%-10s" % ("", "Total", "Avail") ! print "%-20s%-10s%-10s" % ("Physical Memory", totalPhys, availPhys) ! print "%-20s%-10s%-10s" % ("Virtual Memory", totalVirt, availVirt) ! print "%-20s%-10s%-10s" % ("Paging file", totalPage, availPage) storeSize, freeSize = wincerapi.CeGetStoreInformation() ! print "%-20s%-10s%-10s" % ("File store", storeSize, freeSize) ! print "The CE temp path is", wincerapi.CeGetTempPath() ! print "The system info for the device is", wincerapi.CeGetSystemInfo() def DumpRemoteFolders(): # Dump all special folders possible. ! for name, val in wincerapi.__dict__.items(): if name[:6]=="CSIDL_": try: loc = str(wincerapi.CeGetSpecialFolderPath(val)) ! print "Folder %s is at %s" % (name, loc) ! except win32api.error, details: pass # Get the shortcut targets for the "Start Menu" ! print "Dumping start menu shortcuts..." try: startMenu = str(wincerapi.CeGetSpecialFolderPath(wincerapi.CSIDL_STARTMENU)) ! except win32api.error, details: ! print "This device has no start menu!", details startMenu = None --- 87,124 ---- else: batPerc = BatteryLifePercent ! print("The batteries are at %s%%, and is currently being powered by %s" % (batPerc, power)) memLoad, totalPhys, availPhys, totalPage, availPage, totalVirt, availVirt = \ wincerapi.CeGlobalMemoryStatus() ! print("The memory is %d%% utilized." % (memLoad)) ! print("%-20s%-10s%-10s" % ("", "Total", "Avail")) ! print("%-20s%-10s%-10s" % ("Physical Memory", totalPhys, availPhys)) ! print("%-20s%-10s%-10s" % ("Virtual Memory", totalVirt, availVirt)) ! print("%-20s%-10s%-10s" % ("Paging file", totalPage, availPage)) storeSize, freeSize = wincerapi.CeGetStoreInformation() ! print("%-20s%-10s%-10s" % ("File store", storeSize, freeSize)) ! print("The CE temp path is", wincerapi.CeGetTempPath()) ! print("The system info for the device is", wincerapi.CeGetSystemInfo()) def DumpRemoteFolders(): # Dump all special folders possible. ! for name, val in list(wincerapi.__dict__.items()): if name[:6]=="CSIDL_": try: loc = str(wincerapi.CeGetSpecialFolderPath(val)) ! print("Folder %s is at %s" % (name, loc)) ! except win32api.error as details: pass # Get the shortcut targets for the "Start Menu" ! print("Dumping start menu shortcuts...") try: startMenu = str(wincerapi.CeGetSpecialFolderPath(wincerapi.CSIDL_STARTMENU)) ! except win32api.error as details: ! print("This device has no start menu!", details) startMenu = None *************** *** 128,134 **** try: resolved = wincerapi.CeSHGetShortcutTarget(fullPath) ! except win32api.error, (rc, fn, msg): resolved = "#Error - %s" % msg ! print "%s->%s" % (fileName, resolved) # print "The start menu is at", --- 129,136 ---- try: resolved = wincerapi.CeSHGetShortcutTarget(fullPath) ! except win32api.error as xxx_todo_changeme1: ! (rc, fn, msg) = xxx_todo_changeme1.args resolved = "#Error - %s" % msg ! print("%s->%s" % (fileName, resolved)) # print "The start menu is at", *************** *** 136,146 **** def usage(): ! print "Options:" ! print "-a - Execute all demos" ! print "-p - Execute Python process on remote device" ! print "-r - Dump the remote registry" ! print "-f - Dump all remote special folder locations" ! print "-s - Dont dump machine status" ! print "-y - Perform asynch init of CE connection" def main(): --- 138,148 ---- def usage(): ! print("Options:") ! print("-a - Execute all demos") ! print("-p - Execute Python process on remote device") ! print("-r - Dump the remote registry") ! print("-f - Dump all remote special folder locations") ! print("-s - Dont dump machine status") ! print("-y - Perform asynch init of CE connection") def main(): *************** *** 149,154 **** try: opts, args = getopt.getopt(sys.argv[1:], "apr") ! except getopt.error, why: ! print "Invalid usage:", why usage() return --- 151,156 ---- try: opts, args = getopt.getopt(sys.argv[1:], "apr") ! except getopt.error as why: ! print("Invalid usage:", why) usage() return *************** *** 166,170 **** bDumpFolders = 1 if o=="-y": ! print "Doing asynch init of CE connection" async_init = 1 --- 168,172 ---- bDumpFolders = 1 if o=="-y": ! print("Doing asynch init of CE connection") async_init = 1 *************** *** 177,211 **** break else: ! print "Waiting for Initialize to complete (picture a Cancel button here :)" else: wincerapi.CeRapiInit() ! print "Connected to remote CE device." try: verinfo = wincerapi.CeGetVersionEx() ! print "The device is running windows CE version %d.%d - %s" % (verinfo[0], verinfo[1], verinfo[4]) if bDumpStatus: ! print "Dumping remote machine status" DumpRemoteMachineStatus() if bDumpRegistry: ! print "Dumping remote registry..." DumpRegistry(win32con.HKEY_LOCAL_MACHINE) if bDumpFolders: ! print "Dumping remote folder information" DumpRemoteFolders() DemoCopyFile() if bStartPython: ! print "Starting remote Python process" if DumpPythonRegistry(): DemoCreateProcess() else: ! print "Not trying to start Python, as it's not installed" finally: wincerapi.CeRapiUninit() ! print "Disconnected" if __name__=='__main__': --- 179,213 ---- break else: ! print("Waiting for Initialize to complete (picture a Cancel button here :)") else: wincerapi.CeRapiInit() ! print("Connected to remote CE device.") try: verinfo = wincerapi.CeGetVersionEx() ! print("The device is running windows CE version %d.%d - %s" % (verinfo[0], verinfo[1], verinfo[4])) if bDumpStatus: ! print("Dumping remote machine status") DumpRemoteMachineStatus() if bDumpRegistry: ! print("Dumping remote registry...") DumpRegistry(win32con.HKEY_LOCAL_MACHINE) if bDumpFolders: ! print("Dumping remote folder information") DumpRemoteFolders() DemoCopyFile() if bStartPython: ! print("Starting remote Python process") if DumpPythonRegistry(): DemoCreateProcess() else: ! print("Not trying to start Python, as it's not installed") finally: wincerapi.CeRapiUninit() ! print("Disconnected") if __name__=='__main__': Index: winprocess.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/winprocess.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** winprocess.py 3 Feb 2003 00:30:29 -0000 1.2 --- winprocess.py 29 Aug 2008 04:59:24 -0000 1.2.4.1 *************** *** 164,168 **** if child.wait(mSec) != win32event.WAIT_OBJECT_0: child.kill() ! raise WindowsError, 'process timeout exceeded' return child.exitCode() --- 164,168 ---- if child.wait(mSec) != win32event.WAIT_OBJECT_0: child.kill() ! raise WindowsError('process timeout exceeded') return child.exitCode() *************** *** 171,175 **** # Pipe commands to a shell and display the output in notepad ! print 'Testing winprocess.py...' import tempfile --- 171,175 ---- # Pipe commands to a shell and display the output in notepad ! print('Testing winprocess.py...') import tempfile *************** *** 184,195 **** """ % timeoutSeconds ! cmd, out = tempfile.TemporaryFile(), tempfile.TemporaryFile() ! cmd.write(cmdString) cmd.seek(0) ! print 'CMD.EXE exit code:', run('cmd.exe', show=0, stdin=cmd, ! stdout=out, stderr=out) cmd.close() ! print 'NOTEPAD exit code:', run('notepad.exe %s' % out.file.name, show=win32con.SW_MAXIMIZE, ! mSec=timeoutSeconds*1000) out.close() --- 184,197 ---- """ % timeoutSeconds ! cmd = tempfile.NamedTemporaryFile(delete=False) ! out = tempfile.NamedTemporaryFile(suffix='.txt', delete=False) ! cmd.write(cmdString.encode('mbcs')) cmd.seek(0) ! print('CMD.EXE exit code:', run('cmd.exe', show=0, stdin=cmd, ! stdout=out, stderr=out)) cmd.close() ! out.close() ! print('NOTEPAD exit code:', run('notepad.exe %s' % out.name, show=win32con.SW_MAXIMIZE, ! mSec=timeoutSeconds*1000)) out.close() Index: win32gui_taskbar.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32gui_taskbar.py,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** win32gui_taskbar.py 30 Oct 2007 09:27:13 -0000 1.9 --- win32gui_taskbar.py 29 Aug 2008 04:59:23 -0000 1.9.2.1 *************** *** 45,49 **** hicon = LoadImage(hinst, iconPathName, win32con.IMAGE_ICON, 0, 0, icon_flags) else: ! print "Can't find a Python icon file - using default" hicon = LoadIcon(0, win32con.IDI_APPLICATION) --- 45,49 ---- hicon = LoadImage(hinst, iconPathName, win32con.IMAGE_ICON, 0, 0, icon_flags) else: ! print("Can't find a Python icon file - using default") hicon = LoadIcon(0, win32con.IDI_APPLICATION) *************** *** 55,59 **** # This is common when windows is starting, and this code is hit # before the taskbar has been created. ! print "Failed to add the taskbar icon - is explorer running?" # but keep running anyway - when explorer starts, we get the # TaskbarCreated message. --- 55,59 ---- # This is common when windows is starting, and this code is hit # before the taskbar has been created. ! print("Failed to add the taskbar icon - is explorer running?") # but keep running anyway - when explorer starts, we get the # TaskbarCreated message. *************** *** 69,78 **** def OnTaskbarNotify(self, hwnd, msg, wparam, lparam): if lparam==win32con.WM_LBUTTONUP: ! print "You clicked me." elif lparam==win32con.WM_LBUTTONDBLCLK: ! print "You double-clicked me - goodbye" DestroyWindow(self.hwnd) elif lparam==win32con.WM_RBUTTONUP: ! print "You right clicked me." menu = CreatePopupMenu() AppendMenu( menu, win32con.MF_STRING, 1023, "Display Dialog") --- 69,78 ---- def OnTaskbarNotify(self, hwnd, msg, wparam, lparam): if lparam==win32con.WM_LBUTTONUP: ! print("You clicked me.") elif lparam==win32con.WM_L... [truncated message content] |