diff cagou/core/common_widgets.py @ 374:3002704318e3

core (common_widgets): fixed own jid detection in DeviceWidget + `name` property in Identities
author Goffi <goffi@goffi.org>
date Mon, 27 Jan 2020 21:17:09 +0100
parents 51520ce98154
children 4d660b252487
line wrap: on
line diff
--- a/cagou/core/common_widgets.py	Mon Jan 27 21:17:09 2020 +0100
+++ b/cagou/core/common_widgets.py	Mon Jan 27 21:17:09 2020 +0100
@@ -77,7 +77,9 @@
 
     @property
     def name(self):
-        return list(self.identities.values())[0].values()[0][0]
+        first_identity = next(iter(self.identities.values()))
+        names = next(iter(first_identity.values()))
+        return names[0]
 
 
 class ItemWidget(TouchMenuItemBehaviour, BoxLayout):
@@ -91,7 +93,7 @@
         self.entity_jid = entity_jid
         self.identities = identities
         own_jid = next(iter(G.host.profiles.values())).whoami
-        self.own_device = entity_jid.bare == own_jid
+        self.own_device = entity_jid.bare == own_jid.bare
         if self.own_device:
             name = self.identities.name
         elif self.entity_jid.node: