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',
|
||||
'cursor_blink' : True,
|
||||
'cursor_shape' : 'block',
|
||||
'cursor_color' : '#aaaaaa',
|
||||
'cursor_color' : '',
|
||||
'cursor_color_fg' : True,
|
||||
'emulation' : 'xterm',
|
||||
'term' : 'xterm-256color',
|
||||
'colorterm' : 'gnome-terminal',
|
||||
|
|
|
@ -1784,6 +1784,45 @@
|
|||
<object class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="cursor_color_foreground_radiobutton">
|
||||
<property name="label" translatable="yes">Foreground</property>
|
||||
<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>
|
||||
<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="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>
|
||||
|
@ -1797,13 +1836,20 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</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>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
|
|
|
@ -448,10 +448,21 @@ class PrefsEditor:
|
|||
# Cursor blink
|
||||
widget = guiget('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.set_sensitive(not self.config['cursor_color_fg'])
|
||||
try:
|
||||
widget.set_color(gtk.gdk.Color(self.config['cursor_color']))
|
||||
except (ValueError, TypeError):
|
||||
try:
|
||||
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']))
|
||||
|
@ -961,6 +972,26 @@ class PrefsEditor:
|
|||
self.config['custom_command'] = widget.get_text()
|
||||
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):
|
||||
"""Cursor colour changed"""
|
||||
self.config['cursor_color'] = color2hex(widget)
|
||||
|
|
|
@ -799,7 +799,7 @@ class Terminal(gtk.VBox):
|
|||
|
||||
def set_cursor_color(self):
|
||||
"""Set the cursor color appropriately"""
|
||||
if self.config['cursor_color'] == self.config['foreground_color']:
|
||||
if self.config['cursor_color_fg']:
|
||||
try:
|
||||
self.vte.set_color_cursor(None)
|
||||
except TypeError:
|
||||
|
|
Loading…
Reference in New Issue