View Single Post
Old 03-24-2022, 04:16 PM   #76
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,884
Karma: 6120478
Join Date: Nov 2009
Device: many
We pass a single QStringList that effectively contains the values of match.group(0), match.group(1), ... created from our C++ match info object through the embedded python bridge code , to the replace function in mymod.py, and its returns a single string replacement value back via the bridge code.

We could pass along a counter, or an structure (tuple - think a list of QVariants) for memory storage as well.

It should work. Just one more embedded python routine.

It will be be a bit quick and dirty, and more limited in scope, but we have plugins to handle the fancy stuff.

Or we take advantage of the embedded python routines to return a Replacer object and invoke its routines so that object can have cross call storage until the we delete it. We used that approach for the pre Sigil 1.9 Opf parsing routine before it was rewritten in C++.

Or even just pass in a an QString that could hold serialized json for whatever storage they needed. And return a QString pair (replacement value and storage).

Last edited by KevinH; 03-24-2022 at 05:10 PM.
KevinH is offline   Reply With Quote