PySide migration
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 329
- Joined: Mon Sep 09, 2013 6:08 pm
Re: PySide migration
Cool, that is exactly what I need!
Is that available already in 0.13, or do I have to implement that conditionally?
Shall I update the wiki?
Is that available already in 0.13, or do I have to implement that conditionally?
Shall I update the wiki?
-
- Posts: 329
- Joined: Mon Sep 09, 2013 6:08 pm
Re: PySide migration
Now I run in a similar problem, BoltsWidget is a subclass of PySide.QtGui.QDockWidget, but addDockWidget chokes on it:
Code: Select all
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "./BOLTS/__init__.py", line 42, in <module>
mw.addDockWidget(QtCore.Qt.RightDockWidgetArea, widget)
TypeError: 'PySide.QtGui.QMainWindow.addDockWidget' called with wrong argument types:
PySide.QtGui.QMainWindow.addDockWidget(PySide.QtCore.Qt.DockWidgetArea, BoltsWidget)
Supported signatures:
PySide.QtGui.QMainWindow.addDockWidget(PySide.QtCore.Qt.DockWidgetArea, PySide.QtGui.QDockWidget)
PySide.QtGui.QMainWindow.addDockWidget(PySide.QtCore.Qt.DockWidgetArea, PySide.QtGui.QDockWidget, PySide.QtCore.Qt.Orientation)
Re: PySide migration
You need to specify which dock area I think, for ex. QtCore.Qt.TopDockWidgetArea. You can chose between:
Qt.LeftDockWidgetArea
Qt.RightDockWidgetArea
Qt.TopDockWidgetArea
Qt.BottomDockWidgetArea
Qt.AllDockWidgetAreas
Qt.NoDockWidgetArea
http://srinikom.github.io/pyside-docs/P ... re/Qt.html
*EDIT* OOps sorry, I didn't read correctly... Stange, I did the same in DraftGui and it works...
Qt.LeftDockWidgetArea
Qt.RightDockWidgetArea
Qt.TopDockWidgetArea
Qt.BottomDockWidgetArea
Qt.AllDockWidgetAreas
Qt.NoDockWidgetArea
http://srinikom.github.io/pyside-docs/P ... re/Qt.html
*EDIT* OOps sorry, I didn't read correctly... Stange, I did the same in DraftGui and it works...
-
- Posts: 329
- Joined: Mon Sep 09, 2013 6:08 pm
Re: PySide migration
By the way, there is a reference to Qt4 left in the error message:
https://github.com/FreeCAD/FreeCAD_sf_m ... Gui.py#L38
https://github.com/FreeCAD/FreeCAD_sf_m ... Gui.py#L38
Re: PySide migration
Fixed! Thanks for notifying!
Re: PySide migration
When I run the above code with my Ui file I get:wmayer wrote:FYI, I have added a convenience module to FreeCAD which implements missing stuff from PyQt. There you could use the method 'loadUiType' which returned a tuple of a form class and the widget class of the ui file:
Code: Select all
from PySide import QtCore, QtGui from FreeCADGui import PySideUic as uic form_class, base_class = uic.loadUiType("myUiFile.ui") formUi = form_class() widget = base_class() formUi.setupUi(widget) widget.show()
Code: Select all
<type 'exceptions.ImportError'>: No module named pysideuic
Code: Select all
str << "import pysideuic\n"
Re: PySide migration
No, it's not. What is your OS?Is this a typo?
Re: PySide migration
Debian Wheezy. Freecad revision 3013wmayer wrote:No, it's not. What is your OS?Is this a typo?
If I run it line by line from the python terminal:
Code: Select all
>>> from PySide import QtCore, QtGui
>>> from FreeCADGui import PySideUic as uic
>>> form_class, base_class = uic.loadUiType(FreeCAD.getHomePath() + "Mod/Fem/MechanicalAnalysis.ui")
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "<string>", line 1, in <module>
ImportError: No module named pysideuic
Re: PySide migration
Install the package pyside-tools which contains the ui compiler for Python code
http://packages.debian.org/wheezy/amd64 ... s/filelist
http://packages.debian.org/wheezy/amd64 ... s/filelist
Re: PySide migration
Ahhh ok. Is the compiling something new to pyside or was this also done behind the scenes with pyqt4? I wondering if I should add pyside-tools as an apt-recommends dependency for the wheezy package that I upload.