diff --git a/io.github.amit9838.weather.json b/io.github.amit9838.weather.json index a54320a..d946c11 100644 --- a/io.github.amit9838.weather.json +++ b/io.github.amit9838.weather.json @@ -31,7 +31,7 @@ "sources" : [ { "type" : "git", - "tag" : "v1.0.0", + "tag" : "v1.0.1", "commit" : "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", "url" : "https://github.com/amit9838/weather.git" } diff --git a/src/backendFindCity.py b/src/backendFindCity.py index 20d202a..9550076 100644 --- a/src/backendFindCity.py +++ b/src/backendFindCity.py @@ -15,7 +15,6 @@ def find_city(city, count=3): response.raise_for_status() # Raise an exception if the request was unsuccessful cities_res = response.json() cities = cities_res.get('results') - # print(cities) cities_list = [] if cities == None: return cities_list @@ -35,8 +34,3 @@ def find_city(city, count=3): except requests.exceptions.RequestException as e: print(f"Error: {e}") - -# UI -# Name - state - Country -# Delhi, Delhi, India [name=state] -# Basti, Uttar Pradesh, India \ No newline at end of file diff --git a/src/constants.py b/src/constants.py index 6164182..5a013df 100644 --- a/src/constants.py +++ b/src/constants.py @@ -1,5 +1,9 @@ import os -icon_loc = "/app/share/icons/hicolor/scalable/weather_icons/" if not os.getenv('SNAP') else f"{os.getenv('SNAP')}/usr/share/icons/hicolor/scalable/weather_icons/" + +icon_loc = "/app/share/icons/hicolor/scalable/weather_icons/" + +if os.getenv('SNAP'): + icon_loc = f"{os.getenv('SNAP')}/usr/share/icons/hicolor/scalable/weather_icons/" icons = { "0": icon_loc + "clear-day.svg", diff --git a/src/utils.py b/src/utils.py index c46a958..a750d1f 100644 --- a/src/utils.py +++ b/src/utils.py @@ -42,14 +42,6 @@ def convert_to_local_time(timestamp, timezone_stamp): hour_offset_from_utc = (timezone_stamp)/3600 return datetime.fromtimestamp(timestamp,tz=timezone.utc) + timedelta(hours=hour_offset_from_utc) -# converts wind degrees to direction -def wind_dir(angle): - directions = [ - _("N"), _("NNE"), _("NE"), _("ENE"), _("E"), _("ESE"), _("SE"), _("SSE"), - _("S"), _("SSW"), _("SW"), _("WSW"), _("W"), _("WNW"), _("NW"), _("NNW"), - ] - index = round(angle / (360.0 / len(directions))) % len(directions) - return directions[index] def get_cords(): settings = Gio.Settings(schema_id="io.github.amit9838.weather") diff --git a/src/windowLocations.py b/src/windowLocations.py index caf7fdc..1b8bde7 100644 --- a/src/windowLocations.py +++ b/src/windowLocations.py @@ -96,6 +96,9 @@ def switch_location(self,widget): global selected_city title = widget.get_title() select_cord = f"{widget.get_subtitle()}" + + if len(select_cord.split(",")) < 2: + return # Switch if location is not already selected if selected_city != select_cord: @@ -185,6 +188,13 @@ def _find_city(self,widget): title_arr = [x for x in title_arr if x is not None] title = ",".join(title_arr) res_row.set_title(title) + + # Skip plotting the location in the search results if it has invalid cords + if loc.latitude is None or loc.longitude is None: + continue + if loc.latitude == "" or loc.longitude == "": + continue + res_row.set_subtitle(f"{loc.latitude},{loc.longitude}") res_row.connect("activated", self._add_city) self._dialog.search_results.append(res_row) diff --git a/website/index.html b/website/index.html index de0772d..92e7dd9 100644 --- a/website/index.html +++ b/website/index.html @@ -61,11 +61,10 @@

Features

@@ -79,7 +78,11 @@

Get it from flathub

Download on Flathub

Or you can use the terminal:

-
flatpak install flathub io.github.amit9838.weather
+
+flatpak install flathub
+
+flatpak install io.github.amit9838.weather
+        

Get it from Snapstore