Page 8 of 13

Re: PySide migration

Posted: Sat Jan 11, 2014 10:23 pm
by wmayer
Is the compiling something new to pyside or was this also done behind the scenes with pyqt4?
No, PyQt4 did this already. And when looking at the source code you'll be surprised how similar it is.
I wondering if I should add pyside-tools as an apt-recommends dependency for the wheezy package that I upload.
Makes probably sense to add it.

Re: PySide migration

Posted: Sun Jan 12, 2014 2:12 pm
by Sanguinario_Joe
I already fixed the plot module (including the matplotlib backend and the pyside pitfalls):

viewtopic.php?f=17&t=5358

See you!

Re: PySide migration

Posted: Mon Jan 13, 2014 11:19 am
by jreinhardt
I tried to find the reason for the problems I have with BOLTS (see here).

I found this bug report here: https://bugreports.qt-project.org/browse/PYSIDE-31

It seems that shiboken fails to guess the best type for an instance, which later leads to problems. I also discovered this python workaround:

http://nathanhorne.com/?p=485

However, I am not sure if I can work around this problem in python. I don't think I have access to a pointer to the instance, so I can not apply the python workaround.

Re: PySide migration

Posted: Mon Jan 13, 2014 2:16 pm
by wmayer
Does this work?

Code: Select all

from PySide import QtCore
from PySide.QtGui import QDockWidget as QBoltsWidget


class BoltsWidget(QBoltsWidget):
	pass

def addWidget(widget):
	mw = Gui.getMainWindow()
	mw.addDockWidget(QtCore.Qt.RightDockWidgetArea, widget)


widget = BoltsWidget()
addWidget(widget)

Re: PySide migration

Posted: Mon Jan 13, 2014 4:30 pm
by jreinhardt
Thanks that helped.

I am not sure if I was sloppy with my debugging attempts or something changed in the daily builds, but it turns out, that both wmayers testcase and my original code work now.

OS: Ubuntu 13.04
Platform: 64-bit
Version: 0.14.3012 (Git)
Branch: master
Hash: ca3b87a719825ad4065b47ade7b472e1f67dd134
Python version: 2.7.4
Qt version: 4.8.4
Coin version: 3.1.3
SoQt version: 1.5.0

I had to also handle some other things, like QVariants and automatically connected slots, but I think I got it running now for both older and newer versions. I could only test on Linux though. So if you have a Windows system, with any version of FreeCAD, it would be coold if you could test whether the most current development snapshot works for you:

http://jreinhardt.github.io/BOLTS/downloads.html

Re: PySide migration

Posted: Wed Jan 15, 2014 10:21 am
by arcol
Out of curiosity, why PyQt->PySide switch was needed?

Re: PySide migration

Posted: Wed Jan 15, 2014 10:34 am
by wmayer
arcol wrote:Out of curiosity, why PyQt->PySide switch was needed?
Because PyQt is under GPL and PySide under LGPL. Since FreeCAD is also aimed to be used by companies that want to link FreeCAD with proprietary code it must be 100% GPL free.

People who e.g. write Python scripts that only shows some dialogs or the like can still use PyQt if they prefer. However, a change to PySide is a must if they want to integrate their widgets in FreeCAD's task panel.

Re: PySide migration

Posted: Fri Jan 17, 2014 11:13 am
by ulrich1a
I am having problems with an actual build of FreeCAD on Windows 7 32 bit.
Have a look here: viewtopic.php?f=3&t=5384&start=10#p43371
For me it looks like the Pivy delivered with the FreeCAD source has references towards sip, which is used for PyQt4. Similar error messages on Linux went away after a new build from scratch.
So is there Pivy on Linux automagically build against PySide?
If it is so, how can Pivy in the Libpack be upgraded to a new build?
Pivy is made with Swig. Unfortunately I have no knowledge how to make a new build of Pivy.

Ulrich

Re: PySide migration

Posted: Fri Jan 17, 2014 11:30 am
by wmayer
I think the latest pivy version still has a reference to sip/PyQt but this is a very loose dependency. And if you look at the python-pivy package you'll see that it depends on python-qt4. Which version of the Windows LibPack 32-bit do you have?

Re: PySide migration

Posted: Fri Jan 17, 2014 11:43 am
by wmayer
Look here: https://bitbucket.org/Coin3D/pivy/src/8 ... at=default and search sip.
Maybe you should try:

Code: Select all

import sip
print sip.__file__
dir(sip)
What does this give?