Skip to content

Commit

Permalink
Fix scrolling window
Browse files Browse the repository at this point in the history
fix #1082
fix #274
  • Loading branch information
gsemet committed Jan 21, 2018
1 parent d04a6bb commit ee52407
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 28 deletions.
5 changes: 5 additions & 0 deletions guake/data/org.guake.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@
<summary>History Size.</summary>
<description>The number of scrollback lines to save in history.</description>
</key>
<key name="infinite-history" type="b">
<default>false</default>
<summary>Infinite scrolling</summary>
<description>Scrollback lines in history is infinite</description>
</key>
<key name="scroll-output" type="b">
<default>false</default>
<summary>Scroll on output</summary>
Expand Down
122 changes: 97 additions & 25 deletions guake/data/prefs.glade
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.18"/>
<object class="GtkAdjustment" id="max_tab_name_length_adj">
<property name="upper">1000</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="scrollback_lines">
<property name="upper">10000000</property>
<property name="value">5000</property>
<property name="step_increment">1000</property>
<property name="page_increment">100000</property>
</object>
<object class="GtkAdjustment" id="transparency">
<property name="upper">100</property>
<property name="step_increment">1</property>
Expand Down Expand Up @@ -554,6 +565,7 @@
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="text" translatable="yes">0</property>
<property name="adjustment">max_tab_name_length_adj</property>
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
Expand Down Expand Up @@ -1162,6 +1174,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="adjustment">scrollback_lines</property>
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
Expand All @@ -1181,39 +1194,21 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="scroll_output">
<property name="label" translatable="yes">On output</property>
<object class="GtkCheckButton" id="infinite_history">
<property name="label" translatable="yes">Infinite scrolling</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_scroll_output_toggled" swapped="no"/>
<signal name="toggled" handler="on_infinite_history_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="scroll_keystroke">
<property name="label" translatable="yes">On key stroke</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_scroll_keystroke_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
Expand All @@ -1222,7 +1217,7 @@
<object class="GtkLabel" id="label11_11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;General&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Scrollbar&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
Expand All @@ -1243,7 +1238,82 @@
</packing>
</child>
<child>
<placeholder/>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">12</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="scroll_output">
<property name="label" translatable="yes">On output</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_scroll_output_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="scroll_keystroke">
<property name="label" translatable="yes">On key stroke</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_scroll_keystroke_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Scroll to Bottom&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
Expand Down Expand Up @@ -1311,6 +1381,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">8</property>
<property name="row_homogeneous">True</property>
<child>
<object class="GtkLabel" id="label14">
Expand Down Expand Up @@ -1461,7 +1532,7 @@
<property name="can_focus">False</property>
<property name="margin_top">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">4</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkLabel" id="label17">
<property name="visible">True</property>
Expand Down Expand Up @@ -1852,6 +1923,7 @@
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label19">
<property name="visible">True</property>
Expand Down
12 changes: 11 additions & 1 deletion guake/gsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def __init__(self, guake_inst):

settings.general.onChangedValue('use-scrollbar', self.scrollbar_toggled)
settings.general.onChangedValue('history-size', self.history_size_changed)
settings.general.onChangedValue('infinite-history', self.infinite_history_changed)
settings.general.onChangedValue('scroll-output', self.keystroke_output)
settings.general.onChangedValue('scroll-keystroke', self.keystroke_toggled)

Expand Down Expand Up @@ -167,8 +168,17 @@ def history_size_changed(self, settings, key, user_data):
be called and will set the scrollback_lines property of all
terminals open.
"""
lines = settings.get_int(key)
for i in self.guake.notebook.iter_terminals():
i.set_scrollback_lines(settings.get_int(key))
i.set_scrollback_lines(lines)

def infinite_history_changed(self, settings, key, user_data):
if settings.get_boolean(key):
lines = -1
else:
lines = self.settings.general.get_int("history-size")
for i in self.guake.notebook.iter_terminals():
i.set_scrollback_lines(lines)

def keystroke_output(self, settings, key, user_data):
"""If the gconf var scroll_output be changed, this method will
Expand Down
1 change: 1 addition & 0 deletions guake/guake_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,7 @@ def load_config(self):
self.settings.general.triggerOnChangedValue(self.settings.general, 'window-width')
self.settings.general.triggerOnChangedValue(self.settings.general, 'use-scrollbar')
self.settings.general.triggerOnChangedValue(self.settings.general, 'history-size')
self.settings.general.triggerOnChangedValue(self.settings.general, 'infinite-history')
self.settings.general.triggerOnChangedValue(self.settings.general, 'use-vte-titles')
self.settings.general.triggerOnChangedValue(self.settings.general, 'set-window-title')
self.settings.general.triggerOnChangedValue(self.settings.general, 'abbreviate-tab-names')
Expand Down
14 changes: 14 additions & 0 deletions guake/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,15 @@ def on_history_size_value_changed(self, spin):
"""
val = int(spin.get_value())
self.settings.general.set_int('history-size', val)
self._update_history_widgets()

def on_infinite_history_toggled(self, chk):
self.settings.general.set_boolean('infinite-history', chk.get_active())
self._update_history_widgets()

def _update_history_widgets(self):
infinite = self.prefDlg.get_widget('infinite_history').get_active()
self.prefDlg.get_widget('history_size').set_sensitive(not infinite)

def on_scroll_output_toggled(self, chk):
"""Changes the activity of scroll_output in gconf
Expand Down Expand Up @@ -988,6 +997,11 @@ def load_configs(self):
value = self.settings.general.get_int('history-size')
self.get_widget('history_size').set_value(value)

# infinite history
value = self.settings.general.get_boolean('infinite-history')
self.get_widget('infinite_history').set_active(value)
print("infinite history: ", value)

# scroll output
value = self.settings.general.get_boolean('scroll-output')
self.get_widget('scroll_output').set_active(value)
Expand Down
6 changes: 4 additions & 2 deletions guake/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,10 @@ def button_press(self, terminal, event):

self.found_link = None

if (event.button == 1 and
(event.get_state() & Gdk.ModifierType.CONTROL_MASK) and matched_string):
if (
event.button == 1 and (event.get_state() & Gdk.ModifierType.CONTROL_MASK) and
matched_string
):
log.debug("matched string: %s", matched_string)
value, tag = matched_string
# First searching in additional matchers
Expand Down
7 changes: 7 additions & 0 deletions releasenotes/notes/scroll-959087c80640ceaf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
features:
- |
Add "Infinite scrolling" option in "Scrolling" panel
fixes:
- |
fix history size spin

0 comments on commit ee52407

Please sign in to comment.