comparison src/browser/sat_browser/richtext.py @ 898:2d15b484ca33

blog, browser: updated imports to reflect renaming of common.py to common/data_format.py
author Goffi <goffi@goffi.org>
date Tue, 22 Mar 2016 22:45:39 +0100
parents ca31e4f677e5
children
comparison
equal deleted inserted replaced
897:6de862136eb6 898:2d15b484ca33
19 19
20 from sat_frontends.tools import composition 20 from sat_frontends.tools import composition
21 from sat.core.i18n import _ 21 from sat.core.i18n import _
22 from sat.core.log import getLogger 22 from sat.core.log import getLogger
23 log = getLogger(__name__) 23 log = getLogger(__name__)
24 from sat.tools import common 24 from sat.tools.common import data_format
25 25
26 from pyjamas.ui.TextArea import TextArea 26 from pyjamas.ui.TextArea import TextArea
27 from pyjamas.ui.Button import Button 27 from pyjamas.ui.Button import Button
28 from pyjamas.ui.CheckBox import CheckBox 28 from pyjamas.ui.CheckBox import CheckBox
29 from pyjamas.ui.Label import Label 29 from pyjamas.ui.Label import Label
263 else: 263 else:
264 content = {'text': self.strproc(self.textarea.getText()), 'syntax': self.toolbar.syntax} 264 content = {'text': self.strproc(self.textarea.getText()), 'syntax': self.toolbar.syntax}
265 if hasattr(self, 'title_panel'): 265 if hasattr(self, 'title_panel'):
266 content.update({'title': self.strproc(self.title_panel.getText())}) 266 content.update({'title': self.strproc(self.title_panel.getText())})
267 if hasattr(self, 'tags_panel'): 267 if hasattr(self, 'tags_panel'):
268 common.iter2dict('tag', self.tags_panel.getTags(), content) 268 data_format.iter2dict('tag', self.tags_panel.getTags(), content)
269 return content 269 return content
270 270
271 def edit(self, edit=False, abort=False, sync=False): 271 def edit(self, edit=False, abort=False, sync=False):
272 """ 272 """
273 Remark: the editor must be visible before you call this method. 273 Remark: the editor must be visible before you call this method.
300 if hasattr(self, 'title_panel') and 'title' in content: 300 if hasattr(self, 'title_panel') and 'title' in content:
301 self.title_panel.setText(content['title']) 301 self.title_panel.setText(content['title'])
302 self.title_panel.setStackVisible(0, content['title'] != '') 302 self.title_panel.setStackVisible(0, content['title'] != '')
303 303
304 if hasattr(self, 'tags_panel'): 304 if hasattr(self, 'tags_panel'):
305 tags = list(common.dict2iter('tag', content)) 305 tags = list(data_format.dict2iter('tag', content))
306 self.tags_panel.setTags(tags) 306 self.tags_panel.setTags(tags)
307 self.tags_panel.setStackVisible(0, len(tags) > 0) 307 self.tags_panel.setStackVisible(0, len(tags) > 0)
308 308
309 self.setToolBar(syntax) 309 self.setToolBar(syntax)
310 if content['text'] and content['syntax'] != syntax: 310 if content['text'] and content['syntax'] != syntax:
326 title = '<h2>%s</h2>' % html_tools.html_sanitize(content['title']) 326 title = '<h2>%s</h2>' % html_tools.html_sanitize(content['title'])
327 else: 327 else:
328 title = "" 328 title = ""
329 329
330 tags = "" 330 tags = ""
331 for tag in common.dict2iter('tag', content): 331 for tag in data_format.dict2iter('tag', content):
332 tags += "<li><a>%s</a></li>" % html_tools.html_sanitize(tag) 332 tags += "<li><a>%s</a></li>" % html_tools.html_sanitize(tag)
333 if tags: 333 if tags:
334 tags = '<ul class="mblog_tags">%s</ul>' % tags 334 tags = '<ul class="mblog_tags">%s</ul>' % tags
335 335
336 self.display.setContent({'text': "%s%s%s" % (title, tags, text)}) 336 self.display.setContent({'text': "%s%s%s" % (title, tags, text)})