Skip to content

Commit

Permalink
Merge branch 'master' into dialog-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
rdbende committed Dec 3, 2023
2 parents b0a1fc2 + e6f0e9f commit e5f659a
Show file tree
Hide file tree
Showing 10 changed files with 2,362 additions and 111 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,3 @@ jobs:
- name: Test with pytest
run: |
pytest
- name: Install Cozy
run: |
meson --prefix=/usr ./build
ninja -C build install
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ To nedrichards for the Flatpak.
## Help me translate cozy!
Cozy is on <a href="https://www.transifex.com/geigi/cozy/">Transifex</a>, where anyone can contribute and translate. Can't find your language in the list? Let me know!

If you like this project, consider supporting me on <a href="https://www.patreon.com/bePatron?u=8147127">Patreon</a> :)
If you like this project, consider supporting me on <a href="https://www.patreon.com/geigi">Patreon</a> :)

----
[![Maintainability](https://api.codeclimate.com/v1/badges/fde8cbdff23033adaca2/maintainability)](https://codeclimate.com/github/geigi/cozy/maintainability)
8 changes: 7 additions & 1 deletion cozy/application.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import gettext
import locale
import logging
import os
Expand Down Expand Up @@ -73,9 +74,14 @@ def __init__(self, localedir: str, pkgdatadir: str):
sys.excepthook = self.handle_exception
setup_thread_excepthook()

import gettext
# We need to call `locale.*textdomain` to get the strings in UI files translated
locale.bindtextdomain('com.github.geigi.cozy', localedir)
locale.textdomain('com.github.geigi.cozy')

# But also `gettext.*textdomain`, to make `_("foo")` in Python work as well
gettext.bindtextdomain('com.github.geigi.cozy', localedir)
gettext.textdomain('com.github.geigi.cozy')

gettext.install('com.github.geigi.cozy', localedir)

def do_startup(self):
Expand Down
10 changes: 8 additions & 2 deletions cozy/control/mpris.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
log = logging.getLogger("offline_cache")


class UnsupportedProperty(Exception):
pass


class Server:
def __init__(self, con, path):
method_outargs = {}
Expand Down Expand Up @@ -84,13 +88,15 @@ def on_method_call(self,
invocation.return_value(variant)
else:
invocation.return_value(None)
except UnsupportedProperty:
invocation.return_dbus_error("{}.Error.NotSupported".format(interface_name), "Unsupported property")
except Exception as e:
log.error(e)
reporter.exception("mpris", e)
reporter.error("mpris", "MPRIS method call failed with method name: {}".format(method_name))
if out_args:
reporter.error("mpris", "MPRIS method call failed with out_args: {}".format(out_args))
invocation.return_value(None)
invocation.return_dbus_error("{}.Error.Failed".format(interface_name), "Internal exception occurred")


class MPRIS(Server):
Expand Down Expand Up @@ -270,7 +276,7 @@ def Get(self, interface, property_name):
return GLib.Variant("d", self._player.volume)
else:
reporter.warning("mpris", "MPRIS required an unknown information: {}".format(property_name))
return None
raise UnsupportedProperty

def GetAll(self, interface):
ret = {}
Expand Down
2 changes: 1 addition & 1 deletion cozy/ui/app_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, builder: Gtk.Builder):

def _get_ui_elements(self):
self._main_stack: Gtk.Stack = self._builder.get_object("main_stack")
self._navigation_view: Adw.Leaflet = self._builder.get_object("navigation_view")
self._navigation_view: Adw.NavigationView = self._builder.get_object("navigation_view")

def _connect_ui_elements(self):
self._main_stack.connect("notify::visible-child", self._update_view_model_view)
Expand Down
Loading

0 comments on commit e5f659a

Please sign in to comment.