thp / pyotherside

Python Bindings for Qt 5 and Qt 6. Allows you to access a CPython 3 interpreter directly from your Qt QML user interface code.
https://thp.io/2011/pyotherside/
Other
364 stars 49 forks source link

Importing specific functions/objects from a module #53

Closed xealits closed 8 years ago

xealits commented 8 years ago

The goal is to add possibility to do importNames('module', ['foo', 'bar']); in QML, which corresponds to Python's from module import foo, bar. After the call is successful one should be able to call foo, bar directly in the call: call('foo', [], callBack);.

The feature corresponds to the pattern of having a "main" module of the application, which the GUI connects to and exposes as an interface to a user. Without the feature the calls to Python -- call( 'main.foo', [], callBack ); -- have unnecessary 'main...' repeated everywhere.

The idea comes from discussion of issue 15.

xealits commented 8 years ago

I made a test version, but I cannot compile the plugin with qmake:

$ make
cd src/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /home/alex/Documents/projects/programs/pyotherside/src/src.pro -o Makefile ) && make -f Makefile 
Project MESSAGE: PYTHON_CONFIG = python3-config
Project ERROR: Unknown module(s) in QT: svg
make: *** [sub-src-make_first] Error 3

-- though I have libqt5svg5 installed (on ubuntu 14.04).

If someone could suggest something about the compilation it would be great. Sadly, I don't have any experience with Qt.

Ok, it is solved. I had to have libqt5svg5-dev in addition to libqt5svg5.