Browse Source

wxGUI/mapdisp: Always respect user-set background color in Map Display (#1167)

The background color from user settings was applied only when actual rendering
happened. So with no layers at the start and when all unchecked the color was
the hardcoded white.

Now the color is always the same although it comes from different sources
(backround by default and g.pnmcomp result when displaying data).

This creates consistent behavior and it is a plus for the dark theme support
because when user manually the dark background to fit with the dark theme,
the big empty white area is no longer displayed when no data is there.

This applies to all components which use mapwin.BufferedMapWindow,
e.g., Map Swipe.
Vaclav Petras 4 years ago
parent
commit
6fd5eb92a0
1 changed files with 5 additions and 1 deletions
  1. 5 1
      gui/wxpython/mapwin/buffered.py

+ 5 - 1
gui/wxpython/mapwin/buffered.py

@@ -78,7 +78,11 @@ class BufferedMapWindow(MapWindowBase, Window):
         """
         MapWindowBase.__init__(self, parent=parent, giface=giface, Map=Map)
         wx.Window.__init__(self, parent=parent, id=id, style=style, **kwargs)
-        self.SetBackgroundColour("white")
+        # This is applied when no layers are rendered and thus the background
+        # color is not applied in rendering itself (it would be applied always
+        # if rendering would use transparent background).
+        self.SetBackgroundColour(wx.Colour(*UserSettings.Get(
+            group='display', key='bgcolor', subkey='color')))
 
         self._properties = properties
         # this class should not ask for digit, this is a hack