From ee16892481534909b20b4e60bc93512baa656678 Mon Sep 17 00:00:00 2001 From: Daniel Pavel Date: Fri, 7 Dec 2012 20:38:24 +0200 Subject: [PATCH] fixed registers access --- app/ui/__init__.py | 2 +- lib/logitech/unifying_receiver/common.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/ui/__init__.py b/app/ui/__init__.py index e64af19a..58415d8d 100644 --- a/app/ui/__init__.py +++ b/app/ui/__init__.py @@ -16,7 +16,7 @@ from . import notify, status_icon, main_window, pair_window, action from solaar import NAME _APP_ICONS = (NAME + '-init', NAME + '-fail', NAME) def appicon(receiver_status): - return (_APP_ICONS[1] if type(receiver_status) == str + return (_APP_ICONS[1] if isinstance(receiver_status, basestring) else _APP_ICONS[2] if receiver_status else _APP_ICONS[0]) diff --git a/lib/logitech/unifying_receiver/common.py b/lib/logitech/unifying_receiver/common.py index 94e82b83..986bf94a 100644 --- a/lib/logitech/unifying_receiver/common.py +++ b/lib/logitech/unifying_receiver/common.py @@ -33,14 +33,14 @@ class NamedInt(int): if isinstance(other, int): return int(self) == int(other) - if isinstance(other, str): + if isinstance(other, basestring): return self.name.lower() == other.lower() def __ne__(self, other): if isinstance(other, int): return int(self) != int(other) - if isinstance(other, str): + if isinstance(other, basestring): return self.name.lower() != other.lower() def __lt__(self, other): @@ -91,11 +91,11 @@ class NamedInts(object): raise IndexError('%s not found' % value) def __getitem__(self, index): - if type(index) == int: + if isinstance(index, int): if index in self._indexed: - return self._indexed[index] + return self._indexed[int(index)] - if self._fallback: + if self._fallback and type(index) == int: value = NamedInt(index, self._fallback(index)) self._indexed[index] = value self._values = sorted(self._values + [value])