Mercurial > libervia-web
comparison browser_side/panels.py @ 309:05e264e96a1c
browser_side: make unibox optional
author | souliane <souliane@mailoo.org> |
---|---|
date | Sun, 29 Dec 2013 23:07:28 +0100 |
parents | 44b46db7dfef |
children | 5d11ec1f2c22 |
comparison
equal
deleted
inserted
replaced
308:0ca441ba4317 | 309:05e264e96a1c |
---|---|
69 | 69 |
70 def __init__(self, host): | 70 def __init__(self, host): |
71 HorizontalPanel.__init__(self) | 71 HorizontalPanel.__init__(self) |
72 self.host = host | 72 self.host = host |
73 self.setStyleName('uniBoxPanel') | 73 self.setStyleName('uniBoxPanel') |
74 | 74 self.unibox = None |
75 self.button = Button ('<img src="media/icons/tango/actions/32/format-text-italic.png" class="richTextIcon"/>') | 75 |
76 self.button.setTitle('Open the rich text editor') | 76 def setUniBox(self, enable): |
77 self.button.addStyleName('uniBoxButton') | 77 """Enable or disable the unibox widget. |
78 self.add(self.button) | 78 @param enable: boolean |
79 | 79 """ |
80 self.unibox = UniBox(host) | 80 if enable: |
81 self.add(self.unibox) | 81 self.button = Button ('<img src="media/icons/tango/actions/32/format-text-italic.png" class="richTextIcon"/>') |
82 self.setCellWidth(self.unibox, '100%') | 82 self.button.setTitle('Open the rich text editor') |
83 | 83 self.button.addStyleName('uniBoxButton') |
84 self.button.addClickListener(self.openRichTextEditor) | 84 self.add(self.button) |
85 self.unibox = UniBox(self.host) | |
86 self.add(self.unibox) | |
87 self.setCellWidth(self.unibox, '100%') | |
88 self.button.addClickListener(self.openRichTextEditor) | |
89 self.unibox.addKey("@@: ") | |
90 else: | |
91 if self.unibox: | |
92 self.remove(self.unibox) | |
93 self.unibox = None | |
85 | 94 |
86 def openRichTextEditor(self): | 95 def openRichTextEditor(self): |
87 """Open the rich text editor.""" | 96 """Open the rich text editor.""" |
88 self.button.setVisible(False) | 97 self.button.setVisible(False) |
89 self.unibox.setVisible(False) | 98 self.unibox.setVisible(False) |
363 self.updated = mblog_entry.updated | 372 self.updated = mblog_entry.updated |
364 self.published = mblog_entry.published | 373 self.published = mblog_entry.published |
365 self.comments = mblog_entry.comments | 374 self.comments = mblog_entry.comments |
366 self.pub_data = (mblog_entry.hash[0], mblog_entry.hash[1], mblog_entry.id) | 375 self.pub_data = (mblog_entry.hash[0], mblog_entry.hash[1], mblog_entry.id) |
367 | 376 |
368 self.editable_content = [mblog_entry.xhtml, const._SYNTAX_XHTML] if mblog_entry.xhtml else [mblog_entry.content, None] | 377 self.editable_content = [mblog_entry.xhtml, const.SYNTAX_XHTML] if mblog_entry.xhtml else [mblog_entry.content, None] |
369 | 378 |
370 self.panel = FlowPanel() | 379 self.panel = FlowPanel() |
371 self.panel.setStyleName('mb_entry') | 380 self.panel.setStyleName('mb_entry') |
372 update_text = u" — ✍ " + "<span class='mb_entry_timestamp'>%s</span>" % datetime.fromtimestamp(self.updated) | 381 update_text = u" — ✍ " + "<span class='mb_entry_timestamp'>%s</span>" % datetime.fromtimestamp(self.updated) |
373 header = HTMLPanel("""<div class='mb_entry_header'> | 382 header = HTMLPanel("""<div class='mb_entry_header'> |
1146 | 1155 |
1147 # menu | 1156 # menu |
1148 self.menu = Menu(host) | 1157 self.menu = Menu(host) |
1149 | 1158 |
1150 # unibox | 1159 # unibox |
1151 unibox_panel = UniBoxPanel(host) | 1160 self.unibox_panel = UniBoxPanel(host) |
1152 self.host.setUniBox(unibox_panel.unibox) | |
1153 | 1161 |
1154 # status bar | 1162 # status bar |
1155 status = host.status_panel | 1163 status = host.status_panel |
1156 | 1164 |
1157 # contacts | 1165 # contacts |
1168 self.tab_panel.add(self.discuss_panel, "Discussions") | 1176 self.tab_panel.add(self.discuss_panel, "Discussions") |
1169 self.tab_panel.selectTab(0) | 1177 self.tab_panel.selectTab(0) |
1170 | 1178 |
1171 header = AbsolutePanel() | 1179 header = AbsolutePanel() |
1172 header.add(self.menu) | 1180 header.add(self.menu) |
1173 header.add(unibox_panel) | 1181 header.add(self.unibox_panel) |
1174 header.add(status) | 1182 header.add(status) |
1175 header.setStyleName('header') | 1183 header.setStyleName('header') |
1176 self.add(header) | 1184 self.add(header) |
1177 | 1185 |
1178 self._hpanel = HorizontalPanel() | 1186 self._hpanel = HorizontalPanel() |