ui: fix app name casing in UI
* Fix app name casing in UI * Linter fixes * Only use NAME variable * FIx linter errors
This commit is contained in:
parent
51ef2a7fe2
commit
5ee1c6df30
|
@ -18,7 +18,7 @@ import pkgutil as _pkgutil
|
||||||
import subprocess as _subprocess
|
import subprocess as _subprocess
|
||||||
import sys as _sys
|
import sys as _sys
|
||||||
|
|
||||||
NAME = "solaar"
|
NAME = "Solaar"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
__version__ = (
|
__version__ = (
|
||||||
|
|
|
@ -117,7 +117,7 @@ def _receivers(dev_path=None):
|
||||||
yield r
|
yield r
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception("opening " + str(dev_info))
|
logger.exception("opening " + str(dev_info))
|
||||||
_sys.exit("%s: error: %s" % (NAME, str(e)))
|
_sys.exit("%s: error: %s" % (NAME.lower(), str(e)))
|
||||||
|
|
||||||
|
|
||||||
def _receivers_and_devices(dev_path=None):
|
def _receivers_and_devices(dev_path=None):
|
||||||
|
@ -136,7 +136,7 @@ def _receivers_and_devices(dev_path=None):
|
||||||
yield d
|
yield d
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception("opening " + str(dev_info))
|
logger.exception("opening " + str(dev_info))
|
||||||
_sys.exit("%s: error: %s" % (NAME, str(e)))
|
_sys.exit("%s: error: %s" % (NAME.lower(), str(e)))
|
||||||
|
|
||||||
|
|
||||||
def _find_receiver(receivers, name):
|
def _find_receiver(receivers, name):
|
||||||
|
|
|
@ -295,7 +295,7 @@ def run(devices, args, find_receiver, find_device):
|
||||||
assert devices
|
assert devices
|
||||||
assert args.device
|
assert args.device
|
||||||
|
|
||||||
print("%s version %s" % (NAME, __version__))
|
print("%s version %s" % (NAME.lower(), __version__))
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
device_name = args.device.lower()
|
device_name = args.device.lower()
|
||||||
|
|
|
@ -51,7 +51,7 @@ def _require(module, os_package, gi=None, gi_package=None, gi_version=None):
|
||||||
gi.require_version(gi_package, gi_version)
|
gi.require_version(gi_package, gi_version)
|
||||||
return importlib.import_module(module)
|
return importlib.import_module(module)
|
||||||
except (ImportError, ValueError):
|
except (ImportError, ValueError):
|
||||||
sys.exit("%s: missing required system package %s" % (NAME, os_package))
|
sys.exit("%s: missing required system package %s" % (NAME.lower(), os_package))
|
||||||
|
|
||||||
|
|
||||||
battery_icons_style = "regular"
|
battery_icons_style = "regular"
|
||||||
|
|
|
@ -55,7 +55,7 @@ if available:
|
||||||
if logger.isEnabledFor(logging.INFO):
|
if logger.isEnabledFor(logging.INFO):
|
||||||
logger.info("starting desktop notifications")
|
logger.info("starting desktop notifications")
|
||||||
try:
|
try:
|
||||||
return Notify.init(NAME)
|
return Notify.init(NAME.lower())
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("initializing desktop notifications")
|
logger.exception("initializing desktop notifications")
|
||||||
available = False
|
available = False
|
||||||
|
@ -80,15 +80,15 @@ if available:
|
||||||
assert reason
|
assert reason
|
||||||
|
|
||||||
if available and Notify.is_initted():
|
if available and Notify.is_initted():
|
||||||
n = _notifications.get(NAME)
|
n = _notifications.get(NAME.lower())
|
||||||
if n is None:
|
if n is None:
|
||||||
n = _notifications[NAME] = Notify.Notification()
|
n = _notifications[NAME.lower()] = Notify.Notification()
|
||||||
|
|
||||||
# we need to use the filename here because the notifications daemon
|
# we need to use the filename here because the notifications daemon
|
||||||
# is an external application that does not know about our icon sets
|
# is an external application that does not know about our icon sets
|
||||||
icon_file = _icons.icon_file(NAME.lower()) if icon is None else _icons.icon_file(icon)
|
icon_file = _icons.icon_file(NAME.lower()) if icon is None else _icons.icon_file(icon)
|
||||||
|
|
||||||
n.update(NAME, reason, icon_file)
|
n.update(NAME.lower(), reason, icon_file)
|
||||||
n.set_urgency(Notify.Urgency.NORMAL)
|
n.set_urgency(Notify.Urgency.NORMAL)
|
||||||
n.set_hint("desktop-entry", GLib.Variant("s", NAME.lower()))
|
n.set_hint("desktop-entry", GLib.Variant("s", NAME.lower()))
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ try:
|
||||||
ind.set_title(NAME)
|
ind.set_title(NAME)
|
||||||
ind.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
|
ind.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
|
||||||
# ind.set_attention_icon_full(_icon_file(_icons.TRAY_ATTENTION), '') # works poorly for XFCE 16
|
# ind.set_attention_icon_full(_icon_file(_icons.TRAY_ATTENTION), '') # works poorly for XFCE 16
|
||||||
# ind.set_label(NAME, NAME)
|
# ind.set_label(NAME.lower(), NAME.lower())
|
||||||
|
|
||||||
ind.set_menu(menu)
|
ind.set_menu(menu)
|
||||||
ind.connect("scroll-event", _scroll)
|
ind.connect("scroll-event", _scroll)
|
||||||
|
@ -231,7 +231,7 @@ except ImportError:
|
||||||
|
|
||||||
def _create(menu):
|
def _create(menu):
|
||||||
icon = Gtk.StatusIcon.new_from_icon_name(_icons.TRAY_INIT)
|
icon = Gtk.StatusIcon.new_from_icon_name(_icons.TRAY_INIT)
|
||||||
icon.set_name(NAME)
|
icon.set_name(NAME.lower())
|
||||||
icon.set_title(NAME)
|
icon.set_title(NAME)
|
||||||
icon.set_tooltip_text(NAME)
|
icon.set_tooltip_text(NAME)
|
||||||
icon.connect("activate", _window_toggle)
|
icon.connect("activate", _window_toggle)
|
||||||
|
|
Loading…
Reference in New Issue