Uncheck checkbox after missing dependency error #2425
Merged
+15
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
It's possible for a mod with an incompatible dependency to be presented as compatible in GUI, as long as this dependency is more than one step away (i.e., a dependency of a dependency). For example, in KSP 1.4.2 currently, AJE Extended depends on AJE, which depends on FAR, which isn't compatible. So FAR and AJE are properly marked as incompatible, but AJE Extended is treated as compatible. This is covered by #2231 and not fixed here.
Problem
After you check such an incompatible checkbox, you'll get the error popup about it every time you click any other checkbox, until you uncheck the incompatible one.
Cause
The only action we took in response to this condition was to raise an error message. This may partly be because we were catching
ModuleNotFoundKraken
, which doesn't indicate the depending module.Changes
Now we catch
DependencyNotSatisfiedKraken
(which inherits fromModuleNotFoundKraken
and is the actual type of the exception already being thrown) and use itsparent
property to find the mod with the incompatible dependency, and uncheck it withMarkModForInstall
. This unchecks the problematic module, so further selections may be made without seeing the same error message over and over.Note that this only covers missing dependencies, and not any other sort of conflict. Unlike a mod-to-mod conflict, a mod with a missing dependency can never be installed, so there is no value in keeping it selected because there is no other way to solve the problem other than deselecting it.
Simply setting the
Value
property of the right cell resulted in a glitchy UI; the checkbox still appeared to be checked until the user took another action on the grid, such as clicking anywhere within it, at which time the checkbox's true unchecked state was drawn. We now callRefreshEdit
andRefresh
on the grid after setting a cell value to work around this.Fixes #2419.