comparison src/browser/sat_browser/richtext.py @ 593:b97c85b8a47e frontends_multi_profiles

browser side: fixed bad FlexTable __init__ call, need to be checked
author Goffi <goffi@goffi.org>
date Fri, 06 Feb 2015 17:49:04 +0100
parents b07f0fe2763a
children 1c0d5a87c554
comparison
equal deleted inserted replaced
592:c66f7227848e 593:b97c85b8a47e
49 @param content: dict with at least a 'text' key 49 @param content: dict with at least a 'text' key
50 @param modifiedCb: method to be called when the text has been modified 50 @param modifiedCb: method to be called when the text has been modified
51 @param afterEditCb: method to be called when the edition is done 51 @param afterEditCb: method to be called when the edition is done
52 @param options: list of UI options (see self.readOptions) 52 @param options: list of UI options (see self.readOptions)
53 """ 53 """
54 FlexTable.__init__(self) # FIXME
54 self.host = host 55 self.host = host
55 self._debug = False # TODO: don't forget to set it False before commit 56 self._debug = False # TODO: don't forget to set it False before commit
56 self.wysiwyg = False 57 self.wysiwyg = False
57 self.__readOptions(options) 58 self.__readOptions(options)
58 self.style = {'main': 'richTextEditor', 59 self.style = {'main': 'richTextEditor',
82 self.content_offset = self.toolbar_offset + (len(composition.RICH_SYNTAXES) if self._debug else 1) 83 self.content_offset = self.toolbar_offset + (len(composition.RICH_SYNTAXES) if self._debug else 1)
83 self.command_offset = self.content_offset + 1 84 self.command_offset = self.content_offset + 1
84 else: 85 else:
85 self.title_offset = self.toolbar_offset = self.content_offset = y_offset 86 self.title_offset = self.toolbar_offset = self.content_offset = y_offset
86 self.command_offset = self.content_offset + 1 87 self.command_offset = self.content_offset + 1
87 FlexTable.__init__(self, self.command_offset + (0 if self.no_command else 1), 2) 88 # FlexTable.__init__(self, rowspan=self.command_offset + (0 if self.no_command else 1), colspan=2) # FIXME
88 self.addStyleName(self.style['main']) 89 self.addStyleName(self.style['main'])
89 90
90 def addEditListener(self, listener): 91 def addEditListener(self, listener):
91 """Add a method to be called whenever the text is edited. 92 """Add a method to be called whenever the text is edited.
92 @param listener: method taking two arguments: sender, keycode""" 93 @param listener: method taking two arguments: sender, keycode"""
172 @param init: set to True to re-init without switching the widgets.""" 173 @param init: set to True to re-init without switching the widgets."""
173 def setWysiwyg(): 174 def setWysiwyg():
174 self.wysiwyg = wysiwyg 175 self.wysiwyg = wysiwyg
175 try: 176 try:
176 self.wysiwyg_button.setChecked(wysiwyg) 177 self.wysiwyg_button.setChecked(wysiwyg)
177 except TypeError: 178 except (AttributeError, TypeError):
178 pass 179 pass
179 try: 180 try:
180 if wysiwyg: 181 if wysiwyg:
181 self.syntax_label.addStyleName('transparent') 182 self.syntax_label.addStyleName('transparent')
182 else: 183 else:
183 self.syntax_label.removeStyleName('transparent') 184 self.syntax_label.removeStyleName('transparent')
184 except TypeError: 185 except (AttributeError, TypeError):
185 pass 186 pass
186 if not wysiwyg: 187 if not wysiwyg:
187 self.display.removeStyleName('richTextWysiwyg') 188 self.display.removeStyleName('richTextWysiwyg')
188 189
189 if init: 190 if init: