From 9c8cb024e489a49e4c9d3fa5f64d2940b2f04bdc Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 19 Mar 2019 15:21:23 +1000 Subject: [PATCH] Fake a profile name where none exists Where the profile name is none (the empty string), fake a profile name based on the index. This used to be done in ratbagd but was removed there with the most recent snapshot. Signed-off-by: Peter Hutterer --- piper/mouseperspective.py | 5 ++++- piper/profilerow.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/piper/mouseperspective.py b/piper/mouseperspective.py index 3eb9acb..de92b72 100644 --- a/piper/mouseperspective.py +++ b/piper/mouseperspective.py @@ -94,7 +94,10 @@ class MousePerspective(Gtk.Overlay): self.stack.add_titled(LedsPage(device), "leds", _("LEDs")) self.button_profile.set_visible(len(device.profiles) > 1) - self.label_profile.set_label(active_profile.name) + name = active_profile.name + if not name: + name = 'Profile {}'.format(active_profile.index) + self.label_profile.set_label(name) self._on_profile_notify_dirty(active_profile, None) # Find the first profile that is enabled. If there is none, disable the diff --git a/piper/profilerow.py b/piper/profilerow.py index 7755cd8..70610c2 100644 --- a/piper/profilerow.py +++ b/piper/profilerow.py @@ -36,7 +36,11 @@ class ProfileRow(Gtk.ListBoxRow): self._profile = profile self._profile.connect("notify::enabled", self._on_profile_notify_enabled) - self.title.set_text(profile.name) + name = profile.name + if not name: + name = 'Profile {}'.format(profile.index) + + self.title.set_text(name) self.show_all() self.set_visible(profile.enabled)