[pygobject] Add set_attributes() override to Gtk.TreeViewColumn
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Add set_attributes() override to Gtk.TreeViewColumn
- Date: Fri, 27 Jul 2012 20:13:10 +0000 (UTC)
commit a46d165d906d0ac7613f4d946542423e979f39d5
Author: Manuel QuiÃones <manuq laptop org>
Date: Fri Jul 20 10:37:04 2012 -0300
Add set_attributes() override to Gtk.TreeViewColumn
Looking at the C code, gtk_tree_view_column_set_attributesv just calls
gtk_cell_layout_clear_attributes and then
gtk_cell_layout_add_attribute for each (name, value) passed. This
patch makes the same in the overrides.
Signed-off-by: Manuel QuiÃones <manuq laptop org>
Signed-off-by: Martin Pitt <martinpitt gnome org>
gi/overrides/Gtk.py | 7 +++++++
tests/test_overrides.py | 6 ++++++
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 68d0f41..8418ca4 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -1399,6 +1399,13 @@ class TreeViewColumn(Gtk.TreeViewColumn):
def set_cell_data_func(self, cell_renderer, func, func_data=None):
super(TreeViewColumn, self).set_cell_data_func(cell_renderer, func, func_data)
+ def set_attributes(self, cell_renderer, **attributes):
+ Gtk.CellLayout.clear_attributes(self, cell_renderer)
+
+ for (name, value) in attributes.items():
+ Gtk.CellLayout.add_attribute(self, cell_renderer, name, value)
+
+
TreeViewColumn = override(TreeViewColumn)
__all__.append('TreeViewColumn')
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 9438add..c1f6968 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -1652,6 +1652,12 @@ class TestGtk(unittest.TestCase):
text=0,
style=2)
+ def test_tree_view_column_set_attributes(self):
+ cell = Gtk.CellRendererText()
+ column = Gtk.TreeViewColumn()
+ column.pack_start(cell, expand=True)
+ column.set_attributes(cell, text=0, style=2)
+
def test_tree_selection(self):
store = Gtk.ListStore(int, str)
for i in range(10):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]