Mercurial > libervia-web
comparison browser_side/richtext.py @ 346:82f9e92379b0
browser_side: move TitlePanel from richtext.py to base_panels.py
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 07 Feb 2014 20:08:28 +0100 |
parents | ce5b33f499c5 |
children | c943fd54c90e |
comparison
equal
deleted
inserted
replaced
345:2109d7d30ffc | 346:82f9e92379b0 |
---|---|
24 from pyjamas.ui.HTML import HTML | 24 from pyjamas.ui.HTML import HTML |
25 from pyjamas.ui.FlexTable import FlexTable | 25 from pyjamas.ui.FlexTable import FlexTable |
26 from pyjamas.ui.HorizontalPanel import HorizontalPanel | 26 from pyjamas.ui.HorizontalPanel import HorizontalPanel |
27 | 27 |
28 from dialog import ConfirmDialog, InfoDialog | 28 from dialog import ConfirmDialog, InfoDialog |
29 from base_panels import ToggleStackPanel | 29 from base_panels import TitlePanel |
30 from list_manager import ListManager | 30 from list_manager import ListManager |
31 | 31 |
32 from sat_frontends.tools import composition | 32 from sat_frontends.tools import composition |
33 from sat.core.i18n import _ | |
34 | 33 |
35 # used for onCloseCallback | 34 # used for onCloseCallback |
36 CANCEL, SYNC_NOT_SAVE, SAVE = xrange(0, 3) | 35 CANCEL, SYNC_NOT_SAVE, SAVE = xrange(0, 3) |
37 | 36 |
38 | 37 |
329 ListManager.__init__(self, parent, composition.RECIPIENT_TYPES, list_, {'y': y_offset}) | 328 ListManager.__init__(self, parent, composition.RECIPIENT_TYPES, list_, {'y': y_offset}) |
330 | 329 |
331 self.registerPopupMenuPanel(entries=composition.RECIPIENT_TYPES, | 330 self.registerPopupMenuPanel(entries=composition.RECIPIENT_TYPES, |
332 hide=lambda sender, key: self.__children[key]["panel"].isVisible(), | 331 hide=lambda sender, key: self.__children[key]["panel"].isVisible(), |
333 callback=self.setContactPanelVisible) | 332 callback=self.setContactPanelVisible) |
334 | |
335 | |
336 class TitlePanel(ToggleStackPanel): | |
337 """A toggle panel to set the message title""" | |
338 def __init__(self): | |
339 ToggleStackPanel.__init__(self, Width="100%") | |
340 self.text_area = TextArea() | |
341 self.add(self.text_area, _("Title")) | |
342 self.addStackChangeListener(self) | |
343 | |
344 def onStackChanged(self, sender, index, visible=None): | |
345 if visible is None: | |
346 visible = sender.getWidget(index).getVisible() | |
347 text = self.text_area.getText() | |
348 suffix = "" if (visible or not text) else (": %s" % text) | |
349 sender.setStackText(index, _("Title") + suffix) |