Mercurial > libervia-desktop-kivy
comparison cagou/core/common_widgets.py @ 312:772c170b47a9
Python3 port:
/!\ Cagou now runs with Python 3.6+
Port has been done in the same way as for backend (check backend commit b2d067339de3
message for details).
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 13 Aug 2019 19:14:22 +0200 |
parents | 1b835bcfa663 |
children | 4374cb741eb5 |
comparison
equal
deleted
inserted
replaced
311:a0d978d3ce84 | 312:772c170b47a9 |
---|---|
51 | 51 |
52 self.identities = identities | 52 self.identities = identities |
53 | 53 |
54 @property | 54 @property |
55 def name(self): | 55 def name(self): |
56 return self.identities.values()[0].values()[0][0] | 56 return list(self.identities.values())[0].values()[0][0] |
57 | 57 |
58 | 58 |
59 class ItemWidget(TouchMenuItemBehaviour, BoxLayout): | 59 class ItemWidget(TouchMenuItemBehaviour, BoxLayout): |
60 name = properties.StringProperty() | 60 name = properties.StringProperty() |
61 base_width = properties.NumericProperty(dp(100)) | 61 base_width = properties.NumericProperty(dp(100)) |
64 class DeviceWidget(ItemWidget): | 64 class DeviceWidget(ItemWidget): |
65 | 65 |
66 def __init__(self, main_wid, entity_jid, identities, **kw): | 66 def __init__(self, main_wid, entity_jid, identities, **kw): |
67 self.entity_jid = entity_jid | 67 self.entity_jid = entity_jid |
68 self.identities = identities | 68 self.identities = identities |
69 own_jid = next(G.host.profiles.itervalues()).whoami | 69 own_jid = next(iter(G.host.profiles.values())).whoami |
70 self.own_device = entity_jid.bare == own_jid | 70 self.own_device = entity_jid.bare == own_jid |
71 if self.own_device: | 71 if self.own_device: |
72 name = self.identities.name | 72 name = self.identities.name |
73 elif self.entity_jid.node: | 73 elif self.entity_jid.node: |
74 name = self.entity_jid.node | 74 name = self.entity_jid.node |
75 elif self.entity_jid == own_jid.domain: | 75 elif self.entity_jid == own_jid.domain: |
76 name = _(u"your server") | 76 name = _("your server") |
77 else: | 77 else: |
78 name = entity_jid | 78 name = entity_jid |
79 | 79 |
80 super(DeviceWidget, self).__init__(name=name, main_wid=main_wid, **kw) | 80 super(DeviceWidget, self).__init__(name=name, main_wid=main_wid, **kw) |
81 | 81 |