master
Kuba Orlik 4 years ago
parent c1c3c5456f
commit ae21c0fc0f

@ -20,4 +20,5 @@ Run it:
```sh
./dist/qt-map-py/qt-map-py # start centered in Poznań
./dist/qt-map-py/qt-map-py 33.66195 -95.55362 # start centered at given lat / lon
./dist/qt-map-py/qt-map-py 33.66195 -95.55362 --die # start centered at given lat / lon and close the window once the location is selected (otherwise each location is printed in a new line to stdout)
```

@ -8,6 +8,18 @@ from PySide2.QtGui import QGuiApplication
from PySide2.QtQml import QQmlApplicationEngine
from PySide2.QtCore import SIGNAL, QObject, Slot
import argparse
parser = argparse.ArgumentParser(
description="Display a map widget and make it print the selected location"
)
parser.add_argument("lat", help="latitude, as float")
parser.add_argument("lon", help="longitude, as float")
parser.add_argument(
"--die", help="Close the app once location is selected", action="store_true"
)
args = parser.parse_args()
dirname = os.path.dirname(PyQt5.__file__)
plugin_path = os.path.join(dirname, "plugins", "platforms")
@ -37,6 +49,8 @@ if __name__ == "__main__":
def cb():
print(root.getSelectedLocation())
sys.stdout.flush()
if args.die:
QGuiApplication.quitOnLastWindowClosed()
root.close()

Loading…
Cancel
Save