Pyqt under windows for nuke is buggy. Signals like textChanged crash
nuke (but not under linux)
 Thats why they added Pyside


On Thu, Jan 31, 2013, at 9:51, Alvaro Castaneda wrote:

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

[mix.jpeg]
          .:varomix:.
          MIX Studio
          3D Artist/Generalist TD
          [1]varo...@varomix.net
Contact Me [2]Linkedin [3]Facebook [4]Twitter
On Fri, Jan 25, 2013 at 10:14 AM, pexproduction
<[5]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! 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)
[6]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
  [7]Nuke-python@support.thefoundry.co.uk,
  [8]http://forums.thefoundry.co.uk/
  [9]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-pyt
  hon


_______________________________________________

Nuke-python mailing list

[10]Nuke-python@support.thefoundry.co.uk,
[11]http://forums.thefoundry.co.uk/

[12]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-pytho
n

References

1. mailto:varo...@gmail.com
2. http://mx.linkedin.com/in/varomix
3. http://www.facebook.com/varomix
4. http://www.twitter.com/varomix
5. mailto:nuke-python-re...@thefoundry.co.uk
6. http://self.lv/
7. mailto:Nuke-python@support.thefoundry.co.uk
8. http://forums.thefoundry.co.uk/
9. http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
  10. mailto:Nuke-python@support.thefoundry.co.uk
  11. http://forums.thefoundry.co.uk/
  12. http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python


-- 
  Hugo Léveillé
  TD Compositing, Vision Globale
  hu...@fastmail.net

_______________________________________________
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