View Single Post
Posts: 1,548 | Thanked: 7,510 times | Joined on Apr 2010 @ Czech Republic
#1802
Originally Posted by taixzo View Post
...Does modrana have a Python library that I could just import?
I'm afraid there is currently nothing like a library or an externally usable module at the moment. The closest thing would be just ripping out some of the code talking to the various online services from the onlineService modRana module and incorporate it to Saera.

Originally Posted by taixzo View Post
In that case I could bypass going through the process of launching modrana, at least for search.
This got me thinking and I've realized that there is actually nothing preventing you from calling the main modRana executable directly, totally bypassing QML for non-GUI queries. The modRana executable already implements short circuits that only initialize what is needed to respond to the query. As a result the full modRana startup is skipped and the query is answered very quickly - it was implemented back then like this for processing queries from the original Saera.

To try it out, you will need to clone modRana from git, as the latest release available from OpenRepos has a bug that prevents the command line interface from working:

Code:
git clone https://github.com/M4rtinK/modrana
cd modrana
python3 modrana.py --address-search "London" --return-static-map-url
This should result return this static map URL for the result:
Code:
http://staticmap.openstreetmap.de/staticmap.php?center=51.507322,-0.127647&zoom=15&size=350x350&markers=51.507322,-0.127647,ol-marker
It also currently returns some log messages, but I'll that's a bug I'll have to fix, so that only the static map URL is returned.

You can also make it return the list of available CLI options:

Code:
python3 modrana.py --help
Only the non-GUI ones will probably work at the moment though, but I should be able to make also the GUI using ones work with the Qt 5 GUI eventually.
__________________
modRana: a flexible GPS navigation system
Mieru: a flexible manga and comic book reader
Universal Components - a solution for native looking yet component set independent QML appliactions (QtQuick Controls 2 & Silica supported as backends)
 

The Following 3 Users Say Thank You to MartinK For This Useful Post: