Ignore:
Timestamp:
05/07/13 16:35:55 (12 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/document/schemeedit.py

    r11490 r11492  
    1010import logging 
    1111import itertools 
     12import unicodedata 
    1213 
    1314from operator import attrgetter 
     
    11261127 
    11271128        elif len(event.text()) and \ 
    1128                 self.__quickMenuTriggers & SchemeEditWidget.AnyKey: 
     1129                self.__quickMenuTriggers & SchemeEditWidget.AnyKey and \ 
     1130                is_printable(unicode(event.text())[0]): 
    11291131            handler = interactions.NewNodeAction(self) 
    11301132            searchText = unicode(event.text()) 
     
    15731575    for obj in objects: 
    15741576        obj.setEnabled(enable) 
     1577 
     1578 
     1579# All control character categories. 
     1580_control = set(["Cc", "Cf", "Cs", "Co", "Cn"]) 
     1581 
     1582 
     1583def is_printable(unichar): 
     1584    """ 
     1585    Return True if the unicode character `unichar` is a printable character. 
     1586    """ 
     1587    return unicodedata.category(unichar) not in _control 
Note: See TracChangeset for help on using the changeset viewer.