changeset 838:ab87da500820

browser: validate the status with ENTER (fixes bug 111)
author souliane <souliane@mailoo.org>
date Tue, 12 Jan 2016 20:34:20 +0100
parents 620306b3d5be
children 09ace5cbcb9b
files src/browser/sat_browser/editor_widget.py src/browser/sat_browser/main_panel.py
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/editor_widget.py	Tue Jan 12 20:24:30 2016 +0100
+++ b/src/browser/sat_browser/editor_widget.py	Tue Jan 12 20:34:20 2016 +0100
@@ -226,6 +226,7 @@
     """Base class for manage a simple text editor."""
 
     CONVERT_NEW_LINES = True
+    VALIDATE_WITH_SHIFT_ENTER = True
 
     def __init__(self, content=None, modifiedCb=None, afterEditCb=None, options=None):
         """
@@ -303,7 +304,7 @@
             listener(self.textarea, keycode, modifiers) # FIXME: edit_listeners must either be removed, or send an action instead of keycode/modifiers
         if not self.options['listen_keyboard']:
             return
-        if keycode == keyb.KEY_ENTER and modifiers & keyb.MODIFIER_SHIFT:
+        if keycode == keyb.KEY_ENTER and (not self.VALIDATE_WITH_SHIFT_ENTER or modifiers & keyb.MODIFIER_SHIFT):
             self.textarea.setFocus(False)
             if not self.options['listen_focus']:
                 self.edit(False)
--- a/src/browser/sat_browser/main_panel.py	Tue Jan 12 20:24:30 2016 +0100
+++ b/src/browser/sat_browser/main_panel.py	Tue Jan 12 20:34:20 2016 +0100
@@ -125,6 +125,7 @@
 class StatusPanel(editor_widget.HTMLTextEditor):
 
     EMPTY_STATUS = '&lt;click to set a status&gt;'
+    VALIDATE_WITH_SHIFT_ENTER = False
 
     def __init__(self, host, status=''):
         self.host = host