[gedit-plugins] Improve Text Size menu item names. Fixes bug #697385.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-plugins] Improve Text Size menu item names. Fixes bug #697385.
- Date: Fri, 5 Apr 2013 18:26:56 +0000 (UTC)
commit dc06ad91fa8f87c133a209b791438def1684bbde
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Fri Apr 5 20:25:49 2013 +0200
Improve Text Size menu item names. Fixes bug #697385.
plugins/textsize/textsize/__init__.py | 54 +++++++++++++-------------
plugins/textsize/textsize/documenthelper.py | 16 ++++----
2 files changed, 35 insertions(+), 35 deletions(-)
---
diff --git a/plugins/textsize/textsize/__init__.py b/plugins/textsize/textsize/__init__.py
index 2d853c8..acfbb68 100644
--- a/plugins/textsize/textsize/__init__.py
+++ b/plugins/textsize/textsize/__init__.py
@@ -40,9 +40,9 @@ ui_str = """
<menu name="ViewMenu" action="View">
<placeholder name="ViewOps_2">
<separator/>
- <menuitem name="IncreaseFontSize" action="IncreaseFontSizeAction"/>
- <menuitem name="DecreaseFontSize" action="DecreaseFontSizeAction"/>
- <menuitem name="ResetFontSize" action="ResetFontSizeAction"/>
+ <menuitem name="LargerText" action="LargerTextAction"/>
+ <menuitem name="SmallerText" action="SmallerTextAction"/>
+ <menuitem name="NormalSize" action="NormalSizeAction"/>
<separator/>
</placeholder>
</menu>
@@ -75,9 +75,9 @@ class TextSizePlugin(GObject.Object, Gedit.WindowActivatable):
self.window.add_accel_group(self._accel_group)
self._proxy_callback_map = {
- 'IncreaseFontSizeAction': self.on_increase_font_accel,
- 'DecreaseFontSizeAction': self.on_decrease_font_accel,
- 'ResetFontSizeAction': self.on_reset_font_accel
+ 'LargerTextAction': self.on_larger_text_accel,
+ 'SmallerTextAction': self.on_smaller_text_accel,
+ 'NormalSizeAction': self.on_normal_size_accel
}
self._proxy_mapping = {}
@@ -115,9 +115,9 @@ class TextSizePlugin(GObject.Object, Gedit.WindowActivatable):
self._proxy_mapping[action] = (key, mod)
def _init_proxy_accels(self):
- self._install_proxy('IncreaseFontSizeAction')
- self._install_proxy('DecreaseFontSizeAction')
- self._install_proxy('ResetFontSizeAction')
+ self._install_proxy('LargerTextAction')
+ self._install_proxy('SmallerTextAction')
+ self._install_proxy('NormalSizeAction')
def do_deactivate(self):
# Remove any installed menu items
@@ -139,15 +139,15 @@ class TextSizePlugin(GObject.Object, Gedit.WindowActivatable):
# Create a new action group
self._action_group = Gtk.ActionGroup("GeditTextSizePluginActions")
- self._action_group.add_actions([("IncreaseFontSizeAction", None, _("_Increase font size"),
+ self._action_group.add_actions([("LargerTextAction", None, _("_Larger Text"),
"<Ctrl>plus", None,
- self.on_increase_font_size_activate),
- ("DecreaseFontSizeAction", None, _("_Decrease font size"),
+ self.on_larger_text_activate),
+ ("SmallerTextAction", None, _("S_maller Text"),
"<Ctrl>minus", None,
- self.on_decrease_font_size_activate),
- ("ResetFontSizeAction", None, _("_Reset font size"),
+ self.on_smaller_text_activate),
+ ("NormalSizeAction", None, _("_Normal size"),
"<Ctrl>0", None,
- self.on_reset_font_size_activate)])
+ self.on_normal_size_activate)])
# Insert the action group
manager.insert_action_group(self._action_group)
@@ -195,23 +195,23 @@ class TextSizePlugin(GObject.Object, Gedit.WindowActivatable):
cb(self.get_helper(view))
# Menu activate handlers
- def on_increase_font_size_activate(self, action, user_data=None):
- self.call_helper(lambda helper: helper.increase_font_size())
+ def on_larger_text_activate(self, action, user_data=None):
+ self.call_helper(lambda helper: helper.larger_text())
- def on_decrease_font_size_activate(self, action, user_data=None):
- self.call_helper(lambda helper: helper.decrease_font_size())
+ def on_smaller_text_activate(self, action, user_data=None):
+ self.call_helper(lambda helper: helper.smaller_text())
- def on_reset_font_size_activate(self, action, user_data=None):
- self.call_helper(lambda helper: helper.reset_font_size())
+ def on_normal_size_activate(self, action, user_data=None):
+ self.call_helper(lambda helper: helper.normal_size())
- def on_increase_font_accel(self, group, accel, key, mod):
- self.call_helper(lambda helper: helper.increase_font_size())
+ def on_larger_text_accel(self, group, accel, key, mod):
+ self.call_helper(lambda helper: helper.larger_text())
- def on_decrease_font_accel(self, group, accel, key, mod):
- self.call_helper(lambda helper: helper.decrease_font_size())
+ def on_smaller_text_accel(self, group, accel, key, mod):
+ self.call_helper(lambda helper: helper.smaller_text())
- def on_reset_font_accel(self, group, accel, key, mod):
- self.call_helper(lambda helper: helper.reset_font_size())
+ def on_normal_size_accel(self, group, accel, key, mod):
+ self.call_helper(lambda helper: helper.normal_size())
def on_tab_added(self, window, tab):
self.add_document_helper(tab.get_view())
diff --git a/plugins/textsize/textsize/documenthelper.py b/plugins/textsize/textsize/documenthelper.py
index ba9ca61..efb98df 100644
--- a/plugins/textsize/textsize/documenthelper.py
+++ b/plugins/textsize/textsize/documenthelper.py
@@ -134,13 +134,13 @@ class DocumentHelper(Signals):
buf.apply_tag(newtag, start, end)
- def increase_font_size(self):
+ def larger_text(self):
self.set_font_size(1)
- def decrease_font_size(self):
+ def smaller_text(self):
self.set_font_size(-1)
- def reset_font_size(self):
+ def normal_size(self):
self.update_default_font()
buf = self._view.get_buffer()
@@ -164,16 +164,16 @@ class DocumentHelper(Signals):
return False
if event.direction == Gdk.ScrollDirection.UP:
- self.increase_font_size()
+ self.larger_text()
return True
elif event.direction == Gdk.ScrollDirection.DOWN:
- self.decrease_font_size()
+ self.smaller_text()
return True
elif event.direction == Gdk.ScrollDirection.SMOOTH:
if event.delta_y > 0:
- self.decrease_font_size()
+ self.smaller_text()
elif event.delta_y < 0:
- self.increase_font_size()
+ self.larger_text()
return False
@@ -181,7 +181,7 @@ class DocumentHelper(Signals):
state = event.state & Gtk.accelerator_get_default_mod_mask()
if state == Gdk.ModifierType.CONTROL_MASK and event.button == 2:
- self.reset_font_size()
+ self.normal_size()
return True
else:
return False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]