1
0
mirror of https://github.com/thp/pyotherside.git synced 2025-01-28 23:52:55 +08:00

103 Commits

Author SHA1 Message Date
Thomas Perl
443dce1e54 Android compatibility fix
There's no need to load libpython globally on Android.
2014-11-07 23:01:31 +01:00
Thomas Perl
21b416a01e Print unhandled errors to the console 2014-10-12 11:24:54 +02:00
Thomas Perl
78180ce840 Self-import pyotherside to prevent crashes
Otherwise pyotherside.QObject instances could not be used
if the same module didn't do a "import pyotherside".
2014-10-11 18:38:06 +02:00
Thomas Perl
65314f10a7 Free allocated resources 2014-10-10 13:53:47 +02:00
Thomas Perl
24cb511bc9 Avoid conversion of QObjectMethod objects 2014-10-10 13:14:09 +02:00
Thomas Perl
43f81e54e1 Implement proper Python wrapper objects 2014-10-10 13:05:45 +02:00
Thomas Perl
c24670ccd2 WIP QObject wrapper code 2014-10-09 11:30:18 +02:00
Thomas Perl
4ef3738805 Use PyObjectRef's automatic reference counting
Replace most Py_.*REF calls with PyObjectRef's automatic
memory management, with borrowed references.
2014-10-08 16:07:01 +02:00
Thomas Perl
5863efcfe9 Simplify API (remove callMethod again, merge into call)
callMethod(o, attr, ...) is just a special case of:
call(getattr(o, attr), ...)

Starting with import version 1.4, call() now accepts a
Python callable as alternative to the function name.
2014-10-08 15:13:54 +02:00
Thomas Perl
df059cf5fe Bump API version to 1.4, update documentation 2014-10-08 14:33:05 +02:00
Thomas Perl
bbe98ae3ec Fix deadlock issues and GIL state handling 2014-10-08 14:05:25 +02:00
Thomas Perl
76bd73c370 Assignment operator for PyObjectRef + test 2014-10-08 13:34:38 +02:00
Thomas Perl
cc7bc11595 Converter: Only use PyObjectRef, add tests
The converter shouldn't need to deal with PyObject * itself, but use
only PyObjectRef, which takes care of reference already.

Make the GIL state management easier to read.

Add a small test that shows how to pass Python objects to/from QML.
2014-10-08 12:51:37 +02:00
Dennis Tomas
806400caeb Consistent refcounting behaviour when converting object references. 2014-10-06 14:02:57 +02:00
Dennis Tomas
d5dc5060c1 Fixed reference leaks in callMethod_sync() and getattr(). 2014-10-01 13:11:07 +02:00
Dennis Tomas
4f5edd7247 Access attributes of Python objects. 2014-09-30 18:23:43 +02:00
Dennis Tomas
ff0d915cf2 Calling methods on Python objects. 2014-09-30 18:22:47 +02:00
Dennis Tomas
9ed645cb0d Removed QMutex in QPythonPriv. 2014-09-30 18:16:43 +02:00
Felix Krull
53a78e0097 Wrap generic PyObjects in an opaque value that can be passed to/from QML safely. 2014-08-16 23:36:14 +02:00
Felix Krull
e61c6fac79 Use PyGILState_{Ensure,Release} to play well with recursive GIL acquisitions. 2014-08-16 22:28:15 +02:00
Felix Krull
68c5c5b95e Use QMetaType::Type values instead of obsolete QVariant::Type. 2014-08-16 22:28:15 +02:00
Felix Krull
1404fc8b95 Fix some reference leaks. 2014-08-14 20:56:16 +02:00
Thomas Perl
481400b53d Convert Python set and iterable to JS Array 2014-06-10 18:06:22 +02:00
Thomas Perl
4548e7a2bd Windows: Fix builds on Windows, build docs. Fixes #10 2014-02-24 19:39:27 +01:00
Thomas Perl
d3c739ad7a Expose module version via Python module 2014-02-19 22:09:52 +01:00
Thomas Perl
87007e0b07 QRC code finally broke Python 2.x support, remove it
It was always scheduled to be removed once new features that use Python
3-only features are introduced (we could have written a separate
importer for Python 2, but it is explicitly a goal of the project).
2014-02-17 18:49:48 +01:00
Thomas Perl
5c8d9cfe57 QML API 1.3: Add support for qrc:/ import paths. Fixes #2 2014-02-16 22:25:38 +01:00
Thomas Perl
ea0bc3433c Access to the Qt Resource System from Python 2014-02-16 20:15:50 +01:00
Thomas Perl
e201eecfff Converter: Support for date, time and datetime. Fixes #12
Python datetime.date <-> Qt QDate <-> QML date
Python datetime.time <-> Qt QTime <-> QML time
Python datetime.datetime <-> Qt QDateTime <-> JS Date

Python C API docs for those data types:
http://docs.python.org/3/c-api/datetime.html

QML docs for those data types:
http://qt-project.org/doc/qt-5.1/qtqml/qtqml-cppintegration-data.html#qdatetime-to-javascript-date
http://qt-project.org/doc/qt-5.1/qtqml/qml-date.html
http://qt-project.org/doc/qt-5.1/qtqml/qml-time.html
2014-02-13 00:04:48 +01:00
Thomas Perl
4028d4f3b8 QML API 1.2: Handle JS exceptions in callbacks from Python
Also improve error message in pyotherside.send() callback handler
to include filename and line number.
2014-02-12 23:02:57 +01:00
Thomas Perl
270d67fe78 Fix building with GCC 4.6 on Ubuntu
const-ness fix for the call to PyImport_ImportModuleEx and
rename major/minor to avoid clashes on some systems due to
sysmacros.h #define'ing minor and major.
2014-02-09 15:25:41 +01:00
Thomas Perl
28d5e9289c QML API 1.2: Fix importModule() behavior. Fixes #3
This changes the behavior of an existing function, so we need to
bump the QML import version to still support code that depends on
the old (broken) behavior of the importModule() function.
2014-02-08 15:29:02 +01:00
Thomas Perl
be1edb6b5c New methods: pluginVersion() and pythonVersion() 2014-02-06 22:49:43 +01:00
Thomas Perl
2a79458c68 addImportPath: Strip leading "file://" (for use with Qt.resolvedUrl())
Also update examples to use the new feature.
2014-02-06 21:56:52 +01:00
Thomas Perl
c765bf3d03 Don't pass QJSValue by value between different threads
This also avoids having additional signals when the callback isn't
a callable by not creating a QJSValue referencing the callback.
2014-02-04 22:13:05 +01:00
Thomas Perl
a621f8c8ec Set object name on thread 2014-02-04 21:14:00 +01:00
Thomas Perl
9324ab3238 Happy New Year 2014-02-04 21:00:48 +01:00
Thomas Perl
6567f9e8b9 Error handling when using call() without a parameter list 2014-01-20 19:57:01 +01:00
Thomas Perl
2642910c08 Fix const-ness in global_libpython_loader 2014-01-20 19:29:19 +01:00
Thomas Perl
c659fa7722 Merge pull request #7 from thp/load-libpython-globally
Load libpython globally on Linux distributions
2014-01-20 10:20:58 -08:00
Thomas Perl
53273dad50 Check JS callback errors. Fixes #9
Thanks to Osmo Salomaa for the original report and test case.
2014-01-20 19:09:57 +01:00
Thomas Perl
c14a983713 Better error reporting (also print everything to the console) 2014-01-04 13:14:36 +01:00
Thomas Perl
ee11e74822 Cleanup error handling code, remove assertions 2014-01-04 12:35:18 +01:00
Thomas Perl
5289b79e7d Load libpython globally on Linux distributions 2013-11-02 14:33:56 +01:00
Thomas Perl
dc8cfb4f09 Image provider: Support returning encoded image data
This allows the additional use case of reading e.g. PNG tiles from a
database and passing them to Qt without decoding first (see issue #1).
2013-10-05 14:25:51 +02:00
Thomas Perl
211a04f7b3 Add support for Python-based image providers. Fixes #1 2013-10-05 14:05:18 +02:00
Thomas Perl
f1cbc8ca75 qpython_priv: Avoid crash when no QPython object was ever instanced
When importing "io.thp.pyotherside" in a QML file, but no Python {}
object is created during runtime, PyOtherSide would crash at exit.
2013-10-05 09:57:14 +02:00
Thomas Perl
8d09d7a6fb Documentation fix 2013-09-30 14:43:36 +02:00
Thomas Perl
defbab1467 Fix build, move worker code to qpython_worker 2013-08-08 18:06:19 +02:00
Thomas Perl
ad62b4dc2b Add API documentation using Doxygen 2013-08-08 17:55:38 +02:00