[PyQt] Type information for signals

2012-04-24 Thread Andrew Suffield
I'd rather like to be able to write code like this:

for name in dir(obj):
  a = getattr(obj, name)
  if isinstance(a, QtCore.pyqtSignal):
setattr(self, name, a)

Unfortunately, signals of objects are of class pyqtBoundSignal and I
can't find a class object to pass to isinstance - does it exist?

For similar purposes of metaclass hackery, it would be useful to get
the string form out of a signal object so that I can call functions
like QObject.connectNotify and QObject.receivers
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


[PyQt] Python Dict and QAbstractItemModel

2012-04-24 Thread Kermit
hi all,

i've a lot of difficulty for browser a standard python dictionnary withing
a TreeListView, with QAbstracItemModel as model
dictionnary isn't indexable, not trivial to find parent, etc...


someone have try it or have an simple implementation example ?

Thx for your help


Kermit
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] QTreeView DragDropMode (Copy vs. Move)

2012-04-24 Thread hosscomp
No problem, Bart. Thanks for replying. I think I am on the right track (a
right track) now.  There seems to be many different ways to do what I am
trying to accomplish, but I haven't gotten the hang of quickly figuring out
the documentation and I am running out of time on this project. I think it
would have been quicker for me to do in HTML5, but we are stuck with IE7 on
these restricted machines. The one last thing I would like to do is have
this method remove the source row: 
-
   def dropMimeData(self, mimedata, action, row, column, parentIndex):
   if action == Qt.IgnoreAction:
   return True

   dragNode = mimedata.instance()
   print(mimedata : , dir(mimedata)) span
style='font-size:10.0pt;font-family:Courier New'
   print(type = , mimedata.MIME_TYPE)
   parentNode = self.nodeFromIndex(parentIndex)

   # make a copy of the node being moved
   newNode = deepcopy(dragNode)
   newNode.setParent(parentNode)
   self.insertRow(len(parentNode)-1, parentIndex)
   self.emit(SIGNAL(dataChanged(QModelIndex,QModelIndex)),
parentIndex, parentIndex) 
   if (mimedata.hasFormat('compass/x-ets-qt4-instance')):
   self.removeRow(row, parentIndex)

   return True
---
The arguments(row, parentindex) here are obviously wrong, so I probably need
to override the drag event and change it to a move or something like that.



--
View this message in context: 
http://python.6.n6.nabble.com/QTreeView-DragDropMode-tp4680293p4914167.html
Sent from the PyQt mailing list archive at Nabble.com.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] Cannot 'configure' PyQt4.9 before build on Linuxmint

2012-04-24 Thread Brian Kelley
I got hit by this as well.  Apparently having the correct sip in your path
may not be enough.  I have attached a script that properly builds sip+qt
assuming you have downloaded the current tarballs.  It also has the
command that fails (SLED10-64/Ubuntu10-64) so Phil can take a look at it.

Essentially:

I had to specifically tell PyQt's configure where the sip include file
(include/sip.h) was.

 sip -V
4.13.2
 which sip
.../sip-4.13.2/bin/sip

 python configure.py \
  -q .../Trolltech/Qt-4.8.0/bin/qmake \
   -e .../sip-4.13.2/include \
   -v .../sip-4.13.2/share/sip


Note that -e and -v are the same flags as how you configured sip which
is how I figured this out in the first place (purely by serendipity, I
copied the wrong configure flags in a shell by accident)

I kind of think this might be a bug in the PyQt configure, but then I know
all about configuration hell so I have some sympathy ( I had to patch Qt
4.8 to properly build WebKit on SLED10-64 as well ).  I don't have
sympathy for the amount of time it took me to figure this out though, so
hopefully this will help future coders. :)

Brian



On 4/19/12 2:09 PM, murison muri...@alpheratz.net wrote:

I, too, am stopped cold by this very same problem. Sip 4.13.2, Python
2.7.3,
Qt 4.8.1, PyQt 4.9.1 on Ubuntu 11.10.

--
View this message in context:
http://python.6.n6.nabble.com/Cannot-configure-PyQt4-9-before-build-on-Lin
uxmint-tp2309321p4899103.html
Sent from the PyQt mailing list archive at Nabble.com.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt



buildpyqt.sh
Description: buildpyqt.sh
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] QPyNullVariant and bool()

2012-04-24 Thread Deniz Turgut
Would it be logical to add a __nonzero__ method to QPyNullVariant
which always returns False?

I was going through a code of mine which broke with a new version of
PyQt. I realized that it was because there is no __nonzero__ method in
QPyNullVariant so bool(QPyNullVariant) is always True.

Right now, if you use QVariant api 2, you can't check nicely (without
typechecking) whether you get a nonzero value or Null/Falsy value.

--
Deniz
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] QTreeView DragDropMode (Copy vs. Move)

2012-04-24 Thread Bart Kroon
When time is short I would say, add a method to the source model that you can 
call from the target model that removes the received items. That would make it 
work at least. It might even be the best way to do such a thing, but I'm not 
sure.

It seems you handle the dragged in mimedata as the object coming from the 
source model. That doesn't seem right to me, you should serialise the 
information in the source models mimeData() method. This can be done in any 
way you like, so you could include sufficient information to describe the 
original node and remove it from the source model.

-- Bart
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt