PySide migration

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
wmayer
Site Admin
Posts: 8830
Joined: Thu Feb 19, 2009 10:32 am

Re: PySide migration

Postby wmayer » Sat Jan 11, 2014 10:23 pm

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.

Sanguinario_Joe
Posts: 44
Joined: Wed Jan 01, 2014 1:17 pm

Re: PySide migration

Postby Sanguinario_Joe » Sun Jan 12, 2014 2:12 pm

I already fixed the plot module (including the matplotlib backend and the pyside pitfalls):

viewtopic.php?f=17&t=5358

See you!

jreinhardt
Posts: 329
Joined: Mon Sep 09, 2013 6:08 pm

Re: PySide migration

Postby jreinhardt » Mon Jan 13, 2014 11:19 am

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.
BOLTS, standard parts library for FreeCAD Thread, Help with Translation

wmayer
Site Admin
Posts: 8830
Joined: Thu Feb 19, 2009 10:32 am

Re: PySide migration

Postby wmayer » Mon Jan 13, 2014 2:16 pm

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)

jreinhardt
Posts: 329
Joined: Mon Sep 09, 2013 6:08 pm

Re: PySide migration

Postby jreinhardt » Mon Jan 13, 2014 4:30 pm

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
BOLTS, standard parts library for FreeCAD Thread, Help with Translation

arcol
Posts: 195
Joined: Sun Nov 10, 2013 9:02 am

Re: PySide migration

Postby arcol » Wed Jan 15, 2014 10:21 am

Out of curiosity, why PyQt->PySide switch was needed?
OS: Ubuntu 14.10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5086 (Git)
Branch: master
Hash: 4f5534a87a7e2d224022ff98729a341bf57e7f9e
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

wmayer
Site Admin
Posts: 8830
Joined: Thu Feb 19, 2009 10:32 am

Re: PySide migration

Postby wmayer » Wed Jan 15, 2014 10:34 am

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.

ulrich1a
Posts: 858
Joined: Sun Jul 07, 2013 12:08 pm

Re: PySide migration

Postby ulrich1a » Fri Jan 17, 2014 11:13 am

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

wmayer
Site Admin
Posts: 8830
Joined: Thu Feb 19, 2009 10:32 am

Re: PySide migration

Postby wmayer » Fri Jan 17, 2014 11:30 am

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?

wmayer
Site Admin
Posts: 8830
Joined: Thu Feb 19, 2009 10:32 am

Re: PySide migration

Postby wmayer » Fri Jan 17, 2014 11:43 am

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?


Return to “Developers corner”

Who is online

Users browsing this forum: drei and 3 guests