[meld: 6/12] fallback to the supported override version if it fails



commit 948aa39e35998c2a2407154c552d2ee189a144d3
Author: hugosenari <hugosenari gmail com>
Date:   Sun Aug 5 05:37:58 2018 -0300

    fallback to the supported override version if it fails

 meld/treehelpers.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/meld/treehelpers.py b/meld/treehelpers.py
index 256e113f..d10bb5a7 100644
--- a/meld/treehelpers.py
+++ b/meld/treehelpers.py
@@ -19,7 +19,12 @@ from gi.repository import GObject
 from gi.repository import Gtk
 
 
-_GIGtk = get_introspection_module('Gtk')
+_GIGtk = None
+
+try:
+    _GIGtk = get_introspection_module('Gtk')
+except Exception:
+    pass
 
 
 def tree_path_as_tuple(path):
@@ -154,10 +159,9 @@ class SearchableTreeStore(Gtk.TreeStore):
 
         return None
         """
-        if treeiter:
-            if value is None and hasattr(self, '_none_of_cols'):
-                value = self._none_of_cols.get(column)
-            if value is None:
-                self.set_value(treeiter, column, value)
-            else:
-                _GIGtk.TreeStore.set_value(self, treeiter, column, value)
+        if value is None and hasattr(self, '_none_of_cols'):
+            value = self._none_of_cols.get(column)
+        if value is not None and _GIGtk and treeiter:
+            _GIGtk.TreeStore.set_value(self, treeiter, column, value)
+        else:
+            self.set_value(treeiter, column, value)


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