-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display a friendlier name for "Open With" menus in Windows #225
Conversation
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
I'll give this a try locally. |
Oh, I do see it in the "Details column" there in the background, next to the file size. Maybe that's what they meant with |
I found what VS Code uses for PY files so I'm going to give it a try now with a couple commits. I don't have a Windows VM around right now so it's going to be a blind guess. I appreciate the patience here, thanks! |
With the latest push I can successfully display a "pretty name" for the executable (instead of Python). Unfortunately, looks like the icon logic is hardcoded to whatever the executable is shipping, so the only way around that is to create a forwarder shim equipped with the icon that knows how to call the actual program... a bit hacky 😬 |
Commit 006c579 looks much better 🎉 The "Open with" context menu still shows the Python icon but has the correct name; the "Choose another app" dialog shows the correct name and icon, and the File Explorer shows the correct icon for the file after assignment. |
I think that's the best we can do for now... :/ The "Open With" icon is going to default to the EXE icon, no matter what. I'll mark this as ready so we can start the review. |
FriendlyTypeName
for file type association on WindowsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall, just needs type consistency
@@ -433,7 +439,7 @@ def _cmd_ftype(identifier, command=None, query=False, remove=False) -> Completed | |||
arg = f"{identifier}=" | |||
return logged_run(["cmd", "/D", "/C", f"assoc {arg}"], check=True) | |||
|
|||
def _register_file_extensions(self): | |||
def _register_file_extensions(self) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't always return bool
. I'd change return
to return False
menuinst/platforms/win.py
Outdated
app_user_model_id=self._app_user_model_id(), | ||
mode=self.menu.mode, | ||
) | ||
return True | ||
|
||
def _unregister_file_extensions(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: return a bool
consistently and add a type hint
menuinst/platforms/win.py
Outdated
app_user_model_id=self._app_user_model_id(), | ||
mode=self.menu.mode, | ||
) | ||
return True | ||
|
||
def _unregister_url_protocols(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: return a bool
consistently and add a type hint
Description
Hoping this fixes the issue reported at #185 (comment)
Checklist - did you ...
news
directory (using the template) for the next release's release notes?