Make the GUI work
This commit is contained in:
parent
ee823a9cc9
commit
eae7dcca3d
|
@ -215,8 +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_fg_color' : '#000000',
|
'cursor_fg_color' : '',
|
||||||
'cursor_bg_color' : '#ffffff',
|
'cursor_bg_color' : '',
|
||||||
'cursor_color_default' : True,
|
'cursor_color_default' : True,
|
||||||
'term' : 'xterm-256color',
|
'term' : 'xterm-256color',
|
||||||
'colorterm' : 'truecolor',
|
'colorterm' : 'truecolor',
|
||||||
|
|
|
@ -1592,12 +1592,13 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton" id="cursor_color_default">
|
<object class="GtkCheckButton" id="cursor_color_default_checkbutton">
|
||||||
<property name="label" translatable="yes">Use default colors</property>
|
<property name="label" translatable="yes">Use default colors</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">False</property>
|
<property name="receives-default">False</property>
|
||||||
<property name="draw-indicator">True</property>
|
<property name="draw-indicator">True</property>
|
||||||
|
<signal name="toggled" handler="on_cursor_color_default_checkbutton_toggled" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
|
@ -1640,6 +1641,7 @@
|
||||||
<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">True</property>
|
||||||
|
<signal name="color-set" handler="on_cursor_fg_color_color_set" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -1662,6 +1664,7 @@
|
||||||
<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">True</property>
|
||||||
|
<signal name="color-set" handler="on_cursor_bg_color_color_set" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|
|
@ -498,24 +498,27 @@ 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 - Radio values
|
# Cursor use default colors
|
||||||
if self.config['cursor_color_fg']:
|
widget = guiget('cursor_color_default_checkbutton')
|
||||||
widget = guiget('cursor_color_foreground_radiobutton')
|
widget.set_active(self.config['cursor_color_default'])
|
||||||
else:
|
# Cursor foreground
|
||||||
widget = guiget('cursor_color_custom_radiobutton')
|
widget = guiget('cursor_fg_color')
|
||||||
widget.set_active(True)
|
|
||||||
# Cursor colour - swatch
|
|
||||||
widget = guiget('cursor_color')
|
|
||||||
widget.set_sensitive(not self.config['cursor_color_fg'])
|
|
||||||
try:
|
try:
|
||||||
widget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
widget.set_color(Gdk.color_parse(self.config['cursor_fg_color']))
|
||||||
except (ValueError, TypeError):
|
except:
|
||||||
try:
|
try:
|
||||||
self.config['cursor_color'] = self.config['foreground_color']
|
widget.set_color(Gdk.color_parse(self.config['background_color']))
|
||||||
widget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
except:
|
||||||
except ValueError:
|
widget.set_color(Gdk.color_parse('#000000'))
|
||||||
self.config['cursor_color'] = "#FFFFFF"
|
# Cursor background
|
||||||
widget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
widget = guiget('cursor_bg_color')
|
||||||
|
try:
|
||||||
|
widget.set_color(Gdk.color_parse(self.config['cursor_bg_color']))
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
widget.set_color(Gdk.color_parse(self.config['foreground_color']))
|
||||||
|
except:
|
||||||
|
widget.set_color(Gdk.color_parse('#ffffff'))
|
||||||
|
|
||||||
## Command tab
|
## Command tab
|
||||||
# Login shell
|
# Login shell
|
||||||
|
@ -1159,29 +1162,25 @@ 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):
|
def on_cursor_color_default_checkbutton_toggled(self, checkbutton):
|
||||||
|
"""Cursor: Use default colors changed"""
|
||||||
guiget = self.builder.get_object
|
guiget = self.builder.get_object
|
||||||
|
|
||||||
customwidget = guiget('cursor_color_custom_radiobutton')
|
value = checkbutton.get_active()
|
||||||
colorwidget = guiget('cursor_color')
|
guiget('cursor_fg_color').set_sensitive(not value)
|
||||||
|
guiget('cursor_bg_color').set_sensitive(not value)
|
||||||
|
|
||||||
colorwidget.set_sensitive(customwidget.get_active())
|
self.config['cursor_color_default'] = value
|
||||||
self.config['cursor_color_fg'] = not customwidget.get_active()
|
|
||||||
|
|
||||||
try:
|
|
||||||
colorwidget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
|
||||||
except (ValueError, TypeError):
|
|
||||||
try:
|
|
||||||
self.config['cursor_color'] = self.config['foreground_color']
|
|
||||||
colorwidget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
|
||||||
except ValueError:
|
|
||||||
self.config['cursor_color'] = "#FFFFFF"
|
|
||||||
colorwidget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
def on_cursor_color_color_set(self, widget):
|
def on_cursor_fg_color_color_set(self, widget):
|
||||||
"""Cursor colour changed"""
|
"""Cursor foreground color changed"""
|
||||||
self.config['cursor_color'] = color2hex(widget)
|
self.config['cursor_fg_color'] = color2hex(widget)
|
||||||
|
self.config.save()
|
||||||
|
|
||||||
|
def on_cursor_bg_color_color_set(self, widget):
|
||||||
|
"""Cursor background color changed"""
|
||||||
|
self.config['cursor_bg_color'] = color2hex(widget)
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
def on_cursor_shape_combobox_changed(self, widget):
|
def on_cursor_shape_combobox_changed(self, widget):
|
||||||
|
|
Loading…
Reference in New Issue