Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Commit

Permalink
Drop the PyOtherSide call_sync work-around
Browse files Browse the repository at this point in the history
  • Loading branch information
otsaloma committed Mar 17, 2018
1 parent 7108caa commit 8f87c96
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 32 deletions.
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ WhoGo Maps 0.1
* [x] Show time, not distance remaining to destination in the top right
corner of the navigation maneuver block (#6)
* [x] Fix broken share position by SMS button
* [x] Bump PyOtherSide dependency to 1.5.1
31 changes: 0 additions & 31 deletions qml/Python.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,35 +35,4 @@ Python {

onError: console.log("Error: %1".arg(traceback));

function call_sync(func, args) {
// XXX: Work around a call_sync bug by using evaluate.
// https://github.com/thp/pyotherside/issues/49
// https://together.jolla.com/question/156736
args = args.map(py.stringify).join(", ");
return py.evaluate("%1(%2)".arg(func).arg(args));
}

function stringify(obj) {
// Return Python string representation of obj.
if (Array.isArray(obj)) {
return "[%1]".arg(obj.map(py.stringify).join(", "));
} else if (obj === null || obj === undefined) {
return "None";
} else if (typeof obj === "string") {
return "'%1'".arg(obj.replace(/'/g, "\\'"));
} else if (typeof obj === "number") {
return obj.toString();
} else if (typeof obj === "boolean") {
return obj ? "True" : "False";
} else if (typeof obj === "object") {
// Assume all remaining objects are dictionaries.
return "{%1}".arg(Object.keys(obj).map(function(x) {
return [py.stringify(x), py.stringify(obj[x])].join(": ");
}).join(", "));
} else {
throw "Unrecognized argument type: %1: %2"
.arg(obj).arg(typeof obj);
}
}

}
2 changes: 1 addition & 1 deletion rpm/harbour-whogo-maps.spec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ BuildRequires: qt5-qttools-linguist
Requires: libkeepalive
Requires: libsailfishapp-launcher
Requires: mapboxgl-qml >= 1.2.0
Requires: pyotherside-qml-plugin-python3-qt5 >= 1.2
Requires: pyotherside-qml-plugin-python3-qt5 >= 1.5.1
Requires: qt5-qtdeclarative-import-multimedia >= 5.2
Requires: qt5-qtdeclarative-import-positioning >= 5.2
Requires: sailfishsilica-qt5
Expand Down

0 comments on commit 8f87c96

Please sign in to comment.