# HG changeset patch # User Goffi # Date 1527242599 -7200 # Node ID 890b48e4199810f7e51ad62df6501dc898c9b240 # Parent 9cefc9f8efc925ee599becf024d5d24fd5ebe5c4 plugin file sharing: use appropriate symbol when discovering devices diff -r 9cefc9f8efc9 -r 890b48e41998 cagou/plugins/plugin_wid_file_sharing.kv --- a/cagou/plugins/plugin_wid_file_sharing.kv Fri May 25 12:01:47 2018 +0200 +++ b/cagou/plugins/plugin_wid_file_sharing.kv Fri May 25 12:03:19 2018 +0200 @@ -73,7 +73,7 @@ Symbol: size_hint: 1, None height: dp(80) - symbol: 'desktop' + symbol: root.getSymbol() margin: dp(40) color: 0, 0, 0, 1 Label: diff -r 9cefc9f8efc9 -r 890b48e41998 cagou/plugins/plugin_wid_file_sharing.py --- a/cagou/plugins/plugin_wid_file_sharing.py Fri May 25 12:01:47 2018 +0200 +++ b/cagou/plugins/plugin_wid_file_sharing.py Fri May 25 12:03:19 2018 +0200 @@ -87,6 +87,18 @@ identities = {} for cat, type_, name in entity_ids: identities.setdefault(cat, {}).setdefault(type_, []).append(name) + client = identities.get('client', {}) + if 'pc' in client: + self.type = 'desktop' + elif 'phone' in client: + self.type = 'phone' + elif 'web' in client: + self.type = 'web' + elif 'console' in client: + self.type = 'console' + else: + self.type = 'desktop' + self.identities = identities @property @@ -204,6 +216,18 @@ name = self.identities.name if self.own_device else self.entity_jid.node super(DeviceWidget, self).__init__(sharing_wid, name) + def getSymbol(self): + if self.identities.type == 'desktop': + return 'desktop' + elif self.identities.type == 'phone': + return 'mobile' + elif self.identities.type == 'web': + return 'globe' + elif self.identities.type == 'console': + return 'terminal' + else: + return 'desktop' + def do_item_action(self, touch): self.sharing_wid.remote_entity = self.entity_jid self.sharing_wid.remote_dir = u''