Patch taken from the upstream repository https://github.com/frescobaldi/python-poppler-qt5/issues/43 From 92e5962ec3751ab051d0b655fd61afc7a1cf709e Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Thu, 4 Mar 2021 17:02:51 +0100 Subject: [PATCH] map type QVector< QPair > for FormFieldChoice::choicesWithExportValues() (#45) --- types.sip | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/types.sip b/types.sip index 239b8c9..81cb283 100644 --- a/types.sip +++ b/types.sip @@ -331,5 +331,98 @@ template }; +/** + * Convert QVector< QPair > + * from and to a Python list of a 2-item tuple + */ + +template +%MappedType QVector< QPair > +{ +%TypeHeaderCode +#include +#include +%End + +%ConvertFromTypeCode + // Create the list. + PyObject *l; + + if ((l = PyList_New(sipCpp->size())) == NULL) + return NULL; + + // Set the list elements. + for (int i = 0; i < sipCpp->size(); ++i) + { + QPair* p = new QPair(sipCpp->at(i)); + PyObject *ptuple = PyTuple_New(2); + PyObject *pfirst; + PyObject *psecond; + + TYPE *sfirst = new TYPE(p->first); + if ((pfirst = sipConvertFromType(sfirst, sipType_TYPE, sipTransferObj)) == NULL) + { + Py_DECREF(l); + Py_DECREF(ptuple); + return NULL; + } + PyTuple_SET_ITEM(ptuple, 0, pfirst); + + TYPE *ssecond = new TYPE(p->second); + if ((psecond = sipConvertFromType(ssecond, sipType_TYPE, sipTransferObj)) == NULL) + { + Py_DECREF(l); + Py_DECREF(ptuple); + Py_DECREF(pfirst); + return NULL; + } + PyTuple_SET_ITEM(ptuple, 1, psecond); + + PyList_SET_ITEM(l, i, ptuple); + } + + return l; +%End + +%ConvertToTypeCode + const sipTypeDef* qpair_type = sipFindType("QPair"); + + // Check the type if that is all that is required. + if (sipIsErr == NULL) + { + if (!PySequence_Check(sipPy)) + return 0; + + for (int i = 0; i < PySequence_Size(sipPy); ++i) + if (!sipCanConvertToType(PySequence_ITEM(sipPy, i), qpair_type, SIP_NOT_NONE)) + return 0; + + return 1; + } + + + QVector< QPair > *qv = new QVector< QPair >; + + for (int i = 0; i < PySequence_Size(sipPy); ++i) + { + int state; + QPair * p = reinterpret_cast< QPair * >(sipConvertToType(PySequence_ITEM(sipPy, i), qpair_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); + + if (*sipIsErr) + { + sipReleaseType(p, qpair_type, state); + delete qv; + return 0; + } + qv->append(*p); + sipReleaseType(p, qpair_type, state); + } + + *sipCppPtr = qv; + return sipGetState(sipTransferObj); +%End + +}; + /* kate: indent-width 4; space-indent on; hl c++; indent-mode cstyle; */ >etc: completion: Filter gratuitous spaces from available packages.Liliana Marie Prikler Tested with: guix environment --{ad-hoc,pure} zsh guix bash-completion coreutils -- zsh % fpath=(~/guix/etc/completion/zsh $fpath) % autoload -U compinit; compinit * etc/completion/zsh/_guix (_guix_list_available_packages): Remove spaces. Co-authored-by: Tobias Geerinckx-Rice <me@tobias.gr> 2021-08-28zsh completion: Add missing commands and arguments.Noah Evans * etc/completion/zsh/_guix (_guix_install, _guix_remove, _guix_upgrade): New functions. (_guix_build, _guix_challenge, _guix_download, _guix_environment, _guix_packages, _guix_gc, _guix_hash, _guix_lint, _guix_package, _guix_publish, _guix_pull, _guix_refresh, _guix_size, _guix_system): Add some of the missing arguments. (_guix_cmds): Add missing commands. Co-authored-by: Brice Waegeneire <brice@waegenei.re> 2021-02-17scripts: system: Remove 'vm-image' command.Mathieu Othacehe Remove the 'vm-image' command that has been superseded by the 'image' command. * gnu/system/vm.scm (system-qemu-image): Remove it. * guix/scripts/system.scm (system-derivation-for-action): Mark 'vm-image' command as deprecated and use the image API to produce the VM image. (perform-action, show-help): Adapt accordingly. * tests/guix-system.sh: Ditto. * doc/guix.texi (Invoking guix system, Running Guix in a VM): Ditto. * etc/completion/fish/guix.fish: Ditto. * etc/completion/zsh/_guix: Ditto.