Skip to content

Commit 2cd04aa

Browse files
authored
Adds drop handler and MSI registration. (#218)
Fixes #217
1 parent 3b78945 commit 2cd04aa

File tree

8 files changed

+546
-6
lines changed

8 files changed

+546
-6
lines changed

_msbuild.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def launcher_exe(name, platform, windowed=False):
164164
def pyshellext(ext='.exe', **props):
165165
link_opts = ItemDefinition(
166166
'Link',
167-
AdditionalDependencies=Prepend('RuntimeObject.lib;'),
167+
AdditionalDependencies=Prepend('RuntimeObject.lib;pathcch.lib;'),
168168
)
169169
if ext != '.exe':
170170
link_opts.options['ModuleDefinitionFile'] = '$(SourceRootDir)src\\pyshellext\\pyshellext.def'

_msbuild_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
PreprocessorDefinitions=Prepend("PYSHELLEXT_TEST=1;"),
6464
LanguageStandard='stdcpp20',
6565
),
66-
ItemDefinition('Link', AdditionalDependencies=Prepend("RuntimeObject.lib;")),
66+
ItemDefinition('Link', AdditionalDependencies=Prepend("RuntimeObject.lib;pathcch.lib;")),
6767
CSourceFile('pyshellext/shellext.cpp'),
6868
CSourceFile('pyshellext/shellext_test.cpp'),
6969
IncludeFile('pyshellext/shellext.h'),
@@ -74,6 +74,9 @@
7474
CFunction('shellext_ReadAllIdleInstalls'),
7575
CFunction('shellext_PassthroughTitle'),
7676
CFunction('shellext_IdleCommand'),
77+
CFunction('shellext_GetDropArgumentsW'),
78+
CFunction('shellext_GetDropArgumentsA'),
79+
CFunction('shellext_GetDropDescription'),
7780
source='src',
7881
)
7982
)

src/pymanager/appxmanifest.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,13 @@
272272
</uap:SupportedFileTypes>
273273
</uap:FileTypeAssociation>
274274
</uap:Extension>
275+
<desktop4:Extension Category="windows.fileExplorerContextMenus">
276+
<desktop4:FileExplorerContextMenus>
277+
<desktop4:ItemType Type=".pyw">
278+
<desktop4:Verb Id="EditInIdle" Clsid="C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1" />
279+
</desktop4:ItemType>
280+
</desktop4:FileExplorerContextMenus>
281+
</desktop4:Extension>
275282
</Extensions>
276283
</Application>
277284
</Applications>

src/pymanager/msi.wxs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,23 @@
6363
Name="ExplorerCommandHandler"
6464
Value="{C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1}"
6565
Type="string" />
66+
<RegistryValue Root="HKCR" Key="Python.File\shellex\DropHandler"
67+
Value="{EAF5E48F-F54A-4A03-824B-CA880772EE20}"
68+
Type="string" />
6669

6770
<ProgId Id="Python.NoConFile" Description="Python Script (Windowed)" Advertise="no" Icon="py.ico">
6871
<Extension Id="pyw" ContentType="text/x-python">
6972
<Verb Id="open" TargetFile="pythonw.exe" Argument="&quot;%1&quot; %*" />
7073
</Extension>
7174
</ProgId>
75+
<RegistryValue Root="HKCR" Key="Python.NoConFile\shell\EditWithIDLE"
76+
Name="ExplorerCommandHandler"
77+
Value="{C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1}"
78+
Type="string" />
79+
<RegistryValue Root="HKCR" Key="Python.NoConFile\shellex\DropHandler"
80+
Value="{EAF5E48F-F54A-4A03-824B-CA880772EE20}"
81+
Type="string" />
82+
7283
<ProgId Id="Python.CompiledFile" Description="Compiled Python Script" Advertise="no" Icon="pyc.ico">
7384
<Extension Id="pyc" ContentType="application/x-python-code">
7485
<Verb Id="open" TargetFile="python.exe" Argument="&quot;%1&quot; %*" />
@@ -111,6 +122,7 @@
111122
Condition="WIX_NATIVE_MACHINE = 34404">
112123
<File Source="pyshellext-64.dll">
113124
<Class Id="{C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1}" Advertise="no" Context="InprocServer32" />
125+
<Class Id="{EAF5E48F-F54A-4A03-824B-CA880772EE20}" Advertise="no" Context="InprocServer32" />
114126
</File>
115127
</Component>
116128

@@ -119,6 +131,7 @@
119131
Condition="WIX_NATIVE_MACHINE = 43620">
120132
<File Source="pyshellext-arm64.dll">
121133
<Class Id="{C7E29CB0-9691-4DE8-B72B-6719DDC0B4A1}" Advertise="no" Context="InprocServer32" />
134+
<Class Id="{EAF5E48F-F54A-4A03-824B-CA880772EE20}" Advertise="no" Context="InprocServer32" />
122135
</File>
123136
</Component>
124137

0 commit comments

Comments
 (0)