Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/mhammond/pywin32 into undef…
Browse files Browse the repository at this point in the history
…ined-names
  • Loading branch information
Avasam committed Feb 5, 2024
2 parents 623fb6a + 3e9da59 commit 4a364be
Show file tree
Hide file tree
Showing 164 changed files with 829 additions and 757 deletions.
2 changes: 1 addition & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Build 305, released 2022-11-06
from there. (#1908)

* Dropped support for allowing a bytes object to be passed where a COM BSTR
is expected - this support was accidental on the path from 2.x->3.x.
is expected - this support was accidental on the path from Python 2 -> 3.

* win32crypt's PyCERTSTORE.CertCloseStore()'s `Flags` argument has been
deprecated as it is likely to crash the process if
Expand Down
7 changes: 3 additions & 4 deletions Pythonwin/pywin/Demos/fontdemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,12 @@ def FontDemo():
template = docview.DocTemplate(win32ui.IDR_PYTHONTYPE, None, None, FontView)
doc = template.OpenDocumentFile(None)
doc.SetTitle("Font Demo")
# print "template is ", template, "obj is", template._obj_
# print("template is ", template, "obj is", template._obj_)
template.close()
# print("closed")
# del template


# print "closed"
# del template

if __name__ == "__main__":
import demoutils

Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/Demos/guidemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
("Dynamic window creation", "import createwin;createwin.demo()"),
("Various Dialog demos", "import dlgtest;dlgtest.demo()"),
("OCX Control Demo", "from ocx import ocxtest;ocxtest.demo()"),
("OCX Serial Port Demo", "from ocx import ocxserialtest; ocxserialtest.test()"),
("OCX Serial Port Demo", "from ocx import ocxserialtest; ocxserialtest.test()"),
(
"IE4 Control Demo",
'from ocx import webbrowser; webbrowser.Demo("http://www.python.org")',
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/Demos/ocx/webbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def OnBeforeNavigate2(
self, pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel
):
self.GetParent().OnNavigate(URL)
# print "BeforeNavigate2", pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel
# print("BeforeNavigate2", pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel)


class BrowserFrame(window.MDIChildWnd):
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/Demos/splittst.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def __init__(self):
)

def InitialUpdateFrame(self, frame, doc, makeVisible):
# print "frame is ", frame, frame._obj_
# print "doc is ", doc, doc._obj_
# print("frame is ", frame, frame._obj_)
# print("doc is ", doc, doc._obj_)
self._obj_.InitialUpdateFrame(frame, doc, makeVisible) # call default handler.
frame.InitialUpdateFrame(doc, makeVisible)

Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/Demos/threadedgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def OnTimer(self, id, timeVal):
self.InvalidateRect()

def OnPaint(self):
# print "Paint message from thread", win32api.GetCurrentThreadId()
# print("Paint message from thread", win32api.GetCurrentThreadId())
dc, paintStruct = self.BeginPaint()
self.OnPrepareDC(dc, None)

Expand Down
6 changes: 3 additions & 3 deletions Pythonwin/pywin/debugger/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ def __init__(self, debugger):
HierListItem.__init__(self, debugger, None)
self.last_stack = []

## def __del__(self):
## print "HierStackRoot dieing"
# def __del__(self):
# print("HierStackRoot dieing")
def GetSubList(self):
debugger = self.myobject
# print self.debugger.stack, self.debugger.curframe
# print(self.debugger.stack, self.debugger.curframe)
ret = []
if debugger.debuggerState == DBGSTATE_BREAK:
stackUse = debugger.stack[:]
Expand Down
18 changes: 9 additions & 9 deletions Pythonwin/pywin/docking/DockingBar.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ def OnWindowPosChanged(self, msg):
return 0
lparam = msg[3]
""" LPARAM used with WM_WINDOWPOSCHANGED:
typedef struct {
HWND hwnd;
HWND hwndInsertAfter;
int x;
int y;
int cx;
int cy;
UINT flags;} WINDOWPOS;
"""
typedef struct {
HWND hwnd;
HWND hwndInsertAfter;
int x;
int y;
int cx;
int cy;
UINT flags;} WINDOWPOS;
"""
format = "PPiiiii"
bytes = win32ui.GetBytes(lparam, struct.calcsize(format))
hwnd, hwndAfter, x, y, cx, cy, flags = struct.unpack(format, bytes)
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/editor/ModuleBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def DestroyBrowser(self):
self.DestroyList()

def OnActivateView(self, activate, av, dv):
# print "AV", self.bDirty, activate
# print("AV", self.bDirty, activate)
if activate:
self.CheckRefreshList()
return self._obj_.OnActivateView(activate, av, dv)
Expand Down
14 changes: 4 additions & 10 deletions Pythonwin/pywin/framework/editor/color/coloreditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
from pywin.debugger import dbgcon
from pywin.framework.editor import GetEditorOption
from pywin.framework.editor.document import EditorDocumentBase
from pywin.framework.editor.frame import EditorFrame
from pywin.framework.editor.template import EditorTemplateBase
from pywin.scintilla import bindings, scintillacon
from pywin.scintilla.view import CScintillaView as SyntEditViewParent

# WARNING: Duplicated in document.py and editor.py
MSG_CHECK_EXTERNAL_FILE = win32con.WM_USER + 1999
Expand All @@ -36,9 +39,6 @@ def FinalizeViewCreation(self, view):
self.GetDocTemplate().CheckIDLEMenus(view.idle)


SyntEditViewParent = pywin.scintilla.view.CScintillaView


class SyntEditView(SyntEditViewParent):
"A view of a SyntEdit. Obtains data from document."

Expand Down Expand Up @@ -462,7 +462,7 @@ def FoldTopLevelEvent(self, event=None):
- scintillacon.SC_FOLDLEVELBASE
)
is_header = level & scintillacon.SC_FOLDLEVELHEADERFLAG
# print lineSeek, level_no, is_header
# print(lineSeek, level_no, is_header)
if level_no == 0 and is_header:
if (expanding and not self.SCIGetFoldExpanded(lineSeek)) or (
not expanding and self.SCIGetFoldExpanded(lineSeek)
Expand Down Expand Up @@ -571,9 +571,6 @@ def FoldCollapseAllEvent(self, event):
win32ui.DoWaitCursor(-1)


from pywin.framework.editor.frame import EditorFrame


class SplitterFrame(EditorFrame):
def OnCreate(self, cs):
self.HookCommand(self.OnWindowSplit, win32ui.ID_WINDOW_SPLIT)
Expand All @@ -584,9 +581,6 @@ def OnWindowSplit(self, id, code):
return 1


from pywin.framework.editor.template import EditorTemplateBase


class SyntEditTemplate(EditorTemplateBase):
def __init__(
self, res=win32ui.IDR_TEXTTYPE, makeDoc=None, makeFrame=None, makeView=None
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/editor/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def Indent(self):
else:
curCol = curCol + 1
nextColumn = ((curCol / self.indentSize) + 1) * self.indentSize
# print "curCol is", curCol, "nextColumn is", nextColumn
# print("curCol is", curCol, "nextColumn is", nextColumn)
ins = None
if self.bSmartTabs:
# Look for some context.
Expand Down
22 changes: 11 additions & 11 deletions Pythonwin/pywin/framework/editor/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ def OnCreateClient(self, cp, context):
splitter.CreateView(browserView, 0, 0, (0, 0))
sub_splitter.CreateView(view2, 0, 0, (0, 0))

## print "First view is", context.doc.GetFirstView()
## print "Views are", view, view2, browserView
## print "Parents are", view.GetParent(), view2.GetParent(), browserView.GetParent()
## print "Splitter is", splitter
## print "sub splitter is", sub_splitter
## Old
## splitter.CreateStatic (self, 1, 2)
## splitter.CreateView(view, 0, 1, (0,0)) # size ignored.
## splitter.CreateView (browserView, 0, 0, (0, 0))
# print("First view is", context.doc.GetFirstView())
# print("Views are", view, view2, browserView)
# print("Parents are", view.GetParent(), view2.GetParent(), browserView.GetParent())
# print("Splitter is", splitter)
# print("sub splitter is", sub_splitter)
# Old
# splitter.CreateStatic (self, 1, 2)
# splitter.CreateView(view, 0, 1, (0,0)) # size ignored.
# splitter.CreateView (browserView, 0, 0, (0, 0))

# Restrict the size of the browser splitter (and we can avoid filling
# it until it is shown)
Expand Down Expand Up @@ -62,8 +62,8 @@ def GetBrowserView(self):
def OnClose(self):
doc = self.GetActiveDocument()
if not doc.SaveModified():
## Cancel button selected from Save dialog, do not actually close
## print 'close cancelled'
# Cancel button selected from Save dialog, do not actually close
# print("close cancelled")
return 0
## So the 'Save' dialog doesn't come up twice
doc._obj_.SetModifiedFlag(False)
Expand Down
6 changes: 3 additions & 3 deletions Pythonwin/pywin/framework/editor/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def OpenDocumentFile(self, filename, bMakeVisible=1):
if filename is not None:
try:
path = os.path.split(filename)[0]
# print "The editor is translating", `filename`,"to",
# print("The editor is translating", "filename", "to")
filename = win32api.FindFiles(filename)[0][8]
filename = os.path.join(path, filename)
# print `filename`
# print("filename")
except (win32api.error, IndexError) as details:
# print("Couldnt get the full filename!", details)
pass
# print "Couldnt get the full filename!", details
return self._obj_.OpenDocumentFile(filename, bMakeVisible)
2 changes: 1 addition & 1 deletion Pythonwin/pywin/framework/intpydde.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, app):

def Exec(self, data):
try:
# print "Executing", cmd
# print("Executing", cmd)
self.app.OnDDECommand(data)
except:
t, v, tb = sys.exc_info()
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/framework/mdi_pychecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,10 @@ def GetParams(self):
)

def OnSaveDocument(self, filename):
# print 'OnSaveDocument() filename=',filename
# print("OnSaveDocument() filename=",filename)
savefile = open(filename, "wb")
txt = self.GetParams() + "\n"
# print 'writing',txt
# print("writing",txt)
savefile.write(txt)
savefile.close()
self.SetModifiedFlag(0)
Expand Down
1 change: 1 addition & 0 deletions Pythonwin/pywin/framework/scriptutils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Various utilities for running/importing a script
"""

import bdb
import linecache
import os
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/framework/sgrepmdi.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ def GetParams(self):
)

def OnSaveDocument(self, filename):
# print 'OnSaveDocument() filename=',filename
# print("OnSaveDocument() filename=", filename)
savefile = open(filename, "wb")
txt = self.GetParams() + "\n"
# print 'writing',txt
# print("writing", txt)
savefile.write(txt)
savefile.close()
self.SetModifiedFlag(0)
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/pywin/framework/toolmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def OnOK(self):
return self._obj_.OnOK()

def OnCommandEditControls(self, id, cmd):
# print "OnEditControls", id, cmd
# print("OnEditControls", id, cmd)
if cmd == win32con.EN_CHANGE and not self.bImChangingEditControls:
itemNo = self.listControl.GetNextItem(-1, commctrl.LVNI_SELECTED)
newText = self.editMenuCommand.GetWindowText()
Expand All @@ -228,7 +228,7 @@ def OnNotifyListControlEndLabelEdit(self, id, cmd):
self.listControl.SetItemText(itemNo, 0, newText)

def OnNotifyListControl(self, id, cmd):
# print id, cmd
# print(id, cmd)
try:
itemNo = self.listControl.GetNextItem(-1, commctrl.LVNI_SELECTED)
except win32ui.error: # No selection!
Expand Down
1 change: 1 addition & 0 deletions Pythonwin/pywin/mfc/activex.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Support for ActiveX control hosting in Pythonwin.
"""

import win32ui
import win32uiole

Expand Down
1 change: 1 addition & 0 deletions Pythonwin/pywin/mfc/dialog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" \
Base class for Dialogs. Also contains a few useful utility functions
"""

# dialog.py
# Python class for Dialog Boxes in PythonWin.

Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/mfc/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __getattr__(
raise AttributeError(attr)

def OnAttachedObjectDeath(self):
# print "object", self.__class__.__name__, "dieing"
# print("object", self.__class__.__name__, "dieing")
self._obj_ = None

def close(self):
Expand Down
48 changes: 24 additions & 24 deletions Pythonwin/pywin/scintilla/IDLEenvironment.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,30 +533,30 @@ def test():
e.SetSel((4, 4))

skip = """
TestCheck("insert", e, 4)
TestCheck("insert wordstart", e, 3)
TestCheck("insert wordend", e, 8)
TestCheck("insert linestart", e, 0)
TestCheck("insert lineend", e, 12)
TestCheck("insert + 4 chars", e, 8)
TestCheck("insert +4c", e, 8)
TestCheck("insert - 2 chars", e, 2)
TestCheck("insert -2c", e, 2)
TestCheck("insert-2c", e, 2)
TestCheck("insert-2 c", e, 2)
TestCheck("insert- 2c", e, 2)
TestCheck("1.1", e, 1)
TestCheck("1.0", e, 0)
TestCheck("2.0", e, 13)
try:
TestCheck("sel.first", e, 0)
print "*** sel.first worked with an empty selection"
except TextError:
pass
e.SetSel((4,5))
TestCheck("sel.first- 2c", e, 2)
TestCheck("sel.last- 2c", e, 3)
"""
TestCheck("insert", e, 4)
TestCheck("insert wordstart", e, 3)
TestCheck("insert wordend", e, 8)
TestCheck("insert linestart", e, 0)
TestCheck("insert lineend", e, 12)
TestCheck("insert + 4 chars", e, 8)
TestCheck("insert +4c", e, 8)
TestCheck("insert - 2 chars", e, 2)
TestCheck("insert -2c", e, 2)
TestCheck("insert-2c", e, 2)
TestCheck("insert-2 c", e, 2)
TestCheck("insert- 2c", e, 2)
TestCheck("1.1", e, 1)
TestCheck("1.0", e, 0)
TestCheck("2.0", e, 13)
try:
TestCheck("sel.first", e, 0)
print("*** sel.first worked with an empty selection")
except TextError:
pass
e.SetSel((4,5))
TestCheck("sel.first- 2c", e, 2)
TestCheck("sel.last- 2c", e, 3)
"""
# Check EOL semantics
e.SetSel((4, 4))
TestGet("insert lineend", "insert lineend +1c", t, "\n")
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/scintilla/configui.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def UpdateUIForStyle(self, style):
sel = 0
for c in paletteVGA:
if format[4] == c[1]:
# print "Style", style.name, "is", c[0]
# print("Style", style.name, "is", c[0])
break
sel = sel + 1
else:
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/scintilla/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def DeleteContents(self):

def OnOpenDocument(self, filename):
# init data members
# print "Opening", filename
# print("Opening", filename)
self.SetPathName(filename) # Must set this early!
try:
# load the text as binary we can get smart
Expand Down
Loading

0 comments on commit 4a364be

Please sign in to comment.