PySide migration

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

PySide migration

Post by yorik »

The PySide migration has begun!

DONE:

- Arch, Draft & Start modules are switched, so far all seems to work well.

TO DO:

- Material module's MaterialEditor needs the uic module which was in PyQt4 and not in PySide. Must find the equivalent...
- Plot and Ship must be switched (see with sanguinario joe)
- OpenSCAD module must be switched (see with shoogen)
- 3rdParty/Pivy-0.5 relies on PyQt4
- 3rdParty/Pivy relies on PyQt4
- src/WindowsInstaller/LibPack.wxs contains references to PyQt4, don't know what to do there
- TemplatePyMod must be switched (I'll do it)
- PartDesign scrips and PartDesign WizardShaft must be switched (seems simple enough)
- Spreadsheet module must be switched, but this might be a good opportunity to merge the C++ one...
- README files still contain references to PyQt4 (I'll do it)
- Update the wiki (do that with care)

2 things to do basically when switching:
- change "from PyQt4 import...." to "from PySide import..."
- remove all .toUtf8() methods
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: PySide migration

Post by wmayer »

- 3rdParty/Pivy-0.5 relies on PyQt4
- 3rdParty/Pivy relies on PyQt4
On PyQt? How this?
jrheinlaender
Posts: 554
Joined: Sat Apr 07, 2012 2:42 am

Re: PySide migration

Post by jrheinlaender »

For PartDesign WizardShaft, see here:

https://github.com/jrheinlaender/FreeCA ... izardShaft
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: PySide migration

Post by yorik »

wmayer wrote:On PyQt? How this?
I just did:

Code: Select all

grep -r "PyQt4" *
And it gave this:

Code: Select all

src/3rdParty/Pivy-0.5/sogui.py:        __import__('PyQt4')
src/3rdParty/Pivy-0.5/sogui.py:        import PyQt4
src/3rdParty/Pivy-0.5/sogui.py:                SoGui_Quarter_Wrapper.qApp = PyQt4.QtGui.QApplication(sys.argv)
src/3rdParty/Pivy-0.5/soqt_wrap.cpp:      PYQT_MODULE_IMPORT_NAME = "PyQt4.Qt";
src/3rdParty/Pivy/soqt_wrap.cpp:      PYQT_MODULE_IMPORT_NAME = "PyQt4.Qt";
But I'm not sure how far this is a problem, since after all, nothing impeachs a module to still use PyQt, as long as it doesn't use any of the FreeCAD python functions...
jrheinlaender wrote:For PartDesign WizardShaft, see here:
@jrheinlaender thansk! Just added your last commit.

Off-topic: I like much how my Git tree lokks like, these days... A FreeCAD decentralized task-force!
yorik@bilbo:~/Sources/FreeCAD$ git remote update

Code: Select all

Fetching origin
Fetching github
Fetching shoogen
Fetching wandererfan
Fetching crashfridh
Fetching peterl94
Fetching jmaustpc
Fetching helo9
Fetching jrheinlaender
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: PySide migration

Post by yorik »

Material module is done too.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: PySide migration

Post by NormandC »

yorik wrote:- 3rdParty/Pivy-0.5 relies on PyQt4
- 3rdParty/Pivy relies on PyQt4
How will that impact compiling on Debian/Ubuntu-based distros? The python-pivy package from the distro repo is used by the PPA packages as well as when you compile FreeCAD. python-pivy has a dependency to python-qt4-gl which itself depends on python-qt4.

http://packages.debian.org/wheezy/python-pivy
http://packages.ubuntu.com/trusty/python-pivy

From what I can understand, on Ubuntu and Debian, PySide is packaged as libpyside1.x.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: PySide migration

Post by jmaustpc »

Will these changes stop this compile error that I always get?


[ 1%] Building CXX object src/3rdParty/Pivy-0.5/CMakeFiles/coin.dir/coin_wrap.cpp.o
/home/user/Downloads/cad/freecad/src/3rdParty/Pivy-0.5/soqt_wrap.cpp: In function ‘PyObject* _wrap_delete_QWidget(PyObject*, PyObject*)’:
/home/user/Downloads/cad/freecad/src/3rdParty/Pivy-0.5/soqt_wrap.cpp:17377:10: warning: possible problem detected in invocation of delete operator: [enabled by default]
/home/user/Downloads/cad/freecad/src/3rdParty/Pivy-0.5/soqt_wrap.cpp:17336:12: warning: ‘arg1’ has incomplete type [enabled by default]
/usr/include/qt4/QtGui/qwindowdefs.h:56:7: warning: forward declaration of ‘struct QWidget’ [enabled by default]
/home/user/Downloads/cad/freecad/src/3rdParty/Pivy-0.5/soqt_wrap.cpp:17377:10: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined


Jim
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: PySide migration

Post by yorik »

I think the pivy version bundled with freecad is broken for other reasons than pyqt... This shouldn't change anything I'm afraid. As for the debian/ubuntu package, I use that package now, and everything is still working fine with pyside.

Normally those 2 packages are not related in any way, that's why Werner found it strange...
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: PySide migration

Post by jmaustpc »

Yorik I posted some messages about this problem here viewtopic.php?f=4&t=5302 which I now think was the wrong place.

I am still getting it with a clean build this morning So I thought I would post here as it is probably a more logical place to do so.

On starting Draft I get the following error message

local variable 'translate' referenced before assignment


and on starting Arch I get

arguments did not match any overloaded call:
QMainWindow.addDockWidget(Qt.DockWidgetArea, QDockWidget): argument 1 has unexpected type 'PySide.QtCore.Qt.DockWidgetArea'
QMainWindow.addDockWidget(Qt.DockWidgetArea, QDockWidget, Qt.Orientation): argument 1 has unexpected type 'PySide.QtCore.Qt.DockWidgetArea'



and no Draft or Arch work benches

The first time I noticed this problem was Version: 0.14.2961 (Git) 0.14.2959 I am pretty sure was my last build without this problem.

The problem is still there in a complete build in a new directory

OS: Ubuntu 12.04.3 LTS
Platform: 64-bit
Version: 0.14.2964 (Git)
Branch: master
Hash: 0f2c93a25e51bbd41656982ad061307f2c33b32a
Python version: 2.7.3
Qt version: 4.8.2
Coin version: 3.1.3
SoQt version: 1.5.0
OCC version: 6.5.0



Jim
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: PySide migration

Post by jmaustpc »

I have Python 2.7 and all the pyside packages I can find in my package manager. There don't seem to be any DEV packages. The only Pyside packages I have not installed are the ones that say they are for Python3.

python-pyside meta package says pyside is version 1.1.0-1

is there anything I should have installed?

Jim
Post Reply