Merge pull request #141 from dugb/issue_111

Issue 111, add line_height slider
This commit is contained in:
Matt Rose 2020-06-21 15:23:09 -04:00 committed by GitHub
commit 412c80eec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 77 additions and 0 deletions

View File

@ -235,6 +235,7 @@ DEFAULTS = {
'use_system_font' : True,
'use_theme_colors' : False,
'bold_is_bright' : False,
'line_height' : 1.0,
'encoding' : 'UTF-8',
'active_encodings' : ['UTF-8', 'ISO-8859-1'],
'focus_on_close' : 'auto',

View File

@ -313,6 +313,13 @@
<property name="step_increment">1</property>
<property name="page_increment">2</property>
</object>
<object class="GtkAdjustment" id="adjustment_lineheight">
<property name="lower">1.0</property>
<property name="upper">2.0</property>
<property name="value">1.0</property>
<property name="step_increment">0.1</property>
<property name="page_increment">0.2</property>
</object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">100</property>
<property name="step_increment">1</property>
@ -904,6 +911,53 @@
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="line_height_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Line Height:</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkScale" id="lineheight">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">baseline</property>
<property name="hexpand">True</property>
<property name="adjustment">adjustment_lineheight</property>
<property name="round_digits">1</property>
<property name="digits">1</property>
<property name="draw_value">False</property>
<property name="value_pos">bottom</property>
<signal name="value-changed" handler="on_lineheight_value_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="lineheight_value_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">1.0</property>
<property name="justify">right</property>
<property name="width_chars">5</property>
<property name="max_width_chars">5</property>
<property name="lines">1</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkScale" id="inactive_color_offset">
<property name="width_request">100</property>

View File

@ -240,6 +240,13 @@ class PrefsEditor:
widget.set_value(float(termsepsize))
widget = guiget('handlesize_value_label')
widget.set_text(str(termsepsize))
# Line Height
lineheightsize = self.config['line_height']
lineheightsize = round(float(lineheightsize),1)
widget = guiget('lineheight')
widget.set_value(lineheightsize)
widget = guiget('lineheight_value_label')
widget.set_text(str(lineheightsize))
# Window geometry hints
geomhint = self.config['geometry_hinting']
widget = guiget('wingeomcheck')
@ -1100,6 +1107,18 @@ class PrefsEditor:
label_widget = guiget('handlesize_value_label')
label_widget.set_text(str(value))
def on_lineheight_value_changed(self, widget):
"""Handles line height changed"""
value = widget.get_value()
value = round(float(value), 1)
if value > 2.0:
value = 2.0
self.config['line_height'] = value
self.config.save()
guiget = self.builder.get_object
label_widget = guiget('lineheight_value_label')
label_widget.set_text(str(value))
def on_focuscombo_changed(self, widget):
"""Focus type changed"""
selected = widget.get_active()

View File

@ -694,6 +694,8 @@ class Terminal(Gtk.VBox):
except:
pass
self.vte.set_allow_bold(self.config['allow_bold'])
if hasattr(self.vte,'set_cell_height_scale'):
self.vte.set_cell_height_scale(self.config['line_height'])
if hasattr(self.vte, 'set_bold_is_bright'):
self.vte.set_bold_is_bright(self.config['bold_is_bright'])
@ -813,6 +815,7 @@ class Terminal(Gtk.VBox):
elif self.config['scrollbar_position'] == 'right':
self.terminalbox.reorder_child(self.vte, 0)
self.vte.set_rewrap_on_resize(self.config['rewrap_on_resize'])
self.titlebar.update()