Commit 87ce9588 authored by Steve Dower's avatar Steve Dower Committed by GitHub

bpo-37778: Fixes the icons used for file associations to the Microsoft Store package (GH-15150)

parent 1fab9cbf
Fixes the icons used for file associations to the Microsoft Store package.
This diff was suppressed by a .gitattributes entry.
...@@ -65,6 +65,8 @@ IDLE_VE_DATA = dict( ...@@ -65,6 +65,8 @@ IDLE_VE_DATA = dict(
BackgroundColor="transparent", BackgroundColor="transparent",
) )
PY_PNG = '_resources/py.png'
APPXMANIFEST_NS = { APPXMANIFEST_NS = {
"": "http://schemas.microsoft.com/appx/manifest/foundation/windows10", "": "http://schemas.microsoft.com/appx/manifest/foundation/windows10",
"m": "http://schemas.microsoft.com/appx/manifest/foundation/windows10", "m": "http://schemas.microsoft.com/appx/manifest/foundation/windows10",
...@@ -278,12 +280,16 @@ def add_alias(xml, appid, alias, subsystem="windows"): ...@@ -278,12 +280,16 @@ def add_alias(xml, appid, alias, subsystem="windows"):
e = find_or_add(e, "uap5:ExecutionAlias", ("Alias", alias)) e = find_or_add(e, "uap5:ExecutionAlias", ("Alias", alias))
def add_file_type(xml, appid, name, suffix, parameters='"%1"'): def add_file_type(xml, appid, name, suffix, parameters='"%1"', info=None, logo=None):
app = _get_app(xml, appid) app = _get_app(xml, appid)
e = find_or_add(app, "m:Extensions") e = find_or_add(app, "m:Extensions")
e = find_or_add(e, "uap3:Extension", ("Category", "windows.fileTypeAssociation")) e = find_or_add(e, "uap3:Extension", ("Category", "windows.fileTypeAssociation"))
e = find_or_add(e, "uap3:FileTypeAssociation", ("Name", name)) e = find_or_add(e, "uap3:FileTypeAssociation", ("Name", name))
e.set("Parameters", parameters) e.set("Parameters", parameters)
if info:
find_or_add(e, "uap:DisplayName").text = info
if logo:
find_or_add(e, "uap:Logo").text = logo
e = find_or_add(e, "uap:SupportedFileTypes") e = find_or_add(e, "uap:SupportedFileTypes")
if isinstance(suffix, str): if isinstance(suffix, str):
suffix = [suffix] suffix = [suffix]
...@@ -399,7 +405,7 @@ def get_appxmanifest(ns): ...@@ -399,7 +405,7 @@ def get_appxmanifest(ns):
["python", "python{}".format(VER_MAJOR), "python{}".format(VER_DOT)], ["python", "python{}".format(VER_MAJOR), "python{}".format(VER_DOT)],
PYTHON_VE_DATA, PYTHON_VE_DATA,
"console", "console",
("python.file", [".py"]), ("python.file", [".py"], '"%1"', 'Python File', PY_PNG),
) )
add_application( add_application(
...@@ -410,7 +416,7 @@ def get_appxmanifest(ns): ...@@ -410,7 +416,7 @@ def get_appxmanifest(ns):
["pythonw", "pythonw{}".format(VER_MAJOR), "pythonw{}".format(VER_DOT)], ["pythonw", "pythonw{}".format(VER_MAJOR), "pythonw{}".format(VER_DOT)],
PYTHONW_VE_DATA, PYTHONW_VE_DATA,
"windows", "windows",
("python.windowedfile", [".pyw"]), ("python.windowedfile", [".pyw"], '"%1"', 'Python File (no console)', PY_PNG),
) )
if ns.include_pip and ns.include_launchers: if ns.include_pip and ns.include_launchers:
...@@ -422,7 +428,7 @@ def get_appxmanifest(ns): ...@@ -422,7 +428,7 @@ def get_appxmanifest(ns):
["pip", "pip{}".format(VER_MAJOR), "pip{}".format(VER_DOT)], ["pip", "pip{}".format(VER_MAJOR), "pip{}".format(VER_DOT)],
PIP_VE_DATA, PIP_VE_DATA,
"console", "console",
("python.wheel", [".whl"], 'install "%1"'), ("python.wheel", [".whl"], 'install "%1"', 'Python Wheel'),
) )
if ns.include_idle and ns.include_launchers: if ns.include_idle and ns.include_launchers:
...@@ -459,16 +465,15 @@ def get_appx_layout(ns): ...@@ -459,16 +465,15 @@ def get_appx_layout(ns):
yield "AppxManifest.xml", ("AppxManifest.xml", get_appxmanifest(ns)) yield "AppxManifest.xml", ("AppxManifest.xml", get_appxmanifest(ns))
yield "_resources.xml", ("_resources.xml", get_resources_xml(ns)) yield "_resources.xml", ("_resources.xml", get_resources_xml(ns))
icons = ns.source / "PC" / "icons" icons = ns.source / "PC" / "icons"
yield "_resources/pythonx44.png", icons / "pythonx44.png" for px in [44, 50, 150]:
yield "_resources/pythonx44$targetsize-44_altform-unplated.png", icons / "pythonx44.png" src = icons / "pythonx{}.png".format(px)
yield "_resources/pythonx50.png", icons / "pythonx50.png" yield f"_resources/pythonx{px}.png", src
yield "_resources/pythonx50$targetsize-50_altform-unplated.png", icons / "pythonx50.png" yield f"_resources/pythonx{px}$targetsize-{px}_altform-unplated.png", src
yield "_resources/pythonx150.png", icons / "pythonx150.png" for px in [44, 150]:
yield "_resources/pythonx150$targetsize-150_altform-unplated.png", icons / "pythonx150.png" src = icons / "pythonwx{}.png".format(px)
yield "_resources/pythonwx44.png", icons / "pythonwx44.png" yield f"_resources/pythonwx{px}.png", src
yield "_resources/pythonwx44$targetsize-44_altform-unplated.png", icons / "pythonwx44.png" yield f"_resources/pythonwx{px}$targetsize-{px}_altform-unplated.png", src
yield "_resources/pythonwx150.png", icons / "pythonwx150.png" yield f"_resources/py.png", icons / "py.png"
yield "_resources/pythonwx150$targetsize-150_altform-unplated.png", icons / "pythonwx150.png"
sccd = ns.source / SCCD_FILENAME sccd = ns.source / SCCD_FILENAME
if sccd.is_file(): if sccd.is_file():
# This should only be set for side-loading purposes. # This should only be set for side-loading purposes.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment