Mercurial > libervia-web
diff src/browser/sat_browser/base_panel.py @ 739:4545d48dee60
browser_side: improve ListPanel and TitlePanel
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 19 Nov 2015 16:42:39 +0100 |
parents | e4ae8e2b0afd |
children | f8a7a046ff9c |
line wrap: on
line diff
--- a/src/browser/sat_browser/base_panel.py Thu Nov 19 13:14:01 2015 +0100 +++ b/src/browser/sat_browser/base_panel.py Thu Nov 19 16:42:39 2015 +0100 @@ -182,18 +182,23 @@ class TitlePanel(ToggleStackPanel): """A toggle panel to set the message title""" - def __init__(self): + + TITLE = _("Title") + + def __init__(self, text=None): ToggleStackPanel.__init__(self, Width="100%") self.text_area = TextArea() - self.add(self.text_area, _("Title")) + self.add(self.text_area, self.TITLE) self.addStackChangeListener(self) + if text: + self.setText(text) def onStackChanged(self, sender, index, visible=None): if visible is None: visible = sender.getWidget(index).getVisible() - text = self.text_area.getText() + text = self.getText() suffix = "" if (visible or not text) else (": %s" % text) - sender.setStackText(index, _("Title") + suffix) + sender.setStackText(index, self.TITLE + suffix) def getText(self): return self.text_area.getText()