Simplify unicodedata.category calls
This commit is contained in:
parent
63e05e12ba
commit
0aa17bfa33
@ -236,8 +236,7 @@ class KeyInfo:
|
|||||||
key_string = _key_to_string(self.key)
|
key_string = _key_to_string(self.key)
|
||||||
|
|
||||||
if is_printable(self.key) and self.key != Qt.Key_Space:
|
if is_printable(self.key) and self.key != Qt.Key_Space:
|
||||||
category = unicodedata.category(key_string)
|
is_special_char = unicodedata.category(key_string) == 'Cc'
|
||||||
is_special_char = (category == 'Cc')
|
|
||||||
else:
|
else:
|
||||||
is_special_char = False
|
is_special_char = False
|
||||||
|
|
||||||
@ -394,7 +393,7 @@ class KeySequence:
|
|||||||
|
|
||||||
if (modifiers == Qt.ShiftModifier and
|
if (modifiers == Qt.ShiftModifier and
|
||||||
is_printable(ev.key()) and
|
is_printable(ev.key()) and
|
||||||
unicodedata.category(ev.text()) != 'Lu'):
|
not ev.text().isupper()):
|
||||||
modifiers = Qt.KeyboardModifiers()
|
modifiers = Qt.KeyboardModifiers()
|
||||||
|
|
||||||
keys = list(self._iter_keys())
|
keys = list(self._iter_keys())
|
||||||
|
Loading…
Reference in New Issue
Block a user