Skip to content

Commit 48b59bf

Browse files
authored
Fixes #39: Adds a shell extension to list installed IDLE on .py files (#46)
1 parent 330ff65 commit 48b59bf

File tree

12 files changed

+495
-4
lines changed

12 files changed

+495
-4
lines changed

_msbuild.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,28 @@ def mainw_exe(name):
202202
mainw_exe("pythonw"),
203203
main_exe("python3"),
204204
mainw_exe("pythonw3"),
205+
206+
CProject("pyshellext",
207+
VersionInfo(
208+
FileDescription="Python shell extension",
209+
OriginalFilename="pyshellext.dll",
210+
),
211+
Property('DynamicLibcppLinkage', 'true'),
212+
ItemDefinition('ClCompile',
213+
LanguageStandard='stdcpp20',
214+
RuntimeLibrary='MultiThreaded',
215+
),
216+
ItemDefinition('Link',
217+
AdditionalDependencies=Prepend("RuntimeObject.lib;"),
218+
SubSystem='WINDOWS',
219+
ModuleDefinitionFile='$(SourceRootDir)src\\pyshellext\\pyshellext.def',
220+
),
221+
Manifest('default.manifest'),
222+
CSourceFile('shellext.cpp'),
223+
ResourceFile('pyshellext.rc'),
224+
SourceFile('pyshellext.def'),
225+
source='src/pyshellext',
226+
)
205227
)
206228

207229

@@ -303,6 +325,7 @@ def init_METADATA():
303325
fileversion = _make_xyzw_version(METADATA["Version"], ",")
304326
for vi in PACKAGE.findall("**/VersionInfo"):
305327
vi.from_metadata(METADATA)
328+
vi.options["LegalCopyright"] = "Copyright (c) Python Software Foundation. All Rights Reserved."
306329
vi.options["FILEVERSION"] = fileversion
307330

308331

src/pymanager/appxmanifest.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<Package IgnorableNamespaces="desktop4 desktop6 desktop7 uap13 uap17"
33
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
44
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
5+
xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10"
56
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
67
xmlns:rescap4="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities/4"
78
xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"
@@ -193,6 +194,20 @@
193194
</uap:SupportedFileTypes>
194195
</uap:FileTypeAssociation>
195196
</uap:Extension>
197+
<com:Extension Category="windows.comServer">
198+
<com:ComServer>
199+
<com:SurrogateServer AppId="C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1" DisplayName="EditInIdleCommand">
200+
<com:Class Id="C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1" Path="pyshellext.dll" ThreadingModel="Both"/>
201+
</com:SurrogateServer>
202+
</com:ComServer>
203+
</com:Extension>
204+
<desktop4:Extension Category="windows.fileExplorerContextMenus">
205+
<desktop4:FileExplorerContextMenus>
206+
<desktop4:ItemType Type=".py">
207+
<desktop4:Verb Id="EditInIdle" Clsid="C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1" />
208+
</desktop4:ItemType>
209+
</desktop4:FileExplorerContextMenus>
210+
</desktop4:Extension>
196211
</Extensions>
197212
</Application>
198213

src/pymanager/default.manifest

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
</trustInfo>
1010
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
1111
<application>
12-
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
13-
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
14-
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
15-
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
1612
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
1713
</application>
1814
</compatibility>

src/pymanager/msi.wxs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444
<File Source="vcruntime140.dll" />
4545
<File Source="vcruntime140_1.dll" />
4646

47+
<File Source="pyshellext.dll">
48+
<Class Id="{C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1}" Advertise="no"
49+
Context="InprocServer32" ThreadingModel="both" />
50+
</File>
51+
4752
<File Source="version.txt" />
4853
<Environment Id="PATH" Action="set" Name="PATH" Part="last" System="yes" Value="[INSTALLFOLDER]" />
4954

@@ -56,6 +61,11 @@
5661
<Verb Id="open" TargetFile="python.exe" Argument="&quot;%1&quot; %*" />
5762
</Extension>
5863
</ProgId>
64+
<RegistryValue Root="HKCR" Key="Python.File\shell\EditWithIDLE"
65+
Name="ExplorerCommandHandler"
66+
Value="{C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1}"
67+
Type="string" />
68+
5969
<ProgId Id="Python.NoConFile" Description="Python Script (Windowed)" Advertise="no" Icon="py.ico">
6070
<Extension Id="pyw" ContentType="text/x-python">
6171
<Verb Id="open" TargetFile="pythonw.exe" Argument="&quot;%1&quot; %*" />

src/pyshellext/default.manifest

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
3+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
4+
<security>
5+
<requestedPrivileges>
6+
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
7+
</requestedPrivileges>
8+
</security>
9+
</trustInfo>
10+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
11+
<application>
12+
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
13+
</application>
14+
</compatibility>
15+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
16+
<windowsSettings>
17+
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
18+
</windowsSettings>
19+
</application>
20+
</assembly>

src/pyshellext/idle.ico

56.4 KB
Binary file not shown.

src/pyshellext/py.ico

74 KB
Binary file not shown.

src/pyshellext/pyshellext.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
EXPORTS
2+
DllGetClassObject PRIVATE
3+
DllCanUnloadNow PRIVATE

src/pyshellext/pyshellext.rc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
1 ICON DISCARDABLE "python.ico"
2+
2 ICON DISCARDABLE "pythonw.ico"
3+
3 ICON DISCARDABLE "py.ico"
4+
4 ICON DISCARDABLE "idle.ico"

src/pyshellext/python.ico

75.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)