mirror of
https://github.com/jtgans/g13gui.git
synced 2025-06-20 00:14:09 -04:00
observer: Coerce scalar values in keys to sets
Unfortunately, strings are iterable in python, so without this a call with a single string, or a construct of "('foo')" would result in creating keys for each letter of the string 'foo'. "('foo',)" works, because , creates the tuple, not the parens...
This commit is contained in:
parent
4d11270a7c
commit
003ab3b526
@ -11,6 +11,8 @@ class Observer(object):
|
|||||||
def _makeChangeTriggerKeys(self, changeType, keys):
|
def _makeChangeTriggerKeys(self, changeType, keys):
|
||||||
result = []
|
result = []
|
||||||
if keys != Subject.AllKeys:
|
if keys != Subject.AllKeys:
|
||||||
|
if type(keys) != set:
|
||||||
|
keys = {keys}
|
||||||
for key in keys:
|
for key in keys:
|
||||||
result.append((changeType, key))
|
result.append((changeType, key))
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user