fixed registers access

This commit is contained in:
Daniel Pavel 2012-12-07 20:38:24 +02:00
parent e2909f6165
commit ee16892481
2 changed files with 6 additions and 6 deletions

View File

@ -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])

View File

@ -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])