diff --git a/lib/logitech_receiver/notifications.py b/lib/logitech_receiver/notifications.py index 93bb3482..ac6df189 100644 --- a/lib/logitech_receiver/notifications.py +++ b/lib/logitech_receiver/notifications.py @@ -189,7 +189,7 @@ def _process_hidpp10_notification(device, status, n): if n.address == 0x01: if _log.isEnabledFor(_DEBUG): _log.debug("%s: device powered on", device) - reason = str(status) or _("powered on") + reason = status.to_string() or _("powered on") status.changed(active=True, alert=_ALERT.NOTIFICATION, reason=reason) else: _log.warn("%s: unknown %s", device, n) diff --git a/lib/logitech_receiver/status.py b/lib/logitech_receiver/status.py index fc68c71d..57d8505a 100644 --- a/lib/logitech_receiver/status.py +++ b/lib/logitech_receiver/status.py @@ -139,7 +139,7 @@ class DeviceStatus(dict): # timestamp of when this status object was last updated self.updated = 0 - def __str__(self): + def to_string(self): def _items(): comma = False @@ -163,8 +163,6 @@ class DeviceStatus(dict): return ''.join(i for i in _items()) - __unicode__ = __str__ - def __repr__(self): return '{' + ', '.join('\'%s\': %r' % (k, v) for k, v in self.items()) + '}' diff --git a/lib/solaar/ui/config_panel.py b/lib/solaar/ui/config_panel.py index 8adca6e1..99a37120 100644 --- a/lib/solaar/ui/config_panel.py +++ b/lib/solaar/ui/config_panel.py @@ -70,6 +70,7 @@ def _create_choice_control(setting): _write_async(s, cbbox.get_active_id(), cbbox.get_parent()) c = Gtk.ComboBoxText() + # TODO i18n text entries for entry in setting.choices: c.append(str(entry), str(entry)) c.connect('changed', _combo_notify, setting) diff --git a/lib/solaar/ui/notify.py b/lib/solaar/ui/notify.py index 48391a01..00016770 100644 --- a/lib/solaar/ui/notify.py +++ b/lib/solaar/ui/notify.py @@ -117,7 +117,7 @@ try: elif dev.status is None: message = _("unpaired") elif bool(dev.status): - message = dev.status.__str__() or _("connected") + message = dev.status.to_string() or _("connected") else: message = _("offline") diff --git a/lib/solaar/ui/tray.py b/lib/solaar/ui/tray.py index 3dd76f4c..3aec1476 100644 --- a/lib/solaar/ui/tray.py +++ b/lib/solaar/ui/tray.py @@ -281,7 +281,7 @@ def _generate_tooltip_lines(): if number is None: # receiver continue - p = str(status) + p = status.to_string() if p: # does it have any properties to print? yield '%s' % name if status: diff --git a/lib/solaar/ui/window.py b/lib/solaar/ui/window.py index e0401754..b56707a6 100644 --- a/lib/solaar/ui/window.py +++ b/lib/solaar/ui/window.py @@ -530,7 +530,7 @@ def _update_details(button): if read_all: for fw in list(device.firmware): - yield (' ' + str(fw.kind), (fw.name + ' ' + fw.version).strip()) + yield (' ' + _(str(fw.kind)), (fw.name + ' ' + fw.version).strip()) elif device.kind is None or device.online: yield (' %s' % _("Firmware"), '...')