Merge branch 'nano' into 0.9
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
This commit is contained in:
parent
00a1aa7628
commit
581d6747ad
|
@ -4,3 +4,4 @@
|
|||
* Fix identifying available dpi values.
|
||||
* Fixed locating application icons when installed in a custom prefix.
|
||||
* Fixed some icon names for the oxygen theme.
|
||||
* Python 3 fixes.
|
||||
|
|
|
@ -17,7 +17,7 @@ class NamedInt(int):
|
|||
def __new__(cls, value, name):
|
||||
assert isinstance(name, str) or isinstance(name, unicode)
|
||||
obj = int.__new__(cls, value)
|
||||
obj.name = unicode(name)
|
||||
obj.name = str(name)
|
||||
return obj
|
||||
|
||||
def bytes(self, count=2):
|
||||
|
@ -66,7 +66,8 @@ class NamedInts(object):
|
|||
def _readable_name(n):
|
||||
if not isinstance(n, str) and not isinstance(n, unicode):
|
||||
raise TypeError("expected string, got " + type(n))
|
||||
return n.replace('__', '/').replace('_', ' ')
|
||||
n = n.replace('__', '/').replace('_', ' ')
|
||||
return str(n)
|
||||
|
||||
values = {k: NamedInt(v, _readable_name(k)) for (k, v) in kwargs.items()}
|
||||
self.__dict__ = values
|
||||
|
@ -74,6 +75,8 @@ class NamedInts(object):
|
|||
self._indexed = {int(v): v for v in self._values}
|
||||
self._fallback = None
|
||||
|
||||
# print ('%r' % self)
|
||||
|
||||
@classmethod
|
||||
def range(cls, from_value, to_value, name_generator=lambda x: str(x), step=1):
|
||||
values = {name_generator(x): x for x in range(from_value, to_value + 1, step)}
|
||||
|
|
|
@ -253,7 +253,7 @@ def config_device(receiver, args):
|
|||
if s.choices:
|
||||
print ("# possible values: one of [", ', '.join(str(v) for v in s.choices), "], or higher/lower/highest/max/lowest/min")
|
||||
else:
|
||||
print ("# possible values: true/t/yes/y/1 or false/f/no/n/0")
|
||||
print ("# possible values: on/true/t/yes/y/1 or off/false/f/no/n/0")
|
||||
value = s.read()
|
||||
if value is None:
|
||||
print ("# %s = ? (failed to read from device)" % s.name)
|
||||
|
@ -283,9 +283,9 @@ def config_device(receiver, args):
|
|||
try:
|
||||
value = bool(int(value))
|
||||
except:
|
||||
if value.lower() in ['1', 'true', 'yes', 't', 'y']:
|
||||
if value.lower() in ['1', 'true', 'yes', 'on', 't', 'y']:
|
||||
value = True
|
||||
elif value.lower() in ['0', 'false', 'no', 'f', 'n']:
|
||||
elif value.lower() in ['0', 'false', 'no', 'off', 'f', 'n']:
|
||||
value = False
|
||||
else:
|
||||
_fail("don't know how to interpret '%s' as boolean" % value)
|
||||
|
|
Loading…
Reference in New Issue