Thanks, I will keep those things in mind.
As the QUiLoader in PySide is somewhat buggy, especially with custom/promoted widgets, I would recommend using the QtBindingHelper.py from rosgui, or at least the loadUi function implemented therein.
Using the binding helper makes your software agnostic of the actual binding used, so you can easily switch between PySide and PyQt, which sometimes helps in finding bugs that are actually in PySide and not in your own code...
All you have to do is import QtBindingHelper before importing any Qt stuff:
from QtBindingHelper import loadUi
import QtCore
from QtGui import QWidget
It will try to use PyQt and fall back to PySide automatically if necessary.
But you can also force it to use only one of them by editing the binding list, or setting a property on the sys module before importing the binding helper:
import sys
setattr(sys, 'SELECT_QT_BINDING', 'pyside')
Cheers,
Dorian
On 11/03/2011 01:22 AM, William Woodall wrote:Ah, I don't know why I didn't think about something like QUiLoader... Man I feel silly, I guess I have been just using the script to generate the py files because that is how they do it in many of the tutorials.
I have worked with the cmake macros for generating headers from ui files in c++, but I guess I was expecting something similar for python. This makes way more sense.
Thanks,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
William Woodall
Graduate Software Engineering
Auburn University
w@auburn.edu
wjwwood@gmail.comwilliamjwoodall.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Wed, Nov 2, 2011 at 7:15 PM, Dirk Thomas <mail@dirk-thomas.net> wrote:
I am not sure why you would generate any code for UI files in Python.Have you found a good way to automatically generate py files from ui files using pyqt and/or pyside inside a ros build system?
It looks like ros_gui isn't currently, but I was wondering if you had any leads. I am working on a project that uses pyside and I wanted to generate them at build time rather than committing the
generated file.
In Python plugins you can just load the UI file at runtime (no need for any generated files)??
For C++ plugins you will include your UI files in the cmake files and the generated code will be included in the library.
Dirk
_______________________________________________
Ros-sig-gui mailing list
Ros-sig-gui@code.ros.org
https://code.ros.org/mailman/listinfo/ros-sig-gui
_______________________________________________ Ros-sig-gui mailing list Ros-sig-gui@code.ros.org https://code.ros.org/mailman/listinfo/ros-sig-gui
-- Dipl.-Inform. Dorian Scholz E-Mail:scholz(at)sim.tu-darmstadt.de Simulation, Systems Optimization Phone: +49 (0) 6151 16-4811 and Robotics Group Fax: +49 (0) 6151 16-6648 Technische Universität Darmstadt http://www.sim.tu-darmstadt.de Hochschulstr. 10 D-64289 Darmstadt, Germany
_______________________________________________
Ros-sig-gui mailing list
Ros-sig-gui@code.ros.org
https://code.ros.org/mailman/listinfo/ros-sig-gui