add line-height slider

This commit is contained in:
Douglas Bacon 2020-06-21 14:35:50 -04:00
parent c4a6ac96c8
commit 3d128f0334
2 changed files with 73 additions and 0 deletions

View File

@ -313,6 +313,13 @@
<property name="step_increment">1</property> <property name="step_increment">1</property>
<property name="page_increment">2</property> <property name="page_increment">2</property>
</object> </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"> <object class="GtkAdjustment" id="adjustment2">
<property name="upper">100</property> <property name="upper">100</property>
<property name="step_increment">1</property> <property name="step_increment">1</property>
@ -904,6 +911,53 @@
<property name="top_attach">1</property> <property name="top_attach">1</property>
</packing> </packing>
</child> </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> <child>
<object class="GtkScale" id="inactive_color_offset"> <object class="GtkScale" id="inactive_color_offset">
<property name="width_request">100</property> <property name="width_request">100</property>

View File

@ -240,6 +240,13 @@ class PrefsEditor:
widget.set_value(float(termsepsize)) widget.set_value(float(termsepsize))
widget = guiget('handlesize_value_label') widget = guiget('handlesize_value_label')
widget.set_text(str(termsepsize)) 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 # Window geometry hints
geomhint = self.config['geometry_hinting'] geomhint = self.config['geometry_hinting']
widget = guiget('wingeomcheck') widget = guiget('wingeomcheck')
@ -1100,6 +1107,18 @@ class PrefsEditor:
label_widget = guiget('handlesize_value_label') label_widget = guiget('handlesize_value_label')
label_widget.set_text(str(value)) 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): def on_focuscombo_changed(self, widget):
"""Focus type changed""" """Focus type changed"""
selected = widget.get_active() selected = widget.get_active()