comparison browser_side/panels.py @ 401:ea03f898067f

browser_side: LightTextEditor renamed to HTMLTextEditor, new class LightTextEditor based on TextArea
author souliane <souliane@mailoo.org>
date Thu, 13 Mar 2014 13:15:48 +0100
parents 487dd238ab88
children d7e78cb78dfc
comparison
equal deleted inserted replaced
400:487dd238ab88 401:ea03f898067f
42 from datetime import datetime 42 from datetime import datetime
43 from time import time 43 from time import time
44 from jid import JID 44 from jid import JID
45 45
46 from html_tools import html_sanitize 46 from html_tools import html_sanitize
47 from base_panels import ChatText, OccupantsList, PopupMenuPanel, BaseTextEditor, LightTextEditor 47 from base_panels import ChatText, OccupantsList, PopupMenuPanel, BaseTextEditor, LightTextEditor, HTMLTextEditor
48 from card_game import CardPanel 48 from card_game import CardPanel
49 from radiocol import RadioColPanel 49 from radiocol import RadioColPanel
50 from menu import Menu 50 from menu import Menu
51 import dialog 51 import dialog
52 import base_widget 52 import base_widget
942 if self.host.contact_panel.isContactInGroup(group, jid): 942 if self.host.contact_panel.isContactInGroup(group, jid):
943 return True 943 return True
944 return False 944 return False
945 945
946 946
947 class StatusPanel(LightTextEditor, ClickHandler): 947 class StatusPanel(HTMLTextEditor, ClickHandler):
948 948
949 EMPTY_STATUS = '&lt;click to set a status&gt;' 949 EMPTY_STATUS = '&lt;click to set a status&gt;'
950 950
951 def __init__(self, host, status=''): 951 def __init__(self, host, status=''):
952 self.host = host 952 self.host = host
953 modifiedCb = lambda content: self.host.bridge.call('setStatus', None, self.host.status_panel.presence, content['text']) or True 953 modifiedCb = lambda content: self.host.bridge.call('setStatus', None, self.host.status_panel.presence, content['text']) or True
954 LightTextEditor.__init__(self, {'text': status}, modifiedCb, None, single_line=True) 954 HTMLTextEditor.__init__(self, {'text': status}, modifiedCb, None, single_line=True)
955 self.edit(False) 955 self.edit(False)
956 self.setStyleName('statusPanel') 956 self.setStyleName('statusPanel')
957 ClickHandler.__init__(self) 957 ClickHandler.__init__(self)
958 self.addClickListener(self) 958 self.addClickListener(self)
959 959
966 if status == self.EMPTY_STATUS or status in Const.PRESENCE.values(): 966 if status == self.EMPTY_STATUS or status in Const.PRESENCE.values():
967 content['text'] = '' 967 content['text'] = ''
968 return content 968 return content
969 969
970 def getContent(self): 970 def getContent(self):
971 return self.__cleanContent(LightTextEditor.getContent(self)) 971 return self.__cleanContent(HTMLTextEditor.getContent(self))
972 972
973 def setContent(self, content): 973 def setContent(self, content):
974 content = self.__cleanContent(content) 974 content = self.__cleanContent(content)
975 BaseTextEditor.setContent(self, content) 975 BaseTextEditor.setContent(self, content)
976 976