-
Notifications
You must be signed in to change notification settings - Fork 1.2k
core: If a user specifies --no-gui, don't show GUI messageboxes #5514
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
base: main
Are you sure you want to change the base?
Conversation
| from NetUtils import (Endpoint, decode, NetworkItem, encode, JSONtoTextParser, ClientStatus, Permission, NetworkSlot, | ||
| RawJSONtoTextParser, add_json_text, add_json_location, add_json_item, JSONTypes, HintStatus, SlotType) | ||
| from Utils import Version, stream_input, async_start | ||
| from Utils import gui_enabled, Version, stream_input, async_start |
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.
I think your changes are sensible, but I'm a bit confused about this original Treble stuff.
Imo, there are two possibilities:
- This should be
from Utils import gui_enabled as gui_enabled - Clients are "meant" to switch over to
from Utils import gui_enabled, in which case this should get an API Updates ping
Reason: Relying on implicit reexporting is bad™️ (It fails mypy, for example, i.e. this change would implicitly make mypy-compliant worlds fail mypy without their knowledge)
I would like us to be clear about what the intent is here
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.
Yep, 100% agree with that.
My gut prefers the second option?
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.
I agree I think
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.
code LGTM, did not have the time to test, as today happens to be a holiday when I'm reviewing this
What is this fixing or adding?
Utils.messagebox is called directly from various places within core code. This means that if an individual client wants to use those functions while in nogui mode, it will end up popping a GUI messagebox (or worse, crashing with "ModuleNotFoundError: No module named 'tkinter'").
This PR is based on alwaysintreble's work in #4925 and adds a
gui_enabledcheck toUtils.messagebox, falling back to aLoggingcall if the user specified--nogui.How was this tested?
python .\Launcher.py worldman -- --update-all --nogui. This loops throughLauncherComponents.install_apworldwhich attempts to show a messagebox per install.python .\Launcher.py "BizHawk Client" -- corrupt_patch.apemerald --nogui(A hand-mangled Emerald patch), which calls Utils.messagebox if it fails to patch the game.If this makes graphical changes, please attach screenshots.