Fix prefs window to not be able to set the inactive colour offset to a value >1.0. Doing so has terrible overflow consequences and ends up making the text very dark, instead of leaving it alone. Closes LP#1177506

This commit is contained in:
Chris Jones 2013-05-11 23:03:46 +01:00
parent 102c89440b
commit 218cf4c1fb
2 changed files with 8 additions and 0 deletions

View File

@ -923,6 +923,8 @@ class PrefsEditor:
def on_inactive_color_offset_change_value(self, widget, scroll, value): def on_inactive_color_offset_change_value(self, widget, scroll, value):
"""Inactive color offset setting changed""" """Inactive color offset setting changed"""
if value > 1.0:
value = 1.0
self.config['inactive_color_offset'] = round(value, 2) self.config['inactive_color_offset'] = round(value, 2)
self.config.save() self.config.save()

View File

@ -621,11 +621,17 @@ class Terminal(gtk.VBox):
factor = self.config['inactive_color_offset'] factor = self.config['inactive_color_offset']
self.fgcolor_inactive = self.fgcolor_active.copy() self.fgcolor_inactive = self.fgcolor_active.copy()
dbg(("fgcolor_inactive set to: RGB(%s,%s,%s)", getattr(self.fgcolor_inactive, "red"),
getattr(self.fgcolor_inactive, "green"),
getattr(self.fgcolor_inactive, "blue")))
for bit in ['red', 'green', 'blue']: for bit in ['red', 'green', 'blue']:
setattr(self.fgcolor_inactive, bit, setattr(self.fgcolor_inactive, bit,
getattr(self.fgcolor_inactive, bit) * factor) getattr(self.fgcolor_inactive, bit) * factor)
dbg(("fgcolor_inactive set to: RGB(%s,%s,%s)", getattr(self.fgcolor_inactive, "red"),
getattr(self.fgcolor_inactive, "green"),
getattr(self.fgcolor_inactive, "blue")))
colors = self.config['palette'].split(':') colors = self.config['palette'].split(':')
self.palette_active = [] self.palette_active = []
self.palette_inactive = [] self.palette_inactive = []