Skip to content

Commit

Permalink
Merge pull request #141 from dugb/issue_111
Browse files Browse the repository at this point in the history
Issue 111, add line_height slider
  • Loading branch information
mattrose authored Jun 21, 2020
2 parents 0c1032a + 3d128f0 commit 412c80e
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
1 change: 1 addition & 0 deletions terminatorlib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
'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',
Expand Down
54 changes: 54 additions & 0 deletions terminatorlib/preferences.glade
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
19 changes: 19 additions & 0 deletions terminatorlib/prefseditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ def set_values(self):
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')
Expand Down Expand Up @@ -1100,6 +1107,18 @@ def on_handlesize_value_changed(self, widget):
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()
Expand Down
3 changes: 3 additions & 0 deletions terminatorlib/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,8 @@ def reconfigure(self, _widget=None):
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'])

Expand Down Expand Up @@ -813,6 +815,7 @@ def reconfigure(self, _widget=None):
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()
Expand Down

0 comments on commit 412c80e

Please sign in to comment.