From 6f2ae58cb2fe5c3378e4e6c01cea576ce794873f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Vigneault?= <31829033+PyMarc2@users.noreply.github.com> Date: Mon, 19 Aug 2024 03:19:35 -0400 Subject: [PATCH] Minor import fixes and README update (#135) --- .gitignore | 3 +- README.md | 29 +++++++++++-------- gweatherrouting/core/connectionmanager.py | 4 +-- gweatherrouting/core/core.py | 10 +++---- gweatherrouting/core/geo/collection.py | 6 ++-- gweatherrouting/core/geo/elementmultipoint.py | 4 +-- gweatherrouting/core/geo/elementpoint.py | 2 +- gweatherrouting/core/geo/poi.py | 2 +- gweatherrouting/core/geo/poicollection.py | 4 +-- gweatherrouting/core/geo/routing.py | 2 +- gweatherrouting/core/geo/routingcollection.py | 4 +-- gweatherrouting/core/geo/track.py | 2 +- gweatherrouting/core/geo/trackcollection.py | 4 +-- gweatherrouting/core/grib.py | 2 +- gweatherrouting/core/gribmanager.py | 10 +++---- gweatherrouting/core/networkdatasource.py | 2 +- gweatherrouting/core/serialdatasource.py | 2 +- gweatherrouting/core/storage.py | 2 +- gweatherrouting/core/timecontrol.py | 2 +- gweatherrouting/core/utils/__init__.py | 2 +- gweatherrouting/main.py | 9 ++++-- requirements.txt | 2 +- 22 files changed, 59 insertions(+), 50 deletions(-) diff --git a/.gitignore b/.gitignore index 14e965d..016a067 100755 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ venv *~ cache .buildozer -bin \ No newline at end of file +bin +.idea/* diff --git a/README.md b/README.md index 5f2cb96..3bc8fd2 100644 --- a/README.md +++ b/README.md @@ -45,18 +45,23 @@ GWeatherRouting is an opensource sailing route calculator written in python and: ## Installation -First, install the following dependencies using your OS package manager: -- osm-gps-map (version 1.2.0) -- eccodes -- python3 -- python3-pip - -Then checkout the repository and run: -```python setup.py install``` - -Start the software running: -```gweatherrouting``` - +1. Make sure to have Python >= 3.9 installed and the `pip` package manager. +2. Install the following dependencies using your OS package manager (e.g: debian=apt, macos=homebrew) Be aware that some packages have different names with different package managers. + - gobject-introspection + - gdal + - gtk+3 + - libffi + - librsvg + - osm-gps-map + - py3cairo + - pygobject3 + - pkg-config + - eccodes + +Note: if you are using a `virtualenv` you need to make symbolic links from the UI libraries to your `venv` folder (this is not needed using system interpreter outside venv).``` +3. install the required python modules with `pip install -r requirements.txt` +4. Then checkout the repository and run: ```python setup.py install``` +5. Start the software running: ```gweatherrouting``` ## License diff --git a/gweatherrouting/core/connectionmanager.py b/gweatherrouting/core/connectionmanager.py index 4b28549..f28c6a0 100644 --- a/gweatherrouting/core/connectionmanager.py +++ b/gweatherrouting/core/connectionmanager.py @@ -18,8 +18,8 @@ import time from threading import Thread -from . import NetworkDataSource, SerialDataSource -from .utils import EventDispatcher, Storage +from gweatherrouting.core import NetworkDataSource, SerialDataSource +from gweatherrouting.core.utils import EventDispatcher, Storage logger = logging.getLogger("gweatherrouting") diff --git a/gweatherrouting/core/core.py b/gweatherrouting/core/core.py index bb3e46f..35e6050 100644 --- a/gweatherrouting/core/core.py +++ b/gweatherrouting/core/core.py @@ -19,11 +19,11 @@ import gpxpy import weatherrouting -from . import GribManager, utils -from .connectionmanager import ConnectionManager -from .datasource import DataPacket -from .geo import POICollection, RoutingCollection, TrackCollection -from .utils import EventDispatcher +from gweatherrouting.core import GribManager, utils +from gweatherrouting.core.connectionmanager import ConnectionManager +from gweatherrouting.core.datasource import DataPacket +from gweatherrouting.core.geo import POICollection, RoutingCollection, TrackCollection +from gweatherrouting.core.utils import EventDispatcher logger = logging.getLogger("gweatherrouting") diff --git a/gweatherrouting/core/geo/collection.py b/gweatherrouting/core/geo/collection.py index 61c806a..c7bceac 100644 --- a/gweatherrouting/core/geo/collection.py +++ b/gweatherrouting/core/geo/collection.py @@ -17,9 +17,9 @@ import gpxpy -from ..utils import uniqueName -from ..storage import Storage -from .element import Element +from gweatherrouting.core.utils import uniqueName +from gweatherrouting.core.storage import Storage +from gweatherrouting.core.geo.element import Element T = TypeVar("T", bound=Element) diff --git a/gweatherrouting/core/geo/elementmultipoint.py b/gweatherrouting/core/geo/elementmultipoint.py index dddd527..7fd14e9 100644 --- a/gweatherrouting/core/geo/elementmultipoint.py +++ b/gweatherrouting/core/geo/elementmultipoint.py @@ -13,8 +13,8 @@ For detail about GNU see . """ -from .. import utils -from .element import Element +from gweatherrouting.core import utils +from gweatherrouting.core.geo.element import Element class ElementMultiPoint(Element): diff --git a/gweatherrouting/core/geo/elementpoint.py b/gweatherrouting/core/geo/elementpoint.py index 4322a66..8bbfa4c 100644 --- a/gweatherrouting/core/geo/elementpoint.py +++ b/gweatherrouting/core/geo/elementpoint.py @@ -15,7 +15,7 @@ """ from typing import Tuple -from .element import Element +from gweatherrouting.core.geo.element import Element class ElementPoint(Element): diff --git a/gweatherrouting/core/geo/poi.py b/gweatherrouting/core/geo/poi.py index ea4f764..f89a00e 100644 --- a/gweatherrouting/core/geo/poi.py +++ b/gweatherrouting/core/geo/poi.py @@ -17,7 +17,7 @@ import gpxpy -from .elementpoint import ElementPoint +from gweatherrouting.core.geo.elementpoint import ElementPoint # FURUNO PFEC NMEA https://www.manualsdir.com/manuals/100982/furuno-gp-1650.html?page=66 diff --git a/gweatherrouting/core/geo/poicollection.py b/gweatherrouting/core/geo/poicollection.py index 3328f5b..470d3d9 100644 --- a/gweatherrouting/core/geo/poicollection.py +++ b/gweatherrouting/core/geo/poicollection.py @@ -15,8 +15,8 @@ """ from typing import Generic, Tuple, TypeVar -from . import POI -from .collection import Collection +from gweatherrouting.core.geo.poi import POI +from gweatherrouting.core.geo.collection import Collection T = TypeVar("T", bound=POI) diff --git a/gweatherrouting/core/geo/routing.py b/gweatherrouting/core/geo/routing.py index 7c1f3d2..0b80770 100644 --- a/gweatherrouting/core/geo/routing.py +++ b/gweatherrouting/core/geo/routing.py @@ -16,7 +16,7 @@ import gpxpy from weatherrouting import IsoPoint -from . import Track +from gweatherrouting.core.geo.track import Track class Routing(Track): diff --git a/gweatherrouting/core/geo/routingcollection.py b/gweatherrouting/core/geo/routingcollection.py index 4fac652..f14a914 100644 --- a/gweatherrouting/core/geo/routingcollection.py +++ b/gweatherrouting/core/geo/routingcollection.py @@ -15,8 +15,8 @@ """ from typing import Generic, TypeVar -from . import Routing -from .collection import CollectionWithActiveElement +from gweatherrouting.core.geo.routing import Routing +from gweatherrouting.core.geo.collection import CollectionWithActiveElement T = TypeVar("T", bound=Routing) diff --git a/gweatherrouting/core/geo/track.py b/gweatherrouting/core/geo/track.py index e50bce2..e825437 100644 --- a/gweatherrouting/core/geo/track.py +++ b/gweatherrouting/core/geo/track.py @@ -15,7 +15,7 @@ """ import gpxpy -from .elementmultipoint import ElementMultiPoint +from gweatherrouting.core.geo.elementmultipoint import ElementMultiPoint class Track(ElementMultiPoint): diff --git a/gweatherrouting/core/geo/trackcollection.py b/gweatherrouting/core/geo/trackcollection.py index 65e7770..3987750 100644 --- a/gweatherrouting/core/geo/trackcollection.py +++ b/gweatherrouting/core/geo/trackcollection.py @@ -15,8 +15,8 @@ """ from typing import Generic, TypeVar -from . import Track -from .collection import CollectionWithActiveElement +from gweatherrouting.core.geo.track import Track +from gweatherrouting.core.geo.collection import CollectionWithActiveElement T = TypeVar("T", bound=Track) diff --git a/gweatherrouting/core/grib.py b/gweatherrouting/core/grib.py index bf42e8c..b556ff4 100644 --- a/gweatherrouting/core/grib.py +++ b/gweatherrouting/core/grib.py @@ -20,7 +20,7 @@ import weatherrouting -from . import utils +from gweatherrouting.core import utils logger = logging.getLogger("gweatherrouting") diff --git a/gweatherrouting/core/gribmanager.py b/gweatherrouting/core/gribmanager.py index 06756e4..81ec9c2 100644 --- a/gweatherrouting/core/gribmanager.py +++ b/gweatherrouting/core/gribmanager.py @@ -5,13 +5,13 @@ import requests import weatherrouting -from .grib import Grib +from gweatherrouting.core.grib import Grib -# try: -from .storage import GRIB_DIR, TEMP_DIR, Storage +try: + from gweatherrouting.core.storage import GRIB_DIR, TEMP_DIR, Storage -# except: -# from .utils.dummy_storage import Storage +except: + from gweatherrouting.core.utils.dummy_storage import Storage # from bs4 import BeautifulSoup diff --git a/gweatherrouting/core/networkdatasource.py b/gweatherrouting/core/networkdatasource.py index 47b4728..a207bf8 100644 --- a/gweatherrouting/core/networkdatasource.py +++ b/gweatherrouting/core/networkdatasource.py @@ -16,7 +16,7 @@ import logging import socket -from . import DataSource +from gweatherrouting.core import DataSource logger = logging.getLogger("gweatherrouting") diff --git a/gweatherrouting/core/serialdatasource.py b/gweatherrouting/core/serialdatasource.py index e3e2ad4..6730471 100644 --- a/gweatherrouting/core/serialdatasource.py +++ b/gweatherrouting/core/serialdatasource.py @@ -18,7 +18,7 @@ import serial from serial.tools import list_ports -from . import DataSource +from gweatherrouting.core import DataSource logger = logging.getLogger("gweatherrouting") diff --git a/gweatherrouting/core/storage.py b/gweatherrouting/core/storage.py index 1a54843..5370998 100644 --- a/gweatherrouting/core/storage.py +++ b/gweatherrouting/core/storage.py @@ -21,7 +21,7 @@ import sys from datetime import date, datetime -from .. import log # noqa: F401 +from gweatherrouting import log # noqa: F401 logger = logging.getLogger("gweatherrouting") diff --git a/gweatherrouting/core/timecontrol.py b/gweatherrouting/core/timecontrol.py index 9acf2dc..8ca57c8 100644 --- a/gweatherrouting/core/timecontrol.py +++ b/gweatherrouting/core/timecontrol.py @@ -16,7 +16,7 @@ import datetime -from .utils import EventDispatcher +from gweatherrouting.core.utils import EventDispatcher class TimeControl(EventDispatcher): diff --git a/gweatherrouting/core/utils/__init__.py b/gweatherrouting/core/utils/__init__.py index 219abba..18e5161 100644 --- a/gweatherrouting/core/utils/__init__.py +++ b/gweatherrouting/core/utils/__init__.py @@ -23,7 +23,7 @@ from typing import Dict, Callable # try: -from .storage import * # noqa: F401, F403 +from gweatherrouting.core.storage import * # noqa: F401, F403 # except: # from .dummy_storage import * # noqa: F401, F403 diff --git a/gweatherrouting/main.py b/gweatherrouting/main.py index bbff2df..448e55d 100644 --- a/gweatherrouting/main.py +++ b/gweatherrouting/main.py @@ -15,8 +15,8 @@ """ import logging -from . import log # noqa: F401 -from .core import Core +from gweatherrouting import log # noqa: F401 +from gweatherrouting.core import Core logger = logging.getLogger("gweatherrouting") @@ -33,7 +33,7 @@ def startUIGtk(): gi.require_version("Gtk", "3.0") from gi.repository import Gtk - from .gtk.mainwindow import MainWindow + from gweatherrouting.gtk.mainwindow import MainWindow MainWindow(Core()) Gtk.main() @@ -41,3 +41,6 @@ def startUIGtk(): # if __name__ == "__main__": # startUIKivy() + +# if __name__ == "__main__": +# startUIGtk() diff --git a/requirements.txt b/requirements.txt index 19dc9bd..82cc96c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,4 +12,4 @@ numpy nmeatoolkit matplotlib weatherrouting -gdal==3.6.4 \ No newline at end of file +GDAL==3.6.4 \ No newline at end of file