1. biolab
  2. Untitled project
  3. orange

Commits

Aleš Erjavec  committed 30c1378

Do not show the menu on a key press if the key is a control character.

  • Participants
  • Parent commits d8183bc
  • Branches default

Comments (0)

Files changed (1)

File Orange/OrangeCanvas/document/schemeedit.py

View file
  • Ignore whitespace
 import sys
 import logging
 import itertools
+import unicodedata
 
 from operator import attrgetter
 from contextlib import nested
             handler = interactions.NewNodeAction(self)
 
         elif len(event.text()) and \
-                self.__quickMenuTriggers & SchemeEditWidget.AnyKey:
+                self.__quickMenuTriggers & SchemeEditWidget.AnyKey and \
+                is_printable(unicode(event.text())[0]):
             handler = interactions.NewNodeAction(self)
             searchText = unicode(event.text())
 
     """
     for obj in objects:
         obj.setEnabled(enable)
+
+
+# All control character categories.
+_control = set(["Cc", "Cf", "Cs", "Co", "Cn"])
+
+
+def is_printable(unichar):
+    """
+    Return True if the unicode character `unichar` is a printable character.
+    """
+    return unicodedata.category(unichar) not in _control