Added radio options to the Cursor colour to make it easier to go back to the XOR'd foreground colour
This commit is contained in:
parent
46431522c2
commit
86216970f4
|
@ -215,7 +215,8 @@ DEFAULTS = {
|
||||||
'color_scheme' : 'grey_on_black',
|
'color_scheme' : 'grey_on_black',
|
||||||
'cursor_blink' : True,
|
'cursor_blink' : True,
|
||||||
'cursor_shape' : 'block',
|
'cursor_shape' : 'block',
|
||||||
'cursor_color' : '#aaaaaa',
|
'cursor_color' : '',
|
||||||
|
'cursor_color_fg' : True,
|
||||||
'emulation' : 'xterm',
|
'emulation' : 'xterm',
|
||||||
'term' : 'xterm-256color',
|
'term' : 'xterm-256color',
|
||||||
'colorterm' : 'gnome-terminal',
|
'colorterm' : 'gnome-terminal',
|
||||||
|
|
|
@ -1784,24 +1784,70 @@
|
||||||
<object class="GtkHBox" id="hbox1">
|
<object class="GtkHBox" id="hbox1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="spacing">6</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkColorButton" id="cursor_color">
|
<object class="GtkRadioButton" id="cursor_color_foreground_radiobutton">
|
||||||
|
<property name="label" translatable="yes">Foreground</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">False</property>
|
||||||
<property name="use_action_appearance">False</property>
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="xalign">0</property>
|
<property name="active">True</property>
|
||||||
<property name="color">#000000000000</property>
|
<property name="draw_indicator">True</property>
|
||||||
<signal name="color-set" handler="on_cursor_color_color_set" swapped="no"/>
|
<signal name="toggled" handler="on_cursor_color_type_toggled" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<object class="GtkHBox" id="hbox4">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkRadioButton" id="cursor_color_custom_radiobutton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="active">True</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<property name="group">cursor_color_foreground_radiobutton</property>
|
||||||
|
<signal name="toggled" handler="on_cursor_color_type_toggled" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkColorButton" id="cursor_color">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="color">#000000000000</property>
|
||||||
|
<signal name="color-set" handler="on_cursor_color_color_set" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
|
|
@ -448,13 +448,24 @@ class PrefsEditor:
|
||||||
# Cursor blink
|
# Cursor blink
|
||||||
widget = guiget('cursor_blink')
|
widget = guiget('cursor_blink')
|
||||||
widget.set_active(self.config['cursor_blink'])
|
widget.set_active(self.config['cursor_blink'])
|
||||||
# Cursor colour
|
# Cursor colour - Radio values
|
||||||
|
if self.config['cursor_color_fg']:
|
||||||
|
widget = guiget('cursor_color_foreground_radiobutton')
|
||||||
|
else:
|
||||||
|
widget = guiget('cursor_color_custom_radiobutton')
|
||||||
|
widget.set_active(True)
|
||||||
|
# Cursor colour - swatch
|
||||||
widget = guiget('cursor_color')
|
widget = guiget('cursor_color')
|
||||||
|
widget.set_sensitive(not self.config['cursor_color_fg'])
|
||||||
try:
|
try:
|
||||||
widget.set_color(gtk.gdk.Color(self.config['cursor_color']))
|
widget.set_color(gtk.gdk.Color(self.config['cursor_color']))
|
||||||
except ValueError:
|
except (ValueError, TypeError):
|
||||||
self.config['cursor_color'] = "#FFFFFF"
|
try:
|
||||||
widget.set_color(gtk.gdk.Color(self.config['cursor_color']))
|
self.config['cursor_color'] = self.config['foreground_color']
|
||||||
|
widget.set_color(gtk.gdk.Color(self.config['cursor_color']))
|
||||||
|
except ValueError:
|
||||||
|
self.config['cursor_color'] = "#FFFFFF"
|
||||||
|
widget.set_color(gtk.gdk.Color(self.config['cursor_color']))
|
||||||
|
|
||||||
## Command tab
|
## Command tab
|
||||||
# Login shell
|
# Login shell
|
||||||
|
@ -961,6 +972,26 @@ class PrefsEditor:
|
||||||
self.config['custom_command'] = widget.get_text()
|
self.config['custom_command'] = widget.get_text()
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
|
def on_cursor_color_type_toggled(self, widget):
|
||||||
|
guiget = self.builder.get_object
|
||||||
|
|
||||||
|
customwidget = guiget('cursor_color_custom_radiobutton')
|
||||||
|
colorwidget = guiget('cursor_color')
|
||||||
|
|
||||||
|
colorwidget.set_sensitive(customwidget.get_active())
|
||||||
|
self.config['cursor_color_fg'] = not customwidget.get_active()
|
||||||
|
|
||||||
|
try:
|
||||||
|
colorwidget.set_color(gtk.gdk.color_parse(self.config['cursor_color']))
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
try:
|
||||||
|
self.config['cursor_color'] = self.config['foreground_color']
|
||||||
|
colorwidget.set_color(gtk.gdk.color_parse(self.config['cursor_color']))
|
||||||
|
except ValueError:
|
||||||
|
self.config['cursor_color'] = "#FFFFFF"
|
||||||
|
colorwidget.set_color(gtk.gdk.color_parse(self.config['cursor_color']))
|
||||||
|
self.config.save()
|
||||||
|
|
||||||
def on_cursor_color_color_set(self, widget):
|
def on_cursor_color_color_set(self, widget):
|
||||||
"""Cursor colour changed"""
|
"""Cursor colour changed"""
|
||||||
self.config['cursor_color'] = color2hex(widget)
|
self.config['cursor_color'] = color2hex(widget)
|
||||||
|
|
|
@ -799,7 +799,7 @@ class Terminal(gtk.VBox):
|
||||||
|
|
||||||
def set_cursor_color(self):
|
def set_cursor_color(self):
|
||||||
"""Set the cursor color appropriately"""
|
"""Set the cursor color appropriately"""
|
||||||
if self.config['cursor_color'] == self.config['foreground_color']:
|
if self.config['cursor_color_fg']:
|
||||||
try:
|
try:
|
||||||
self.vte.set_color_cursor(None)
|
self.vte.set_color_cursor(None)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
|
Loading…
Reference in New Issue