Merge lp:~cfebs/terminator/terminator-add-ctrl-zoom-pref into lp:terminator/gtk3

Proposed by Collin Lefeber
Status: Needs review
Proposed branch: lp:~cfebs/terminator/terminator-add-ctrl-zoom-pref
Merge into: lp:terminator/gtk3
Diff against target: 134 lines (+43/-13)
4 files modified
terminatorlib/config.py (+1/-0)
terminatorlib/preferences.glade (+18/-0)
terminatorlib/prefseditor.py (+13/-5)
terminatorlib/terminal.py (+11/-8)
To merge this branch: bzr merge lp:~cfebs/terminator/terminator-add-ctrl-zoom-pref
Reviewer Review Type Date Requested Status
Bryce Harrington code review Approve
Review via email: mp+364993@code.launchpad.net

Commit message

Adds preference to toggle Ctrl+Scroll zoom feature

Description of the change

Controlling zoom in/out with Ctrl and Touchpad/Mouse zoom can be tricky with a very sensitive touch pad.

This PR adds an option (enabled by default to match current behavior) that allows users to disable this feature if they desire.
The option in the UI is called "Enable Ctrl Scroll Zoom"

Related issues:
- https://bugs.launchpad.net/ubuntu/+source/terminator/+bug/1435630
- https://bugs.launchpad.net/terminator/+bug/1505292
- https://bugs.launchpad.net/terminator/+bug/1638607

To post a comment you must log in.
1814. By Collin Lefeber

Add ctrl zoom scroll preference

Revision history for this message
Bryce Harrington (bryce) wrote :

Conceptually and implementationally LGTM. The patch appears to include some whitespace changes but I don't think those should inhibit inclusion of this patch.

I haven't hit this particular problem however I've accidentally zoomed via inadvertent <ctrl>+<shift>+<+>. Having things zoom accidentally is indeed a bit irritating, so ensuring ways of controlling it will give user's better control.

review: Approve (code review)

Unmerged revisions

1814. By Collin Lefeber

Add ctrl zoom scroll preference

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'terminatorlib/config.py'
2--- terminatorlib/config.py 2017-02-01 09:03:29 +0000
3+++ terminatorlib/config.py 2019-03-22 22:48:25 +0000
4@@ -98,6 +98,7 @@
5 'homogeneous_tabbar' : True,
6 'hide_from_taskbar' : False,
7 'always_on_top' : False,
8+ 'ctrl_scroll_zoom' : True,
9 'hide_on_lose_focus' : False,
10 'sticky' : False,
11 'use_custom_url_handler': False,
12
13=== modified file 'terminatorlib/preferences.glade'
14--- terminatorlib/preferences.glade 2016-12-13 21:08:02 +0000
15+++ terminatorlib/preferences.glade 2019-03-22 22:48:25 +0000
16@@ -552,6 +552,24 @@
17 <property name="width">2</property>
18 </packing>
19 </child>
20+ <child>
21+ <object class="GtkCheckButton" id="ctrlscrollzoomcheck">
22+ <property name="label" translatable="no">Enable Ctrl Scroll Zoom</property>
23+ <property name="use_action_appearance">False</property>
24+ <property name="visible">True</property>
25+ <property name="can_focus">True</property>
26+ <property name="receives_default">True</property>
27+ <property name="xalign">0.5</property>
28+ <property name="active">True</property>
29+ <property name="draw_indicator">True</property>
30+ <signal name="toggled" handler="on_ctrlscrollzoomcheck_toggled" swapped="no"/>
31+ </object>
32+ <packing>
33+ <property name="left_attach">0</property>
34+ <property name="top_attach">7</property>
35+ <property name="width">2</property>
36+ </packing>
37+ </child>
38 </object>
39 <packing>
40 <property name="expand">True</property>
41
42=== modified file 'terminatorlib/prefseditor.py'
43--- terminatorlib/prefseditor.py 2017-06-24 02:02:38 +0000
44+++ terminatorlib/prefseditor.py 2019-03-22 22:48:25 +0000
45@@ -1,5 +1,5 @@
46 #!/usr/bin/env python2
47-"""Preferences Editor for Terminator.
48+"""Preferences Editor for Terminator.
49
50 Load a UIBuilder config file, display it,
51 populate it with our current config, then optionally read that back out and
52@@ -165,7 +165,7 @@
53 'edit_tab_title' : _('Edit tab title'),
54 'layout_launcher' : _('Open layout launcher window'),
55 'next_profile' : _('Switch to next profile'),
56- 'previous_profile' : _('Switch to previous profile'),
57+ 'previous_profile' : _('Switch to previous profile'),
58 'help' : _('Open the manual')
59 }
60
61@@ -301,6 +301,9 @@
62 #Always on top
63 widget = guiget('alwaysontopcheck')
64 widget.set_active(self.config['always_on_top'])
65+ #Ctrl scroll zooming
66+ widget = guiget('ctrlscrollzoomcheck')
67+ widget.set_active(self.config['ctrl_scroll_zoom'])
68 #Hide on lose focus
69 widget = guiget('hideonlosefocuscheck')
70 widget.set_active(self.config['hide_on_lose_focus'])
71@@ -715,6 +718,11 @@
72 self.config['always_on_top'] = widget.get_active()
73 self.config.save()
74
75+ def on_ctrlscrollzoomcheck_toggled(self, widget):
76+ """Ctrl scroll zoom setting changed"""
77+ self.config['ctrl_scroll_zoom'] = widget.get_active()
78+ self.config.save()
79+
80 def on_hideonlosefocuscheck_toggled(self, widget):
81 """Hide on lose focus setting changed"""
82 self.config['hide_on_lose_focus'] = widget.get_active()
83@@ -976,10 +984,10 @@
84
85 customwidget = guiget('cursor_color_custom_radiobutton')
86 colorwidget = guiget('cursor_color')
87-
88+
89 colorwidget.set_sensitive(customwidget.get_active())
90 self.config['cursor_color_fg'] = not customwidget.get_active()
91-
92+
93 try:
94 colorwidget.set_color(Gdk.color_parse(self.config['cursor_color']))
95 except (ValueError, TypeError):
96@@ -1264,7 +1272,7 @@
97 widget.set_sensitive(not value)
98 self.config['use_system_font'] = value
99 self.config.save()
100-
101+
102 if self.config['use_system_font'] == True:
103 fontname = self.config.get_system_mono_font()
104 if fontname is not None:
105
106=== modified file 'terminatorlib/terminal.py'
107--- terminatorlib/terminal.py 2017-06-24 02:02:38 +0000
108+++ terminatorlib/terminal.py 2019-03-22 22:48:25 +0000
109@@ -964,14 +964,17 @@
110 targets=self.terminator.get_target_terms(self)
111 else:
112 targets=[self]
113- if event.direction == Gdk.ScrollDirection.UP or SMOOTH_SCROLL_UP:
114- for target in targets:
115- target.zoom_in()
116- return (True)
117- elif event.direction == Gdk.ScrollDirection.DOWN or SMOOTH_SCROLL_DOWN:
118- for target in targets:
119- target.zoom_out()
120- return (True)
121+
122+ if self.config['ctrl_scroll_zoom']:
123+ if event.direction == Gdk.ScrollDirection.UP or SMOOTH_SCROLL_UP:
124+ for target in targets:
125+ target.zoom_in()
126+ return (True)
127+ elif event.direction == Gdk.ScrollDirection.DOWN or SMOOTH_SCROLL_DOWN:
128+ for target in targets:
129+ target.zoom_out()
130+ return (True)
131+
132 if event.state & Gdk.ModifierType.SHIFT_MASK == Gdk.ModifierType.SHIFT_MASK:
133 # Shift + mouse wheel up/down
134 if event.direction == Gdk.ScrollDirection.UP or SMOOTH_SCROLL_UP:

Subscribers

People subscribed via source and target branches

to status/vote changes: