From 262d4bf53fd749fe3e9aac4a776e031c39140494 Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Mon, 4 Mar 2013 23:29:22 -0500 Subject: [PATCH] bugfix: examples working in PyQt 4.9.6 (workaround for API change) --- examples/__main__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/__main__.py b/examples/__main__.py index bdf10523..57caa7e0 100644 --- a/examples/__main__.py +++ b/examples/__main__.py @@ -96,6 +96,7 @@ class ExampleLoader(QtGui.QMainWindow): self.codeBtn.hide() global examples + self.itemCache = [] self.populateTree(self.ui.exampleTree.invisibleRootItem(), examples) self.ui.exampleTree.expandAll() @@ -122,6 +123,9 @@ class ExampleLoader(QtGui.QMainWindow): def populateTree(self, root, examples): for key, val in examples.items(): item = QtGui.QTreeWidgetItem([key]) + self.itemCache.append(item) # PyQt 4.9.6 no longer keeps references to these wrappers, + # so we need to make an explicit reference or else the .file + # attribute will disappear. if isinstance(val, basestring): item.file = val else: