[pygobject] Fix pygtkcompat's Gtk.TreeView.insert_column_with_attributes()
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Fix pygtkcompat's Gtk.TreeView.insert_column_with_attributes()
- Date: Mon, 3 Sep 2012 13:40:52 +0000 (UTC)
commit 96fa22369fd188465559fc904c7f76e73040e6dd
Author: Martin Pitt <martinpitt gnome org>
Date: Mon Sep 3 15:32:12 2012 +0200
Fix pygtkcompat's Gtk.TreeView.insert_column_with_attributes()
We have a proper implementation for insert_column_with_attributes() now, so
drop pygtkcompat's empty stub for it.
Also improve test case for Gtk.TreeView.insert_column_with_attributes().
gi/pygtkcompat.py | 6 ------
tests/test_overrides_gtk.py | 16 ++++++++--------
2 files changed, 8 insertions(+), 14 deletions(-)
---
diff --git a/gi/pygtkcompat.py b/gi/pygtkcompat.py
index 4bb8776..2c81d3f 100644
--- a/gi/pygtkcompat.py
+++ b/gi/pygtkcompat.py
@@ -247,12 +247,6 @@ def enable_gtk(version='2.0'):
orig_tree_view_column_pack_start(self, cell, expand)
Gtk.TreeViewColumn.pack_start = tree_view_column_pack_start
- # TreeView
-
- def insert_column_with_attributes(view, position, title, cell, *args, **kwargs):
- pass
- Gtk.TreeView.insert_column_with_attributes = insert_column_with_attributes
-
# CellLayout
orig_cell_pack_end = Gtk.CellLayout.pack_end
diff --git a/tests/test_overrides_gtk.py b/tests/test_overrides_gtk.py
index 0527434..ee41457 100644
--- a/tests/test_overrides_gtk.py
+++ b/tests/test_overrides_gtk.py
@@ -1356,21 +1356,21 @@ class TestTreeView(unittest.TestCase):
tree.insert_column_with_attributes(0, 'Head1', cell1, text=1)
tree.insert_column_with_attributes(-1, 'Head3', cell3, text=0)
# unconnected
- tree.insert_column_with_attributes(-1, 'Head4', cell3)
-
- self.assertEqual(tree.get_column(0).get_title(), 'Head1')
- self.assertEqual(tree.get_column(1).get_title(), 'Head2')
- self.assertEqual(tree.get_column(2).get_title(), 'Head3')
- self.assertEqual(tree.get_column(3).get_title(), 'Head4')
+ tree.insert_column_with_attributes(-1, 'Head4', cell4)
# might cause a Pango warning, do not break on this
old_mask = GLib.log_set_always_fatal(
GLib.LogLevelFlags.LEVEL_CRITICAL | GLib.LogLevelFlags.LEVEL_ERROR)
- # This will make cell.props.text receive a value, otherwise it
- # will be None.
+ # causes the widget to get realized and cellN.props.text receive a
+ # value, otherwise it will be None.
tree.get_preferred_size()
GLib.log_set_always_fatal(old_mask)
+ self.assertEqual(tree.get_column(0).get_title(), 'Head1')
+ self.assertEqual(tree.get_column(1).get_title(), 'Head2')
+ self.assertEqual(tree.get_column(2).get_title(), 'Head3')
+ self.assertEqual(tree.get_column(3).get_title(), 'Head4')
+
# cursor should be at the first row
self.assertEqual(cell1.props.text, 'cell11')
self.assertEqual(cell2.props.text, 'cell12')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]