Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/mhammond/pywin32 into remov…
Browse files Browse the repository at this point in the history
…e-axscript-ie
  • Loading branch information
Avasam committed Jan 19, 2025
2 parents 16e3c61 + fabbd69 commit 5f57a6a
Show file tree
Hide file tree
Showing 117 changed files with 5,457 additions and 1,040 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: python-win32 mailing list
url: http://mail.python.org/mailman/listinfo/python-win32
about: For support requests, problems or questions
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
name: New issue
about: Do not open github issues for general support requests
---

<!--
Note that issues in this repository are only for bugs or feature requests in the pywin32.
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,18 @@ jobs:
# This needs to happen *after* installing pywin32 since
# AutoDuck/py2d.py currently relies on runtime imports for introspection
# This isn't included in the wheel (TODO: could we?)
# and only servces as a PR test for the docs.yaml workflow
# and only serves as a PR test for the docs.yaml workflow
- name: Generate PyWin32.chm help file
run: python AutoDuck/make.py

# Smokescreen test to validate it doesn't crash and dlls can be found
- name: Run postinstall install/remove
run: |
$UserSite = "$(python -m site --user-site)"
cd "$UserSite/.."
python Scripts/pywin32_postinstall.py -install -destination "$UserSite"
python Scripts/pywin32_postinstall.py -remove -destination "$UserSite"
- name: Run tests
# Run the tests directly from the source dir so support files (eg, .wav files etc)
# can be found - they aren't installed into the Python tree.
Expand Down Expand Up @@ -119,9 +127,9 @@ jobs:
cache-dependency-path: .github/workflows/main.yml
- run: pip install clang-format==18.1.* pycln
- run: pycln . --config=pycln.toml --check
- uses: astral-sh/ruff-action@v2
- uses: astral-sh/ruff-action@v3
with:
version: "0.8.2"
version: "0.8.4"
- run: ruff format --check
- run:
| # Too many files to fit in a single command, also exclude vendored Scintilla and MAPIStubLibrary
Expand All @@ -145,7 +153,7 @@ jobs:
cache: pip
cache-dependency-path: .github/workflows/main.yml
check-latest: true
- run: pip install types-setuptools PyOpenGL mypy==1.11
- run: pip install types-setuptools PyOpenGL mypy[faster-cache]==1.14.*
- run: mypy . --python-version=${{ matrix.python-version }}

pyright:
Expand All @@ -168,5 +176,5 @@ jobs:
- uses: jakebailey/pyright-action@v2
with:
python-version: ${{ matrix.python-version }}
version: "1.1.358"
version: "1.1.389"
annotate: errors
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ win32/src/win32service_messages.h
win32/src/win32evtlog_messages.h
isapi/src/pyISAPI_messages.h

# VC2003 and up project files
# Visual Studio project files
*.sln
*.suo
*.vcproj
Expand Down
13 changes: 7 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# You can run this locally with `pre-commit run [--all]`
# You can run this locally with `pre-commit run --all`
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
Expand All @@ -10,10 +10,11 @@ repos:
args: [--fix=crlf]
- id: check-case-conflict
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.13.0
rev: v2.14.0
hooks:
- id: pretty-format-toml
args: [--autofix, --trailing-commas, --inline-comment-spaces, "1", --no-sort]
# Has unsafe autofixes. Let's find a better formatter: macisamuele/language-formatters-pre-commit-hooks#202
# - id: pretty-format-toml
# args: [--autofix, --trailing-commas, --inline-comment-spaces, "1", --no-sort]
- id: pretty-format-yaml
args: [--autofix, --indent, "2", --offset, "2", --preserve-quotes]
- id: pretty-format-ini
Expand All @@ -25,7 +26,7 @@ repos:
args: [--config=pycln.toml]
verbose: true
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
rev: v0.8.4
hooks:
- id: ruff # Run the linter.
args: [--fix]
Expand Down
2 changes: 1 addition & 1 deletion AutoDuck/pyhtml.fmt
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ $(def1)$4$(par)

.tag=pyseeapi, html, 1, 1
.pre=$(rmh)Win32 API References$(rmhe)$(par)
.format=$(term1)Search for <i>$1</i> at <a href="http://search.msdn.microsoft.com/search/results.aspx?view=msdn&query=$1" target="_blank">msdn</a>, <a href="http://www.google.com/search?q=$1" target="_blank">google</a> or <a href="http://groups.google.com/groups?q=$1" target="_blank">google groups</a>.$(par)
.format=$(term1)Search for <i>$1</i> at <a href="https://learn.microsoft.com/en-ca/search/?terms=$1" target="_blank">msdn</a>, <a href="https://www.google.com/search?q=$1" target="_blank">google</a> or <a href="https://groups.google.com/groups?q=$1" target="_blank">google groups</a>.$(par)

.tag=pyundocmfc, html, 2, 1
.pre=$(rmh)Undocumented MFC References$(par)
Expand Down
8 changes: 4 additions & 4 deletions AutoDuck/pywin32-document.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<item name="View the change log" href="html/CHANGES.txt"/>
</important>
<links>
<item name="Python Web Site" href="http://www.python.org"/>
<item name="Python Web Site" href="https://www.python.org"/>
<item name="Python for Win32 Extensions Site" href="https://github.com/mhammond/pywin32"/>
<item name="Python for Win32 mailing list" href="http://mail.python.org/mailman/listinfo/python-win32"/>
<item name="Tim Golden's Python pages" href="http://timgolden.me.uk/python/"/>
<item name="Paul Boddie's Python COM tutorial" href="http://thor.prohosting.com/~pboddie/Python/COM.html"/>
<item name="Python for Win32 mailing list" href="https://mail.python.org/mailman/listinfo/python-win32"/>
<item name="Tim Golden's Python pages" href="https://timgolden.me.uk/python/"/>
<item name="Paul Boddie's Python COM tutorial" href="https://web.archive.org/web/20090314180624/http://thor.prohosting.com:80/~pboddie/Python/COM.html"/>
</links>
<category id="win32" label="Win32 API">
<overviews>
Expand Down
15 changes: 5 additions & 10 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ or
https://github.com/mhammond/pywin32/compare/b3xx...main

As of build 305, installation .exe files have been deprecated; see
https://mhammond.github.io/pywin32_installers.html.
https://mhammond.github.io/pywin32_installers.html .

Coming in build 309, as yet unreleased
--------------------------------------

* Removed param `hIcon` from `win32comext.shell.ShellExecuteEx`. It was unusable since Windows Vista (#2423, @Avasam)
* Fixed `nbios.NCBStruct` packing (#2406, @Avasam)
* Restored axdebug builds on Python 3.10 (#2416, @Avasam)
* Pythonwin: Bumped Scintilla from 1.77 to 4.4.6. The full changelog can be found here: https://www.scintilla.org/ScintillaHistory.html
* Fixed `ddeclient` and `ddeserver` demos import error (#2290, @Avasam)
* The `EvtSubscribe_push` demo now actually demonstrates the callback action and the event context being filled. (#2281, @Avasam)
* Fixed Pythonwin's editor failing due to invalid regex import (#2419, @Avasam)
* Last error wrongly set by some modules (#2302, @CristiFati)
* Dropped support for Python 3.7 (#2207, @Avasam)
Expand All @@ -31,9 +31,9 @@ Coming in build 309, as yet unreleased
* Fixed `win32timezone.TimeZoneInfo` initialization from a `[DYNAMIC_]TIME_ZONE_INFORMATION` (#2339, @Avasam)
* Added runtime deprecation warning of `win2kras`, use `win32ras` instead (#2356, @Avasam)
* Improved handling of dict iterations and fallbacks (removes Python 2 support code, small general speed improvement) (#2332, #2330, @Avasam)
* Fixed "Open GL Demo" (`Pythonwin/pywin/Demos/openGLDemo.py`) and restore "Font" demo in `Pythonwin/pywin/Demos/guidemo.py` (#2345, @Avasam)
* Fixed accidentally trying to raise an undefined name instead of an `Exception` in `Pythonwin/pywin/debugger/debugger.py` (#2326, @Avasam)
* Fixed PythonService DoLogMessage raising fatal GIL lock error (#2426, JacobNolan1)
* Fixed and improved the following demos: `ddeclient`, `ddeserver`, `EvtSubscribe_push`, `openGLDemo`, `guidemo`, `ocxserialtest`, `ocxtest` (#2290, #2281, #2291, @Avasam)

Build 308, released 2024-10-12
------------------------------
Expand Down Expand Up @@ -101,20 +101,16 @@ as the .chm file, certain MAPI libraries etc, and .exe installers.
* Added `GetWindowRgnBox` to `win32gui`
* `winxpgui.GetConsoleWindow` now aliases `win32console.GetConsoleWindow`
* Everything else is re-exported from `win32gui`
* Fixed the `win32com.demos.ietoolbar` demo (#2217, @Avasam)
* Fixed and improved the following demos: `ietoolbar`, `fontdemo`, `msoffice`, `shell_view`, `context_menu`, `win32clipboardDemo` (#2217, #2101, @Avasam)
* Fixed undefined names reported by Flake8/Ruff (#2101, @Avasam, @kxrob)
Fixed the following public API:
* Fixed `NameError` in `pywin.Demos`'s `fontdemo.FontView.SetFont`
* The `Pythonwin/pywin/Demos/ocx/msoffice` demo now uses the docName argument
* Fixed `NameError` in `WordFrame.Create`, even though it wasn't used
* Fixed a handful of `NameError` in `pywin.dialogs.ideoptions.OptionsPropPage` with format
* Fixed `AttributeError` in `pywin.framework.dlgappcore.AppDialog.OnPaint`
* Fixed trying to write banner to `sdterr` in `pywin.framework.interact.InteractiveCore.Init`
* Fixed a `NameError` in `pywin.framework.mdi_pychecker.TheDocument.doSearch`
* Removes unusable `HandleToUlong`, `UlongToHandle`, `UlongToPtr` and `UintToPtr` from `pywin.scintilla.scintillacon`
* Fixed a `NameError` in `win32comext.axscript.client.pydumper.Register`
* Fixed a `NameError` in `win32comext.shell.demos.servers.context_menu.ShellExtension.QueryContextMenu`
* Fixed a `NameError` in `win32comext.shell.demos.servers.shell_view.ScintillaShellView.CreateViewWindow`
The following methods no longer throw errors (although their implementation is still unvalidated):
* `mmsystem.MEVT_EVENTTYPE`
* `mmsystem.MEVT_EVENTPARM`
Expand Down Expand Up @@ -175,7 +171,6 @@ as the .chm file, certain MAPI libraries etc, and .exe installers.
* `win32com.client.combrowse.HLIRoot.__lt__`
* `win32com.client.genpy.WritableItem.__lt__`
* `__bool__` in classes generated by `win32com.client.genpy.WritableItem.WriteClassBody`
* `win32/Demos`'s `win32clipboardDemo.Foo.__lt__`
* `win32timezone._SimpleStruct.__le__` (subclassed by `SYSTEMTIME`, `TIME_ZONE_INFORMATION`, `DYNAMIC_TIME_ZONE_INFORMATION`, `TimeZoneDefinition`)
The following methods no longer throw errors (although their implementation is still unvalidated):
* `winnt.PRIMARYLANGID`
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/contents.d
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ If the first fold in the file is collapsed, all top-level folds are opened. Oth
@flag Ctrl+Down|Recall the next command in the history list.
@topic Source code folding in the editor|
Thanks to Scintilla (http://www.scintilla.org), Pythonwin supports
Thanks to Scintilla (https://www.scintilla.org), Pythonwin supports
source code folding. Folding is the ability to collapse sections of
your source-code into a single line, making it easier to navigate
around large files. Any Python statement which introduces a new block
Expand Down
3 changes: 2 additions & 1 deletion Pythonwin/ddeconv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ PyObject *PyDDEConv_Poke(PyObject *self, PyObject *args)
return NULL;
TCHAR *szCmd;
PyObject *obCmd;
// TODO: How would this code look like w/o consideration for Netscape ?
void *pData = NULL; // may be empty, as for Netscape's use of Poke
Py_ssize_t size = 0;
if (!PyArg_ParseTuple(args, "O|z#:Poke", &obCmd, &pData, &size))
return NULL;
if (!PyWinObject_AsTCHAR(obCmd, &szCmd, FALSE))
return NULL;
GUI_BGN_SAVE;
BOOL ok = pConv->Poke(szCmd, pData, size);
BOOL ok = pConv->Poke(CF_TEXT, szCmd, pData, size);
GUI_END_SAVE;
PyWinObject_FreeTCHAR(szCmd);
if (!ok)
Expand Down
9 changes: 5 additions & 4 deletions Pythonwin/ddemodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@
the internal list. Instead, the item must be evaluated by the
Python server class.
Reason: Netscape makes heavy usage of string items and does not use
them in a fixed manner. Instead, the items are (ab)used as the
Reason: Netscape made heavy usage of string items and did not use
them in a fixed manner. Instead, the items were (ab)used as the
parameter list in DDE_Poke and DDE_Request.
TODO: Netscape is long dead, so we could clean this up
Server issues (Server):
-----------------------
Poke and Request are now exposed to the Python server interface.
Poke - does not require a result
- has an optional value parameter (not used by Netscape)
- has an optional value parameter (wasn't used by Netscape)
Request - should return a string object
Client issues (Conversation):
-----------------------------
Poke and Request are now available.
Poke (item, value=None)
- sends a Poke to it's conversation's server
- has an optional value parameter (not used by Netscape)
- has an optional value parameter (wasn't used by Netscape)
- does not return anything
Request (item)
- sends a request to it's conversation's server
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/doc/debugger/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<H1><IMG SRC="pythonwin.gif" WIDTH=64 HEIGHT=64>Pythonwin Debugger Overview </H1>
<B><P>News Flash:</P>
</B><P>We take full advantage of Scintilla from Neil Hodgson (see <a HREF="http://www.scintilla.org">scintilla.org</a>) This offers a much better interface, including Visual C++/VB type indicators for breakpoints in the left
</B><P>We take full advantage of Scintilla from Neil Hodgson (see <a HREF="https://www.scintilla.org">scintilla.org</a>) This offers a much better interface, including Visual C++/VB type indicators for breakpoints in the left
column, etc</P>
<P>This document gives a general overview of the Pythonwin Debugger package. </P>

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 @@ -19,7 +19,7 @@
("OCX Serial Port Demo", "from ocx import ocxserialtest; ocxserialtest.test()"),
(
"Internet Explorer Control Demo",
'from ocx import webbrowser; webbrowser.Demo("http://www.python.org")',
'from ocx import webbrowser; webbrowser.Demo("https://www.python.org")',
),
]

Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/pywin/Demos/ocx/flash.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# simple flash/python application demonstrating bidirectional
# communicaion between flash and python. Click the sphere to see
# behavior. Uses Bounce.swf from FlashBounce.zip, available from
# http://pages.cpsc.ucalgary.ca/~saul/vb_examples/tutorial12/
# https://cspages.ucalgary.ca/~saul/vb_examples/tutorial12/

# Update to the path of the .swf file (note it could be a true URL)
flash_url = "c:\\bounce.swf"
Expand Down
1 change: 0 additions & 1 deletion Pythonwin/pywin/Demos/ocx/ocxserialtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import pythoncom
import win32con
import win32ui
import win32uiole
from pywin.mfc import activex, dialog
from win32com.client import gencache

Expand Down
1 change: 0 additions & 1 deletion Pythonwin/pywin/Demos/ocx/ocxtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import win32api
import win32con
import win32ui
import win32uiole
from pywin.mfc import activex, dialog, window
from win32com.client import gencache

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 @@ -32,7 +32,7 @@ def __init__(self, url=None):
if url is None:
self.url = regutil.GetRegisteredHelpFile("Main Python Documentation")
if self.url is None:
self.url = "http://www.python.org"
self.url = "https://www.python.org"
else:
self.url = url
pass # Don't call base class doc/view version...
Expand Down
1 change: 0 additions & 1 deletion Pythonwin/pywin/Demos/toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# Demos how to make custom tooltips, etc.

import commctrl
import win32api
import win32con
import win32ui
from pywin.mfc import afxres, docview, window
Expand Down
1 change: 0 additions & 1 deletion Pythonwin/pywin/debugger/dbgcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
OPT_HIDE = "hide"
OPT_STOP_EXCEPTIONS = "stopatexceptions"

import win32api
import win32ui


Expand Down
1 change: 0 additions & 1 deletion Pythonwin/pywin/dialogs/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
Merged with dlgpass and moved to pywin.dialogs by Mark Hammond Jan 1998.
"""

import win32api
import win32con
import win32ui
from pywin.mfc import dialog
Expand Down
3 changes: 1 addition & 2 deletions Pythonwin/pywin/framework/dbgcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ def OnUpdateClearAllBreakpoints(self, cmdui):
cmdui.Enable(d is None or len(d.breaks) != 0)

def OnUpdateDebuggerBar(self, cmdui):
name, always = IdToBarNames.get(cmdui.m_nID)
enabled = always
name, enabled = IdToBarNames.get(cmdui.m_nID, (None, 0))
d = self._GetDebugger()
if d is not None and d.IsDebugging() and name is not None:
enabled = 1
Expand Down
3 changes: 2 additions & 1 deletion Pythonwin/pywin/framework/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def OpenHelpFile(fileName, helpCmd=None, helpArg=None):
# XXX - using the htmlhelp API wreaks havoc with keyboard shortcuts
# so we disable it, forcing ShellExecute, which works fine (but
# doesn't close the help file when Pythonwin is closed.
# Tom Heller also points out http://www.microsoft.com/mind/0499/faq/faq0499.asp,
# Tom Heller also points out
# https://web.archive.org/web/20070519165457/http://www.microsoft.com:80/mind/0499/faq/faq0499.asp ,
# which may or may not be related.
elif 0 and ext == ".chm":
import win32help
Expand Down
1 change: 0 additions & 1 deletion Pythonwin/pywin/framework/intpydde.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import sys
import traceback

import win32api
import win32ui
from dde import ( # nopycln: import # Re-exported for intpyapp.py
CBF_FAIL_SELFCONNECTIONS as CBF_FAIL_SELFCONNECTIONS, # noqa: PLC0414
Expand Down
4 changes: 2 additions & 2 deletions Pythonwin/readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <H2>Introduction </H2>
<a href="doc/debugger/index.html">integrated debugger</a>, and a rich Python
editing environment. </P>
<P>Pythonwin is implemented as a 'wrapper' for the Microsoft Foundation Class library. With it, you can use MFC in an interactive, interpreted environment, or write full blown stand-alone applications tightly coupled with the Windows environment. Over 30 MFC objects are exposed, including Common Controls, Property Pages/Sheets, Control/Toolbars, Threads, etc. </P>
<P>Pythonwin could almost be considered a sample program for the MFC UI environment. This Python UI environment can be embedded in almost any other application - such as OLE clients/servers, Netscape plugins, as a Macro language etc. </P>
<P>Pythonwin could almost be considered a sample program for the MFC UI environment. This Python UI environment can be embedded in almost any other application - such as OLE clients/servers, as a Macro language etc. </P>
<P><A HREF="#RecentChanges">Recent changes can be found at the end of this document</A>.</P>
<H2>Demos</H2>
<P>There are many demos in the pywin\demos directory. To see a list of all the demos, run the program "pywin\demos\guidemo.py" from inside Pythonwin.</P>
Expand Down Expand Up @@ -55,7 +55,7 @@ <H2><A NAME="RecentChanges">Recent Changes</A></H2>
finish.</P>
<P>Support for Scintilla's indentation guides, that gives a nice indication of
the block structure.</P>
<P>New, improved color editor, using the Scintilla control by Neil Hodgson (see <A HREF="http://hare.net.au/~neilh/ScintillaTide.html">http://hare.net.au/~neilh/ScintillaTide.html</A>). The debugger now requires use of this editor.</P>
<P>New, improved color editor, using the Scintilla control by Neil Hodgson (see <A HREF="https://www.scintilla.org/">https://www.scintilla.org/</A>). The debugger now requires use of this editor.</P>
<P>Much better printing support from Roger Burnham. Pythonwin itself still can't print anything, but the framework can (meaning some kind soul could now add the support to Pythonwin :-)</P>
<P>DDE support is complete.</P>
<P>Reference helpfile is far more complete.</P>
Expand Down
Loading

0 comments on commit 5f57a6a

Please sign in to comment.