65
65
BackgroundColor = "transparent" ,
66
66
)
67
67
68
+ PY_PNG = '_resources/py.png'
69
+
68
70
APPXMANIFEST_NS = {
69
71
"" : "http://schemas.microsoft.com/appx/manifest/foundation/windows10" ,
70
72
"m" : "http://schemas.microsoft.com/appx/manifest/foundation/windows10" ,
@@ -278,12 +280,16 @@ def add_alias(xml, appid, alias, subsystem="windows"):
278
280
e = find_or_add (e , "uap5:ExecutionAlias" , ("Alias" , alias ))
279
281
280
282
281
- def add_file_type (xml , appid , name , suffix , parameters = '"%1"' ):
283
+ def add_file_type (xml , appid , name , suffix , parameters = '"%1"' , info = None , logo = None ):
282
284
app = _get_app (xml , appid )
283
285
e = find_or_add (app , "m:Extensions" )
284
286
e = find_or_add (e , "uap3:Extension" , ("Category" , "windows.fileTypeAssociation" ))
285
287
e = find_or_add (e , "uap3:FileTypeAssociation" , ("Name" , name ))
286
288
e .set ("Parameters" , parameters )
289
+ if info :
290
+ find_or_add (e , "uap:DisplayName" ).text = info
291
+ if logo :
292
+ find_or_add (e , "uap:Logo" ).text = logo
287
293
e = find_or_add (e , "uap:SupportedFileTypes" )
288
294
if isinstance (suffix , str ):
289
295
suffix = [suffix ]
@@ -399,7 +405,7 @@ def get_appxmanifest(ns):
399
405
["python" , "python{}" .format (VER_MAJOR ), "python{}" .format (VER_DOT )],
400
406
PYTHON_VE_DATA ,
401
407
"console" ,
402
- ("python.file" , [".py" ]),
408
+ ("python.file" , [".py" ], '"%1"' , 'Python File' , PY_PNG ),
403
409
)
404
410
405
411
add_application (
@@ -410,7 +416,7 @@ def get_appxmanifest(ns):
410
416
["pythonw" , "pythonw{}" .format (VER_MAJOR ), "pythonw{}" .format (VER_DOT )],
411
417
PYTHONW_VE_DATA ,
412
418
"windows" ,
413
- ("python.windowedfile" , [".pyw" ]),
419
+ ("python.windowedfile" , [".pyw" ], '"%1"' , 'Python File (no console)' , PY_PNG ),
414
420
)
415
421
416
422
if ns .include_pip and ns .include_launchers :
@@ -422,7 +428,7 @@ def get_appxmanifest(ns):
422
428
["pip" , "pip{}" .format (VER_MAJOR ), "pip{}" .format (VER_DOT )],
423
429
PIP_VE_DATA ,
424
430
"console" ,
425
- ("python.wheel" , [".whl" ], 'install "%1"' ),
431
+ ("python.wheel" , [".whl" ], 'install "%1"' , 'Python Wheel' ),
426
432
)
427
433
428
434
if ns .include_idle and ns .include_launchers :
@@ -459,16 +465,15 @@ def get_appx_layout(ns):
459
465
yield "AppxManifest.xml" , ("AppxManifest.xml" , get_appxmanifest (ns ))
460
466
yield "_resources.xml" , ("_resources.xml" , get_resources_xml (ns ))
461
467
icons = ns .source / "PC" / "icons"
462
- yield "_resources/pythonx44.png" , icons / "pythonx44.png"
463
- yield "_resources/pythonx44$targetsize-44_altform-unplated.png" , icons / "pythonx44.png"
464
- yield "_resources/pythonx50.png" , icons / "pythonx50.png"
465
- yield "_resources/pythonx50$targetsize-50_altform-unplated.png" , icons / "pythonx50.png"
466
- yield "_resources/pythonx150.png" , icons / "pythonx150.png"
467
- yield "_resources/pythonx150$targetsize-150_altform-unplated.png" , icons / "pythonx150.png"
468
- yield "_resources/pythonwx44.png" , icons / "pythonwx44.png"
469
- yield "_resources/pythonwx44$targetsize-44_altform-unplated.png" , icons / "pythonwx44.png"
470
- yield "_resources/pythonwx150.png" , icons / "pythonwx150.png"
471
- yield "_resources/pythonwx150$targetsize-150_altform-unplated.png" , icons / "pythonwx150.png"
468
+ for px in [44 , 50 , 150 ]:
469
+ src = icons / "pythonx{}.png" .format (px )
470
+ yield f"_resources/pythonx{ px } .png" , src
471
+ yield f"_resources/pythonx{ px } $targetsize-{ px } _altform-unplated.png" , src
472
+ for px in [44 , 150 ]:
473
+ src = icons / "pythonwx{}.png" .format (px )
474
+ yield f"_resources/pythonwx{ px } .png" , src
475
+ yield f"_resources/pythonwx{ px } $targetsize-{ px } _altform-unplated.png" , src
476
+ yield f"_resources/py.png" , icons / "py.png"
472
477
sccd = ns .source / SCCD_FILENAME
473
478
if sccd .is_file ():
474
479
# This should only be set for side-loading purposes.
0 commit comments