Skip to content

Commit

Permalink
Merge pull request #48 from amit9838/patch
Browse files Browse the repository at this point in the history
Patch
  • Loading branch information
amit9838 authored Jan 15, 2024
2 parents 8a8b97d + 9fc4e47 commit 47965bf
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion io.github.amit9838.weather.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
6 changes: 0 additions & 6 deletions src/backendFindCity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
6 changes: 5 additions & 1 deletion src/constants.py
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
8 changes: 0 additions & 8 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 10 additions & 0 deletions src/windowLocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
13 changes: 8 additions & 5 deletions website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ <h2 class="github-btn">
<!-- <p>Beautiful lightweight weather app.</p> -->
<h2>Features</h2>
<ul>
<li>See weather with dynamically changing gradient-based background according to current weather
condition</li>
<li>See today, tomorrow, and 5-day forecasts</li>
<li>Displays real-time temperature, humidity, and wind speed,UV index,pressure and more</li>
<li>Utilizes graphical representations, such as temperature , precipitation graphs and wind-speed with direction to provide an hourly forecast for the next 24 hours</li>
<li>Also shows tomorrow and 7-day forcasts</li>
<li>See conditions in metric or imperial systems</li>
<li>Option to use Personal API Key</li>
</ul>
</div>
</section>
Expand All @@ -79,7 +78,11 @@ <h3 class="subheading">Get it from flathub</h3>
<a href='https://flathub.org/apps/io.github.amit9838.weather' target="_blank"><img width='240'
alt='Download on Flathub' src='https://dl.flathub.org/assets/badges/flathub-badge-en.png' /></a>
<p>Or you can use the terminal:</p>
<pre><code>flatpak install flathub io.github.amit9838.weather</code></pre>
<pre>
<code>flatpak install flathub</code>

<code>flatpak install io.github.amit9838.weather</code>
</pre>

<h3 class="subheading">Get it from Snapstore</h3>
<a href='https://snapcraft.io/mousam' target="_blank"><img width='240' alt='Download on SnapCraft'
Expand Down
5 changes: 5 additions & 0 deletions website/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,14 @@ code{
background-color: #232323;
padding: .3rem .6rem;
border-radius: .2rem;
margin: 0 .5rem;

}

a:link{
text-decoration: none;
}

footer {
background-color: #0F6292;
color: #fff;
Expand Down

0 comments on commit 47965bf

Please sign in to comment.