PySide migration

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.

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.
wmayer
Site Admin
 
Posts: 7499
Joined: Thu Feb 19, 2009 10:32 am

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!
Sanguinario_Joe
 
Posts: 38
Joined: Wed Jan 01, 2014 1:17 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
jreinhardt
 
Posts: 306
Joined: Mon Sep 09, 2013 6:08 pm

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)
wmayer
Site Admin
 
Posts: 7499
Joined: Thu Feb 19, 2009 10:32 am

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
jreinhardt
 
Posts: 306
Joined: Mon Sep 09, 2013 6:08 pm

Re: PySide migration

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

Out of curiosity, why PyQt->PySide switch was needed?
Posts between:
2014.10.27: 0.15.4139, ubuntu 14.10
2014.10.09-2014.10.26: 0.15.4102, ubuntu 14.10-dev
2014.07.19-2014.10.08: 0.14.3702, ubu14.04

I track all (older) Freecad->about infos here:
http://wiki.arcol.hu/sketch:freecad
arcol
 
Posts: 112
Joined: Sun Nov 10, 2013 9:02 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.
wmayer
Site Admin
 
Posts: 7499
Joined: Thu Feb 19, 2009 10:32 am

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
ulrich1a
 
Posts: 560
Joined: Sun Jul 07, 2013 12:08 pm

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: 7499
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?
wmayer
Site Admin
 
Posts: 7499
Joined: Thu Feb 19, 2009 10:32 am

PreviousNext

Return to Developers corner

Who is online

Users browsing this forum: No registered users and 2 guests