Skip to content

Commit

Permalink
Improve shortcuts keys, search locations, add keyboard shortcuts dial…
Browse files Browse the repository at this point in the history
…og, update mousam.pot file (#114)

improve shortcuts, menu-item and search city page
improved UI of search city dialog
Added - press enter to search city
now menu items also shows shortcut keys
Added keyboard shortcuts dialog
updated mousam.pot file

* fix filename
  • Loading branch information
amit9838 authored May 8, 2024
1 parent 63e6b07 commit 4d17a7c
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 53 deletions.
2 changes: 2 additions & 0 deletions po/POTFILES
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ src/weatherData.py
src/windowAbout.py
src/windowLocations.py
src/windowPreferences.py
src/shortcutsDialog.py
src/shortcutsDialog.ui
117 changes: 73 additions & 44 deletions po/mousam.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-15 15:53+0100\n"
"POT-Creation-Date: 2024-05-08 13:57+0530\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -238,15 +238,15 @@ msgstr ""
msgid "United States AQI standard"
msgstr ""

#: src/frontendCardDayNight.py:73
#: src/frontendCardDayNight.py:77
msgid "Sunrise & Sunset"
msgstr ""

#: src/frontendCardDayNight.py:84
#: src/frontendCardDayNight.py:88
msgid "Sunrise"
msgstr ""

#: src/frontendCardDayNight.py:97
#: src/frontendCardDayNight.py:101
msgid "Sunset"
msgstr ""

Expand Down Expand Up @@ -278,11 +278,11 @@ msgstr ""
msgid "West"
msgstr ""

#: src/frontendCardSquare.py:169 src/mousam.py:250
#: src/frontendCardSquare.py:169 src/mousam.py:274
msgid "Northwest"
msgstr ""

#: src/frontendCardSquare.py:179 src/frontendHourlyDetails.py:58
#: src/frontendCardSquare.py:179 src/frontendHourlyDetails.py:59
msgid "Wind"
msgstr ""

Expand All @@ -303,142 +303,154 @@ msgstr ""
msgid "Feels Like • <b> {0} {1}</b>"
msgstr ""

#: src/frontendForecast.py:36 src/frontendForecast.py:127
#: src/frontendForecast.py:36 src/frontendForecast.py:130
msgid "Tomorrow"
msgstr ""

#: src/frontendForecast.py:43
msgid "Weekly"
msgstr ""

#: src/frontendForecast.py:125
#: src/frontendForecast.py:128
msgid "Today"
msgstr ""

#: src/frontendHourlyDetails.py:50
#: src/frontendHourlyDetails.py:51
msgid "Hourly"
msgstr ""

#: src/frontendHourlyDetails.py:66
#: src/frontendHourlyDetails.py:67
msgid "Precipitation"
msgstr ""

#: src/frontendHourlyDetails.py:95
#: src/frontendHourlyDetails.py:96
msgctxt "wind"
msgid "Day High"
msgstr ""

#: src/frontendHourlyDetails.py:111
#: src/frontendHourlyDetails.py:112
msgctxt "temperature"
msgid "Day Max"
msgstr ""

#: src/frontendHourlyDetails.py:126
#: src/frontendHourlyDetails.py:127
msgctxt "precipitation"
msgid "Day High"
msgstr ""

#: src/frontendHourlyDetails.py:164
#: src/frontendHourlyDetails.py:165
msgid "No precipitation today !"
msgstr ""

#: src/frontendHourlyDetails.py:165
#: src/frontendHourlyDetails.py:166
msgid "No precipitation expected today!"
msgstr ""

#: src/frontendHourlyDetails.py:166
#: src/frontendHourlyDetails.py:167
msgid "Anticipate a precipitation-free day !"
msgstr ""

#: src/frontendHourlyDetails.py:167
#: src/frontendHourlyDetails.py:168
msgid "Enjoy a rain-free day today!"
msgstr ""

#: src/frontendHourlyDetails.py:168
#: src/frontendHourlyDetails.py:169
msgid "Umbrella status: resting. No precipitation in sight !"
msgstr ""

#: src/frontendHourlyDetails.py:169
#: src/frontendHourlyDetails.py:170
msgid "No rain in sight today!"
msgstr ""

#: src/frontendHourlyDetails.py:198
#: src/frontendHourlyDetails.py:199
msgid "Now"
msgstr ""

#: src/frontendUiDrawDayNight.py:89
#: src/frontendUiDrawDayNight.py:98
msgid "Horizon"
msgstr ""

#: src/frontendUiDrawDayNight.py:99
#: src/frontendUiDrawDayNight.py:108
msgid "Midnight"
msgstr ""

#: src/mousam.py:76
#: src/mousam.py:70
msgid "Refresh"
msgstr ""

#: src/mousam.py:79 src/shortcutsDialog.ui:45
msgid "Preferences"
msgstr ""

#: src/mousam.py:84
#: src/mousam.py:84 src/shortcutsDialog.ui:63
msgid "Keyboard Shortcuts"
msgstr ""

#: src/mousam.py:90
msgid "About Mousam"
msgstr ""

#: src/mousam.py:126
#: src/mousam.py:92 src/shortcutsDialog.ui:57
msgid "Quit"
msgstr ""

#: src/mousam.py:150
msgid "Getting Weather Data"
msgstr ""

#: src/mousam.py:137
#: src/mousam.py:161
msgid "No Internet"
msgstr ""

#: src/mousam.py:141
#: src/mousam.py:165
msgid "Could not fetch data from API"
msgstr ""

#: src/mousam.py:249
#: src/mousam.py:273
msgid "From"
msgstr ""

#: src/mousam.py:251
#: src/mousam.py:275
msgid "N"
msgstr ""

#: src/mousam.py:261
#: src/mousam.py:285
msgid "Dewpoint"
msgstr ""

#: src/mousam.py:277
#: src/mousam.py:301
msgctxt "pressure card"
msgid "High"
msgstr ""

#: src/mousam.py:278
#: src/mousam.py:302
msgctxt "pressure card"
msgid "Low"
msgstr ""

#: src/mousam.py:287
#: src/mousam.py:311
msgctxt "uvindex card"
msgid "High"
msgstr ""

#: src/mousam.py:288
#: src/mousam.py:312
msgctxt "uvindex card"
msgid "Low"
msgstr ""

#: src/mousam.py:304
#: src/mousam.py:328
msgid "Switched to {}"
msgstr ""

#: src/mousam.py:307
#: src/mousam.py:331
msgid "Refreshed Successfully"
msgstr ""

#: src/mousam.py:317
#: src/mousam.py:341
msgid "Refresh within 5 seconds is ignored!"
msgstr ""

#: src/mousam.py:322
#: src/mousam.py:346
msgid "Refreshing..."
msgstr ""

Expand Down Expand Up @@ -564,6 +576,7 @@ msgid "translator_credits"
msgstr ""

#: src/windowLocations.py:19 src/windowLocations.py:35
#: src/shortcutsDialog.ui:39
msgid "Locations"
msgstr ""

Expand All @@ -587,18 +600,14 @@ msgstr ""
msgid "Add New Location"
msgstr ""

#: src/windowLocations.py:142
#: src/windowLocations.py:143
msgid "Search for a city"
msgstr ""

#: src/windowLocations.py:148 src/windowLocations.py:150
#: src/windowLocations.py:149 src/windowLocations.py:151
msgid "Search"
msgstr ""

#: src/windowLocations.py:205
msgid "No results found !"
msgstr ""

#: src/windowLocations.py:229
#, python-brace-format
msgid "Added - {0}"
Expand All @@ -617,6 +626,14 @@ msgstr ""
msgid "Deleted - {0}"
msgstr ""

#: src/windowLocations.py:266
msgid "Press enter to search"
msgstr ""

#: src/windowLocations.py:269
msgid "No results found!"
msgstr ""

#: src/windowPreferences.py:34
msgid "Appearance"
msgstr ""
Expand Down Expand Up @@ -673,3 +690,15 @@ msgstr ""
#: src/windowPreferences.py:132
msgid "Switched to - {}"
msgstr ""

#: src/shortcutsDialog.ui:29
msgid "General"
msgstr ""

#: src/shortcutsDialog.ui:33
msgid "Refresh Weather"
msgstr ""

#: src/shortcutsDialog.ui:53
msgid "Navigation"
msgstr ""
4 changes: 4 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def __init__(self):
self.settings = Gio.Settings(schema_id="io.github.amit9838.mousam")
self.main_window = None

self.set_accels_for_action(f"win.preferences", ['<primary>comma'])
self.set_accels_for_action(f"win.shortcuts", ['<primary>question'])


def do_activate(self):
win = self.props.active_window
global css_provider
Expand Down
3 changes: 2 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ mousam_sources = [
'utils.py',
'windowAbout.py',
'windowPreferences.py',
'windowLocations.py'
'windowLocations.py',
'shortcutsDialog.py'
]

install_emptydir(moduledir / 'css')
Expand Down
1 change: 1 addition & 0 deletions src/mousam.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<gresources>
<gresource prefix="/io/github/amit9838/mousam">
<file>css/style.css</file>
<file preprocess="xml-stripblanks">shortcutsDialog.ui</file>
</gresource>
</gresources>

17 changes: 13 additions & 4 deletions src/mousam.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .constants import bg_css
from .windowAbout import AboutWindow
from .windowPreferences import WeatherPreferences
from .shortcutsDialog import ShortcutsDialog
from .windowLocations import WeatherLocations
from .frontendCurrentCond import CurrentCondition
from .frontendHourlyDetails import HourlyDetails
Expand Down Expand Up @@ -66,7 +67,7 @@ def __init__(self, *args, **kwargs):
self.header.pack_end(self.hamburger)

# Create a menu button
self.location_button = Gtk.Button(label="Open")
self.location_button = Gtk.Button(label=_("Refresh"))
self.header.pack_end(self.location_button)
self.location_button.set_icon_name("find-location-symbolic")
self.location_button.connect("clicked", self._on_locations_clicked)
Expand All @@ -77,13 +78,18 @@ def __init__(self, *args, **kwargs):
self.add_action(action)
menu.append(_("Preferences"), "win.preferences")

# menu.append("Help", "help")
action = Gio.SimpleAction.new("shortcuts", None)
action.connect("activate", self._show_shortcuts_dialog)
self.add_action(action)
menu.append(_("Keyboard Shortcuts"), "win.shortcuts")

# Add about option
action = Gio.SimpleAction.new("about", None)
action.connect("activate", self._on_about_clicked)
self.add_action(action)
menu.append(_("About Mousam"), "win.about")

menu.append(_("Quit"), "app.quit")



Expand Down Expand Up @@ -366,6 +372,11 @@ def _on_locations_clicked(self, *args, **kwargs):
adw_preferences_window.show()


def _show_shortcuts_dialog(self,*args, **kwargs):
dialog = ShortcutsDialog(self)
dialog.show()


#Def shortcuts key listeners
def on_key_press(self, key_controller, keyval, keycode, state,*args):
if state & Gdk.ModifierType.CONTROL_MASK:
Expand All @@ -375,5 +386,3 @@ def on_key_press(self, key_controller, keyval, keycode, state,*args):
GLib.idle_add(self._on_locations_clicked)
if keyval == Gdk.KEY_comma:
GLib.idle_add(self._on_preferences_clicked)


10 changes: 10 additions & 0 deletions src/shortcutsDialog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from gi.repository import Gtk


@Gtk.Template(resource_path='/io/github/amit9838/mousam/shortcutsDialog.ui')
class ShortcutsDialog(Gtk.ShortcutsWindow):
__gtype_name__ = 'MousamShortcutsDialog'

def __init__(self, parent):
super().__init__()
self.set_transient_for(parent)
Loading

0 comments on commit 4d17a7c

Please sign in to comment.