From 5a389044d57000c04c0681d22c858ab4365e7a85 Mon Sep 17 00:00:00 2001 From: Paulo van Breugel Date: Fri, 16 Jan 2026 10:38:58 +0100 Subject: [PATCH 1/3] r.shade: Prevent GUI console to overwrite color table of output 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 #6826 --- gui/wxpython/core/gconsole.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gui/wxpython/core/gconsole.py b/gui/wxpython/core/gconsole.py index 26a46e8b54a..d8bea738dd2 100644 --- a/gui/wxpython/core/gconsole.py +++ b/gui/wxpython/core/gconsole.py @@ -198,10 +198,11 @@ def run(self): group="rasterLayer", key="colorTable", subkey="selection" ) mapName = None - if args[0][0] == "r.mapcalc": + modules_to_excempt = {"r.mapcalc", "r.shade"} + if args[0][0] in modules_to_excempt: try: mapName = args[0][1].split("=", 1)[0].strip() - except KeyError: + except (IndexError, AttributeError): pass else: moduleInterface = GUI(show=None).ParseCommand(args[0]) From 24e54cfb52ff97b78c7ecb191c1bcd7b01be6c14 Mon Sep 17 00:00:00 2001 From: Paulo van Breugel Date: Fri, 16 Jan 2026 10:59:07 +0100 Subject: [PATCH 2/3] Update gui/wxpython/core/gconsole.py Co-authored-by: Nicklas Larsson --- gui/wxpython/core/gconsole.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/wxpython/core/gconsole.py b/gui/wxpython/core/gconsole.py index d8bea738dd2..0d18c75b75a 100644 --- a/gui/wxpython/core/gconsole.py +++ b/gui/wxpython/core/gconsole.py @@ -198,8 +198,8 @@ def run(self): group="rasterLayer", key="colorTable", subkey="selection" ) mapName = None - modules_to_excempt = {"r.mapcalc", "r.shade"} - if args[0][0] in modules_to_excempt: + modules_to_exempt = {"r.mapcalc", "r.shade"} + if args[0][0] in modules_to_exempt: try: mapName = args[0][1].split("=", 1)[0].strip() except (IndexError, AttributeError): From 31c1b2d0ea75c32fc9a41e110b2f1d042e7d157f Mon Sep 17 00:00:00 2001 From: Anna Petrasova Date: Fri, 17 Jul 2026 17:47:52 -0400 Subject: [PATCH 3/3] Apply suggestion from @petrasovaa --- gui/wxpython/core/gconsole.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gui/wxpython/core/gconsole.py b/gui/wxpython/core/gconsole.py index 0d18c75b75a..2c3069a2dda 100644 --- a/gui/wxpython/core/gconsole.py +++ b/gui/wxpython/core/gconsole.py @@ -198,8 +198,7 @@ def run(self): group="rasterLayer", key="colorTable", subkey="selection" ) mapName = None - modules_to_exempt = {"r.mapcalc", "r.shade"} - if args[0][0] in modules_to_exempt: + if args[0][0] == "r.mapcalc": try: mapName = args[0][1].split("=", 1)[0].strip() except (IndexError, AttributeError):