some clean-ups

This commit is contained in:
Daniel Pavel 2012-11-30 15:20:41 +02:00
parent ab5e09db93
commit 64d2b35ace
5 changed files with 9 additions and 7 deletions

View File

@ -56,9 +56,10 @@ def _run(args):
import ui
# even if --no-notifications is given on the command line, still have to
# check they are available
# check they are available, and decide whether to put the option in the
# systray icon
args.notifications &= args.systray
if ui.notify.init(NAME):
if args.systray and ui.notify.init(NAME):
ui.action.toggle_notifications.set_active(args.notifications)
if not args.notifications:
ui.notify.uninit()

View File

@ -22,7 +22,6 @@ class NamedInt(int):
return _pack('!L', value)[-count:]
def __str__(self):
return self.name

View File

@ -72,7 +72,7 @@ class ThreadedHandle(object):
return str(int(self))
def __repr__(self):
return '<ThreadedHandle[%s]>' % self.path
return '<ThreadedHandle(%s)>' % self.path
def __bool__(self):
return bool(self._local)

View File

@ -153,7 +153,8 @@ class PairedDevice(object):
return self.receiver == other.receiver and self.number == other.number
def __str__(self):
return '<PairedDevice(%s,%d,%s)>' % (self.receiver, self.number, self.codename or '?')
return '<PairedDevice(%d,%s)>' % (self.number, self.codename or '?')
__repr__ = __str__
#
#
@ -301,7 +302,8 @@ class Receiver(object):
return self.__contains__(dev.number)
def __str__(self):
return '<Receiver(%s,%s)>' % (self.handle, self.path)
return '<Receiver(%s,%s%s)>' % (self.path, '' if type(self.handle) == int else 'T', self.handle)
__repr__ = __str__
__bool__ = __nonzero__ = lambda self: self.handle is not None

View File

@ -247,4 +247,4 @@ class DeviceStatus(dict):
_log.debug("TOUCH MOUSE status: button_down=%s mouse_lifted=%s", button_down, mouse_lifted)
return True
_log.warn("don't know how to handle event %s", event)
_log.warn("don't know how to handle event %s for feature %s", event, feature)