Skip to content

r.shade: Prevent GUI console to overwrite color table of output - #6903

Merged
petrasovaa merged 3 commits into
OSGeo:mainfrom
ecodiv:patch-2
Jul 18, 2026
Merged

petrasovaa merged 3 commits into
OSGeo:mainfrom
ecodiv:patch-2

Conversation

@ecodiv

@ecodiv ecodiv commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Added exception handling for specific modules in gconsole.py to avoid that the GUI console automatically applies a color table to the output, thereby overwriting the intended RGB colors.

An attempt to solve the issue reported in #6826. I applied the patch, and for me, it seems to work.

Added exception handling for specific modules in gconsole.py to avoid that the GUI console  automatically applies a color table to the output, thereby overwriting the intended RGB colors. See OSGeo#6826
@github-actions github-actions Bot added GUI wxGUI related Python Related code is in Python labels Jan 16, 2026
Comment thread gui/wxpython/core/gconsole.py Resolved
Co-authored-by: Nicklas Larsson <n_larsson@yahoo.com>

@petrasovaa petrasovaa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is misunderstood. r.mapcalc is not exempt, it just required different parsing than all other tools. The only change here that makes sense is fixing the errors, indeed, KeyError seems wrong.

@petrasovaa

Copy link
Copy Markdown
Contributor

@ecodiv the changing of the color table should happen only if you have it in the settings (Layers - Default raster settings), please make sure it's not checked. If the problem persists, I would need to look into it more.
We could decide some tools should be exempt from this, but the change would have to look differently. I think this feature, if we even want it, should be implemented in some other way, currently it's hardcoded in the C library.

@ecodiv

ecodiv commented Jan 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback. I'll have a look at my settings. But I think irrespective of the setting, this module should be exempted because it never makes sense, the whole purpose of that module is to define a very specific color table.

@ecodiv

ecodiv commented May 21, 2026 •

Copy link
Copy Markdown
Contributor Author

@ecodiv the changing of the color table should happen only if you have it in the settings (Layers - Default raster settings), please make sure it's not checked. If the problem persists, I would need to look into it more. We could decide some tools should be exempt from this, but the change would have to look differently. I think this feature, if we even want it, should be implemented in some other way, currently it's hardcoded in the C library.

@petrasovaa The default color table is unchecked. But I just ran mapcalc, and the outcome got automatically assigned the viridis color table. (grass 8.6dev on Linux)

@petrasovaa

Copy link
Copy Markdown
Contributor

@petrasovaa The default color table is unchecked. But I just ran mapcalc, and the outcome got automatically assigned the viridis color table. (grass 8.6dev on Linux)

Viridis is the default, so I guess I don't understand what is the problem?

@ecodiv

ecodiv commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

@petrasovaa The default color table is unchecked. But I just ran mapcalc, and the outcome got automatically assigned the viridis color table. (grass 8.6dev on Linux)

Viridis is the default, so I guess I don't understand what is the problem?

You're right, sorry for the noise.

@ecodiv

ecodiv commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

@ecodiv the changing of the color table should happen only if you have it in the settings (Layers - Default raster settings), please make sure it's not checked. If the problem persists, I would need to look into it more. We could decide some tools should be exempt from this, but the change would have to look differently. I think this feature, if we even want it, should be implemented in some other way, currently it's hardcoded in the C library.

Do you have any ideas how to deal with modules that create output rasters that should not get assigned a color table? In the current situation, r.shade isn't useful.

Comment thread gui/wxpython/core/gconsole.py Resolved

@petrasovaa petrasovaa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From this PR I isolated the error fix unrelated to the issue.

@petrasovaa
petrasovaa enabled auto-merge (squash) July 17, 2026 21:49
@petrasovaa

Copy link
Copy Markdown
Contributor

I suggest to further discuss the topic in the issue, this PR with the little exception fix will get merged.

@petrasovaa
petrasovaa merged commit 4f5ca7b into OSGeo:main Jul 18, 2026
25 checks passed
@github-actions github-actions Bot added this to the 8.6.0 milestone Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GUI wxGUI related Python Related code is in Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants