comparison src/tools/common/data_objects.py @ 2383:a37457da2bb7

tools (common/data_objects): new OnClick class OnClick is used to specify what do to when clicking on element. For now it only handles target URL.
author Goffi <goffi@goffi.org>
date Mon, 16 Oct 2017 07:41:36 +0200
parents 173d56315529
children 8b37a62336c3
comparison
equal deleted inserted replaced
2382:a49a19f06e38 2383:a37457da2bb7
193 def __setitem__(self, jid_str, data): 193 def __setitem__(self, jid_str, data):
194 self.identities[jid_str] = Identity(jid_str, data) 194 self.identities[jid_str] = Identity(jid_str, data)
195 195
196 def __contains__(self, jid_str): 196 def __contains__(self, jid_str):
197 return jid_str in self.identities 197 return jid_str in self.identities
198
199
200 class OnClick(object):
201 """Class to handle clickable elements targets"""
202
203 def __init__(self, url=None):
204 self.url = url
205
206 def formatUrl(self, item):
207 """Use an item to format URL
208
209 item will be formatted using "item=item" in format()
210 """
211 return self.url.format(item=item)