Mercurial > libervia-web
comparison src/browser/sat_browser/blog.py @ 773:08aa9acc8367
browser_side (blog): hide the entry icons while editing
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 26 Nov 2015 19:55:55 +0100 |
parents | 2970b8af3cd7 |
children | 734e59ba74a7 |
comparison
equal
deleted
inserted
replaced
772:2970b8af3cd7 | 773:08aa9acc8367 |
---|---|
192 | 192 |
193 @param editable (bool) | 193 @param editable (bool) |
194 """ | 194 """ |
195 self.editable = editable | 195 self.editable = editable |
196 self.bubble.edit(self.editable) | 196 self.bubble.edit(self.editable) |
197 self.updateSyntaxSwitchButton() | 197 self.updateIconsAndButtons() |
198 | 198 |
199 def updateSyntaxSwitchButton(self): | 199 def updateIconsAndButtons(self): |
200 """Set the visibility of the button to switch between blog and microblog.""" | 200 """Set the visibility of the icons and the button to switch between blog and microblog.""" |
201 try: | 201 try: |
202 self.bubble_commands.removeFromParent() | 202 self.bubble_commands.removeFromParent() |
203 except (AttributeError, TypeError): | 203 except (AttributeError, TypeError): |
204 pass | 204 pass |
205 if self.editable: | 205 if self.editable: |
226 self.bubble_commands.add(publish_button) | 226 self.bubble_commands.add(publish_button) |
227 | 227 |
228 self.bubble_commands.add(toggle_syntax_button) | 228 self.bubble_commands.add(toggle_syntax_button) |
229 self.entry_dialog.add(self.bubble_commands) | 229 self.entry_dialog.add(self.bubble_commands) |
230 | 230 |
231 # hide these icons while editing | |
232 try: | |
233 self.delete_label.setVisible(not self.editable) | |
234 except (TypeError, AttributeError): | |
235 pass | |
236 try: | |
237 self.update_label.setVisible(not self.editable) | |
238 except (TypeError, AttributeError): | |
239 pass | |
240 try: | |
241 self.comment_label.setVisible(not self.editable) | |
242 except (TypeError, AttributeError): | |
243 pass | |
231 | 244 |
232 def onClick(self, sender): | 245 def onClick(self, sender): |
233 if sender == self: | 246 if sender == self: |
234 self.blog.setSelectedEntry(self) | 247 self.blog.setSelectedEntry(self) |
235 elif sender == self.delete_label: | 248 elif sender == self.delete_label: |
284 else: | 297 else: |
285 # we don't keep edit entries for comments | 298 # we don't keep edit entries for comments |
286 self.delete() | 299 self.delete() |
287 else: | 300 else: |
288 self.editable = False | 301 self.editable = False |
289 self.updateSyntaxSwitchButton() | 302 self.updateIconsAndButtons() |
290 | 303 |
291 def _showWarning(self, sender, keycode, modifiers): | 304 def _showWarning(self, sender, keycode, modifiers): |
292 if keycode == keyb.KEY_ENTER & keyb.MODIFIER_SHIFT: # FIXME: fix edit_listeners, it's dirty (we have to check keycode/modifiers twice !) | 305 if keycode == keyb.KEY_ENTER & keyb.MODIFIER_SHIFT: # FIXME: fix edit_listeners, it's dirty (we have to check keycode/modifiers twice !) |
293 self.blog.host.showWarning(None, None) | 306 self.blog.host.showWarning(None, None) |
294 else: | 307 else: |