[meld] Move selected translations out of frequently executed code
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Move selected translations out of frequently executed code
- Date: Sat, 22 Oct 2011 21:55:13 +0000 (UTC)
commit ddea72bc2ea8bc92a742ed9b2d888d520ea8dd3b
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Mar 21 17:22:39 2010 +1000
Move selected translations out of frequently executed code
Scrolling through commits using the keyboard shows up the translation
of the line/column and overwrite labels as unusually expensive calls.
This patch eliminates this overhead by caching the translated strings.
meld/filediff.py | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 595a790..172155c 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -396,6 +396,11 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self.on_cursor_position_changed)
buf.handlers = id0, id1, id2, id3, id4
+ # Abbreviations for insert and overwrite that fit in the status bar
+ _insert_overwrite_text = (_("INS"), _("OVR"))
+ # Abbreviation for line, column so that it will fit in the status bar
+ _line_column_text = _("Ln %i, Col %i")
+
def on_cursor_position_changed(self, buf, pspec, force=False):
pane = self.textbuffer.index(buf)
pos = buf.props.cursor_position
@@ -407,10 +412,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
offset = cursor_it.get_line_offset()
line = cursor_it.get_line()
- # Abbreviations for insert and overwrite that fit in the status bar
- insert_overwrite = (_("INS"), _("OVR"))[self.textview_overwrite]
- # Abbreviation for line, column so that it will fit in the status bar
- line_column = _("Ln %i, Col %i") % (line + 1, offset + 1)
+ insert_overwrite = self._insert_overwrite_text[self.textview_overwrite]
+ line_column = self._line_column_text % (line + 1, offset + 1)
status = "%s : %s" % (insert_overwrite, line_column)
self.emit("status-changed", status)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]