Nuke come with PySide included so that might be the reason, they changed a
few version ago from PyQt, try changing your code to use PySide, that might
work better, is just a few simple changes.

cheers


     .:varomix:.
MIX Studio
3D Artist/Generalist TD
varo...@varomix.net <varo...@gmail.com>
Contact Me [image: Linkedin] <http://mx.linkedin.com/in/varomix>[image:
Facebook] <http://www.facebook.com/varomix>[image:
Twitter]<http://www.twitter.com/varomix>



On Fri, Jan 25, 2013 at 10:14 AM, pexproduction <
nuke-python-re...@thefoundry.co.uk> wrote:

> **
> Hi everyone, im trying some UI stuff with pyqt4 and when i use the filter
> field nuke crashes, any idea what im doing wrong? stand alone works fine,
> but in nuke freacks out! [image: Sad]
>
> Code:
>
> from PyQt4 import QtGui, QtCore
>
>
> FIRST_COLUMN = 0
>
>
> class Example(QtGui.QWidget):
> def __init__(self):
> super(Example, self).__init__()
>
> self.setGeometry(300, 300, 400, 240)
> self.setWindowTitle("Filtering data")
>
> self.initData()
> self.initUI()
>
> def initData(self):
>
> words = QtCore.QStringList()
> words.append("radar")
> words.append("Robert")
> words.append("Rome")
> words.append("rodeo")
> words.append("rust")
> words.append("ready")
> words.append("robot")
> words.append("rampart")
> words.append("RAM")
> words.append("ROM")
>
> self.model = QtGui.QStringListModel(words)
> self.filterModel = QtGui.QSortFilterProxyModel(self)
> self.filterModel.setSourceModel(self.model)
> self.filterModel.setDynamicSortFilter(True)
>
>
> def initUI(self):
>
>
> self.filterText = QtGui.QLineEdit(self)
> self.filterText.move(250, 20)
>
>
>
> self.case = QtGui.QCheckBox("Case sensitive", self)
> self.case.move(250, 70)
>
> self.filterCb = QtGui.QComboBox(self)
> self.filterCb.addItem("Regular expression",
> QtCore.QVariant(QtCore.QRegExp.RegExp))
> self.filterCb.addItem("Wildcard",
> QtCore.QVariant(QtCore.QRegExp.Wildcard))
> self.filterCb.addItem("Fixed string",
> QtCore.QVariant(QtCore.QRegExp.FixedString))
> self.filterCb.move(20, 190)
>
>
> self.connect(self.filterCb,
> QtCore.SIGNAL('activated(const QString &)'),
> self.filterItems)
>
> self.connect(self.filterText,
> QtCore.SIGNAL('textChanged(const QString &)'),
> self.filterItems)
>
> self.connect(self.case, QtCore.SIGNAL('toggled(bool)'),
> self.filterItems)
>
>
> self.lv = QtGui.QListView(self)
> self.lv.setModel(self.filterModel)
> self.lv.setGeometry(20, 20, 200, 150)
>
>
> def filterItems(self, value):
>
> idx = self.filterCb.currentIndex()
> syntaxType, _ = self.filterCb.itemData(idx).toInt()
> syntax = QtCore.QRegExp.PatternSyntax(syntaxType)
>
> if self.case.isChecked():
> case = QtCore.Qt.CaseSensitive
> else:
> case = QtCore.Qt.CaseInsensitive
>
> regExp = QtCore.QRegExp(self.filterText.text(),
> case, syntax)
> self.filterModel.setFilterRegExp(regExp)
>
>
>
>
> ex = Example()
> ex.show()
>
> _______________________________________________
> Nuke-python mailing list
> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to