[meld] gutterrendererchunk: Cache view editability across a drawing run



commit 0d8f6af5b496acf4db9232c85120b6b65ed73c20
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Mon Oct 3 07:54:31 2016 +1000

    gutterrendererchunk: Cache view editability across a drawing run

 meld/gutterrendererchunk.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/meld/gutterrendererchunk.py b/meld/gutterrendererchunk.py
index 863c756..b4e9502 100644
--- a/meld/gutterrendererchunk.py
+++ b/meld/gutterrendererchunk.py
@@ -203,6 +203,9 @@ class GutterRendererChunkAction(
         copy_down.connect('activate', copy_chunk, chunk, False)
         return copy_menu
 
+    def do_begin(self, *args):
+        self.views_editable = [v.get_editable() for v in self.views]
+
     def do_draw(self, context, background_area, cell_area, start, end, state):
         GtkSource.GutterRendererPixbuf.do_draw(
             self, context, background_area, cell_area, start, end, state)
@@ -240,7 +243,7 @@ class GutterRendererChunkAction(
         Returns the action that can be performed given the content and
         context of the change.
         """
-        editable, other_editable = [v.get_editable() for v in self.views]
+        editable, other_editable = self.views_editable
 
         if not editable and not other_editable:
             return None


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]