added more known device names and kinds
This commit is contained in:
parent
fb8cf26c51
commit
13a11e78f0
|
@ -85,26 +85,7 @@ if __name__ == '__main__':
|
||||||
listener = None
|
listener = None
|
||||||
notify_missing = True
|
notify_missing = True
|
||||||
|
|
||||||
def status_changed(receiver, device=None, ui_flags=0):
|
# initializes the receiver listener
|
||||||
assert receiver is not None
|
|
||||||
if window:
|
|
||||||
GObject.idle_add(ui.main_window.update, window, receiver, device)
|
|
||||||
if icon:
|
|
||||||
GObject.idle_add(ui.status_icon.update, icon, receiver)
|
|
||||||
if ui_flags & STATUS.UI_POPUP:
|
|
||||||
GObject.idle_add(window.popup, icon)
|
|
||||||
|
|
||||||
if device is None:
|
|
||||||
# always notify on receiver updates
|
|
||||||
ui_flags |= STATUS.UI_NOTIFY
|
|
||||||
if ui_flags & STATUS.UI_NOTIFY and ui.notify.available:
|
|
||||||
GObject.idle_add(ui.notify.show, device or receiver)
|
|
||||||
|
|
||||||
global listener
|
|
||||||
if not listener:
|
|
||||||
GObject.timeout_add(5000, check_for_listener)
|
|
||||||
listener = None
|
|
||||||
|
|
||||||
from receiver import ReceiverListener
|
from receiver import ReceiverListener
|
||||||
def check_for_listener(retry=True):
|
def check_for_listener(retry=True):
|
||||||
def _check_still_scanning(listener):
|
def _check_still_scanning(listener):
|
||||||
|
@ -134,6 +115,28 @@ if __name__ == '__main__':
|
||||||
pairing.state = pairing.State(listener)
|
pairing.state = pairing.State(listener)
|
||||||
listener.trigger_device_events()
|
listener.trigger_device_events()
|
||||||
|
|
||||||
|
# callback delivering status events from the receiver/devices to the UI
|
||||||
|
def status_changed(receiver, device=None, ui_flags=0):
|
||||||
|
assert receiver is not None
|
||||||
|
if window:
|
||||||
|
GObject.idle_add(ui.main_window.update, window, receiver, device)
|
||||||
|
if icon:
|
||||||
|
GObject.idle_add(ui.status_icon.update, icon, receiver)
|
||||||
|
if ui_flags & STATUS.UI_POPUP:
|
||||||
|
GObject.idle_add(window.popup, icon)
|
||||||
|
|
||||||
|
if device is None:
|
||||||
|
# always notify on receiver updates
|
||||||
|
ui_flags |= STATUS.UI_NOTIFY
|
||||||
|
if ui_flags & STATUS.UI_NOTIFY and ui.notify.available:
|
||||||
|
GObject.idle_add(ui.notify.show, device or receiver)
|
||||||
|
|
||||||
|
global listener
|
||||||
|
if not listener:
|
||||||
|
GObject.timeout_add(5000, check_for_listener)
|
||||||
|
listener = None
|
||||||
|
|
||||||
|
# clears all properties of devices that have been inactive for too long
|
||||||
_DEVICE_TIMEOUT = 3 * 60 # seconds
|
_DEVICE_TIMEOUT = 3 * 60 # seconds
|
||||||
_DEVICE_STATUS_CHECK = 30 # seconds
|
_DEVICE_STATUS_CHECK = 30 # seconds
|
||||||
from time import time as _timestamp
|
from time import time as _timestamp
|
||||||
|
|
|
@ -44,11 +44,12 @@ def _show_about_window(action):
|
||||||
about.set_logo_icon_name(_NAME)
|
about.set_logo_icon_name(_NAME)
|
||||||
about.set_version(_VERSION)
|
about.set_version(_VERSION)
|
||||||
about.set_license_type(Gtk.License.GPL_2_0)
|
about.set_license_type(Gtk.License.GPL_2_0)
|
||||||
|
about.set_copyright('\xC2\xA9 2012 Daniel Pavel')
|
||||||
about.set_authors(('Daniel Pavel http://github.com/pwr',))
|
about.set_authors(('Daniel Pavel http://github.com/pwr',))
|
||||||
# about.add_credit_section('Testing', 'Douglas Wagner')
|
# about.add_credit_section('Testing', 'Douglas Wagner')
|
||||||
about.set_website('http://github.com/pwr/Solaar/wiki')
|
about.set_website('http://github.com/pwr/Solaar/wiki')
|
||||||
about.set_website_label('Solaar Wiki')
|
about.set_website_label('Solaar Wiki')
|
||||||
# about.set_comments('Using Python %s\n' % PYTTHON_VERSION.split(' ')[0])
|
about.set_comments('Shows status of devices connected\nto a Logitech Unifying Receiver.')
|
||||||
about.run()
|
about.run()
|
||||||
about.destroy()
|
about.destroy()
|
||||||
about = _action('help-about', 'About ' + _NAME, _show_about_window)
|
about = _action('help-about', 'About ' + _NAME, _show_about_window)
|
||||||
|
@ -65,7 +66,6 @@ def _pair_device(action, frame):
|
||||||
window = frame.get_toplevel()
|
window = frame.get_toplevel()
|
||||||
|
|
||||||
pair_dialog = ui.pair_window.create(action, pairing.state)
|
pair_dialog = ui.pair_window.create(action, pairing.state)
|
||||||
# window.present()
|
|
||||||
|
|
||||||
pair_dialog.set_transient_for(window)
|
pair_dialog.set_transient_for(window)
|
||||||
pair_dialog.set_modal(True)
|
pair_dialog.set_modal(True)
|
||||||
|
|
|
@ -37,14 +37,22 @@ PROPS = type('PROPS', (),
|
||||||
NAMES = {
|
NAMES = {
|
||||||
'M315': ('Wireless Mouse M315', 'mouse'),
|
'M315': ('Wireless Mouse M315', 'mouse'),
|
||||||
'M325': ('Wireless Mouse M325', 'mouse'),
|
'M325': ('Wireless Mouse M325', 'mouse'),
|
||||||
|
'M505': ('Wireless Mouse M505', 'mouse'),
|
||||||
'M510': ('Wireless Mouse M510', 'mouse'),
|
'M510': ('Wireless Mouse M510', 'mouse'),
|
||||||
'M515': ('Couch Mouse M515', 'mouse'),
|
'M515': ('Couch Mouse M515', 'mouse'),
|
||||||
'M525': ('Wireless Mouse M525', 'mouse'),
|
'M525': ('Wireless Mouse M525', 'mouse'),
|
||||||
'M570': ('Wireless Trackball M570', 'trackball'),
|
'M570': ('Wireless Trackball M570', 'trackball'),
|
||||||
|
'M600': ('Touch Mouse M600', 'mouse'),
|
||||||
|
'M705': ('Marathon Mouse M705', 'mouse'),
|
||||||
'K270': ('Wireless Keyboard K270', 'keyboard'),
|
'K270': ('Wireless Keyboard K270', 'keyboard'),
|
||||||
'K350': ('Wireless Keyboard K350', 'keyboard'),
|
'K350': ('Wireless Keyboard K350', 'keyboard'),
|
||||||
|
'K360': ('Wireless Keyboard K360', 'keyboard'),
|
||||||
|
'K400': ('Wireless Touch Keyboard K400', 'keyboard'),
|
||||||
'K750': ('Wireless Solar Keyboard K750', 'keyboard'),
|
'K750': ('Wireless Solar Keyboard K750', 'keyboard'),
|
||||||
'K800': ('Wireless Illuminated Keyboard K800', 'keyboard'),
|
'K800': ('Wireless Illuminated Keyboard K800', 'keyboard'),
|
||||||
|
'T400': ('Zone Touch Mouse T400', 'mouse'),
|
||||||
'T650': ('Wireless Rechargeable Touchpad T650', 'touchpad'),
|
'T650': ('Wireless Rechargeable Touchpad T650', 'touchpad'),
|
||||||
|
'Cube': ('Logitech Cube', 'mouse'),
|
||||||
|
'Anywhere MX': ('Anywhere Mouse MX', 'mouse'),
|
||||||
'Performance MX': ('Performance Mouse MX', 'mouse'),
|
'Performance MX': ('Performance Mouse MX', 'mouse'),
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@ import logging
|
||||||
from struct import unpack as _unpack
|
from struct import unpack as _unpack
|
||||||
|
|
||||||
from .constants import (STATUS, PROPS)
|
from .constants import (STATUS, PROPS)
|
||||||
from ..unifying_receiver.constants import FEATURE
|
|
||||||
from ..unifying_receiver import api as _api
|
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -29,6 +27,8 @@ def _charge_status(data, hasLux=False):
|
||||||
|
|
||||||
|
|
||||||
def request_status(devinfo):
|
def request_status(devinfo):
|
||||||
|
from ..unifying_receiver.constants import FEATURE
|
||||||
|
from ..unifying_receiver import api as _api
|
||||||
reply = _api.request(devinfo.handle, devinfo.number,
|
reply = _api.request(devinfo.handle, devinfo.number,
|
||||||
feature=FEATURE.SOLAR_CHARGE, function=b'\x06', params=b'\x78\x01',
|
feature=FEATURE.SOLAR_CHARGE, function=b'\x06', params=b'\x78\x01',
|
||||||
features=devinfo.features)
|
features=devinfo.features)
|
||||||
|
|
|
@ -73,7 +73,7 @@ class ThreadedHandle(object):
|
||||||
return str(int(self))
|
return str(int(self))
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<LocalHandle[%s]>' % self.path
|
return '<ThreadedHandle[%s]>' % self.path
|
||||||
|
|
||||||
def __bool__(self):
|
def __bool__(self):
|
||||||
return bool(self._handles)
|
return bool(self._handles)
|
||||||
|
|
Loading…
Reference in New Issue