From c2de1b59efc91e92d1e298ac5222c0d32d67c389 Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Wed, 18 Aug 2021 09:58:23 -0400 Subject: [PATCH] ui: use logging for signalling unfound udev rule --- lib/solaar/gtk.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/solaar/gtk.py b/lib/solaar/gtk.py index d7e648ed..1dee5ba3 100755 --- a/lib/solaar/gtk.py +++ b/lib/solaar/gtk.py @@ -24,6 +24,7 @@ import importlib import os.path from logging import INFO as _INFO +from logging import WARNING as _WARNING from logging import getLogger import solaar.cli as _cli @@ -146,17 +147,12 @@ def main(): _require('gi.repository.Gtk', 'gir1.2-gtk-3.0', gi, 'Gtk', '3.0') udev_file = '42-logitech-unify-permissions.rules' - if not os.path.isfile('/etc/udev/rules.d/' + udev_file) \ + if _log.isEnabledFor(_WARNING) \ + and not os.path.isfile('/etc/udev/rules.d/' + udev_file) \ and not os.path.isfile('/usr/lib/udev/rules.d/' + udev_file) \ and not os.path.isfile('/usr/local/lib/udev/rules.d/' + udev_file): - print(_i18n._('ERROR: '), end='') - print(_i18n._('Solaar depends on a udev file that is not present'), end='.\n') - print( - _i18n._( - 'For more information see the Solaar installation directions\n' - 'at https://pwr-solaar.github.io/Solaar/installation' - ) - ) + _log.warning('Solaar udev file not found in expected location') + _log.warning('See https://pwr-solaar.github.io/Solaar/installation for more information') try: import solaar.ui as ui import solaar.listener as listener