comparison libervia/desktop_kivy/plugins/plugin_wid_chat.py @ 518:196483685a63 default tip

Use Font-Awesome instead of Fontello, following change in Libervia Media.
author Goffi <goffi@goffi.org>
date Sat, 26 Oct 2024 22:44:37 +0200
parents b3cedbee561d
children
comparison
equal deleted inserted replaced
517:f316c7f19909 518:196483685a63
57 57
58 PLUGIN_INFO = { 58 PLUGIN_INFO = {
59 "name": _("chat"), 59 "name": _("chat"),
60 "main": "Chat", 60 "main": "Chat",
61 "description": _("instant messaging with one person or a group"), 61 "description": _("instant messaging with one person or a group"),
62 "icon_symbol": "chat", 62 "icon_symbol": "comments",
63 } 63 }
64 64
65 # FIXME: OTR specific code is legacy, and only used nowadays for lock color 65 # FIXME: OTR specific code is legacy, and only used nowadays for lock color
66 # we can probably get rid of them. 66 # we can probably get rid of them.
67 OTR_STATE_UNTRUSTED = 'untrusted' 67 OTR_STATE_UNTRUSTED = 'untrusted'
69 OTR_STATE_TRUST = (OTR_STATE_UNTRUSTED, OTR_STATE_TRUSTED) 69 OTR_STATE_TRUST = (OTR_STATE_UNTRUSTED, OTR_STATE_TRUSTED)
70 OTR_STATE_UNENCRYPTED = 'unencrypted' 70 OTR_STATE_UNENCRYPTED = 'unencrypted'
71 OTR_STATE_ENCRYPTED = 'encrypted' 71 OTR_STATE_ENCRYPTED = 'encrypted'
72 OTR_STATE_ENCRYPTION = (OTR_STATE_UNENCRYPTED, OTR_STATE_ENCRYPTED) 72 OTR_STATE_ENCRYPTION = (OTR_STATE_UNENCRYPTED, OTR_STATE_ENCRYPTED)
73 73
74 SYMBOL_UNENCRYPTED = 'lock-open' 74 SYMBOL_UNENCRYPTED = 'unlock'
75 SYMBOL_ENCRYPTED = 'lock' 75 SYMBOL_ENCRYPTED = 'lock'
76 SYMBOL_ENCRYPTED_TRUSTED = 'lock-filled' 76 SYMBOL_ENCRYPTED_TRUSTED = 'lock'
77 COLOR_UNENCRYPTED = (0.4, 0.4, 0.4, 1) 77 COLOR_UNENCRYPTED = (0.4, 0.4, 0.4, 1)
78 COLOR_ENCRYPTED = (0.4, 0.4, 0.4, 1) 78 COLOR_ENCRYPTED = (0.4, 0.4, 0.4, 1)
79 COLOR_ENCRYPTED_TRUSTED = (0.29,0.87,0.0,1) 79 COLOR_ENCRYPTED_TRUSTED = (0.29,0.87,0.0,1)
80 80
81 # below this limit, new messages will be prepended 81 # below this limit, new messages will be prepended
116 116
117 def get_symbol(self, data): 117 def get_symbol(self, data):
118 media_type = data.get(C.KEY_ATTACHMENTS_MEDIA_TYPE, '') 118 media_type = data.get(C.KEY_ATTACHMENTS_MEDIA_TYPE, '')
119 main_type = media_type.split('/', 1)[0] 119 main_type = media_type.split('/', 1)[0]
120 if main_type == 'image': 120 if main_type == 'image':
121 return "file-image" 121 return "regular file-image"
122 elif main_type == 'video': 122 elif main_type == 'video':
123 return "file-video" 123 return "regular file-video"
124 elif main_type == 'audio': 124 elif main_type == 'audio':
125 return "file-audio" 125 return "regular file-audio"
126 else: 126 else:
127 return "doc" 127 return "regular file"
128 128
129 def on_press(self): 129 def on_press(self):
130 url = self.data.get('url') 130 url = self.data.get('url')
131 if url: 131 if url:
132 G.local_platform.open_url(url, self) 132 G.local_platform.open_url(url, self)
210 # we'll download the file, the preview will then be generated 210 # we'll download the file, the preview will then be generated
211 to_download = True 211 to_download = True
212 else: 212 else:
213 # we don't download automatically the image if the contact is not 213 # we don't download automatically the image if the contact is not
214 # in roster, to avoid leaking the ip 214 # in roster, to avoid leaking the ip
215 wid = Symbol(symbol="file-image") 215 wid = Symbol(symbol="regular file-image")
216 self.add_widget(wid) 216 self.add_widget(wid)
217 else: 217 else:
218 wid = None 218 wid = None
219 219
220 if to_download: 220 if to_download:
494 else: 494 else:
495 return (0.4, 0.4, 0.4, 1) 495 return (0.4, 0.4, 0.4, 1)
496 496
497 def get_symbol(self): 497 def get_symbol(self):
498 if self.chat.otr_state_encryption == OTR_STATE_UNENCRYPTED: 498 if self.chat.otr_state_encryption == OTR_STATE_UNENCRYPTED:
499 return 'lock-open' 499 return 'unlock'
500 elif self.chat.otr_state_trust == OTR_STATE_TRUSTED: 500 elif self.chat.otr_state_trust == OTR_STATE_TRUSTED:
501 return 'lock-filled' 501 # FIXME: Used to be "lock-filled" before transition to font-awesome.
502 return 'lock'
502 else: 503 else:
503 return 'lock' 504 return 'lock'
504 505
505 506
506 class TrustManagementButton(SymbolButton): 507 class TrustManagementButton(SymbolButton):
897 ) 898 )
898 if not is_visible: 899 if not is_visible:
899 G.host.add_note( 900 G.host.add_note(
900 _("private message"), 901 _("private message"),
901 notif_msg, 902 notif_msg,
902 symbol = "chat", 903 symbol = "comments",
903 action = { 904 action = {
904 "action": 'chat', 905 "action": 'chat',
905 "target": self.target, 906 "target": self.target,
906 "profiles": self.profiles} 907 "profiles": self.profiles}
907 ) 908 )
909 if mess_data.mention: 910 if mess_data.mention:
910 notif_msg = self._get_notif_msg(mess_data) 911 notif_msg = self._get_notif_msg(mess_data)
911 G.host.add_note( 912 G.host.add_note(
912 _("mention"), 913 _("mention"),
913 notif_msg, 914 notif_msg,
914 symbol = "chat", 915 symbol = "comments",
915 action = { 916 action = {
916 "action": 'chat', 917 "action": 'chat',
917 "target": self.target, 918 "target": self.target,
918 "profiles": self.profiles} 919 "profiles": self.profiles}
919 ) 920 )