more reliable pairing window
This commit is contained in:
parent
61d0159e8a
commit
b5b86ab8b8
|
@ -108,4 +108,4 @@ def _unpair_device(action, frame):
|
||||||
ui.error(window, 'Unpairing failed', 'Failed to unpair device\n%s .' % device.name)
|
ui.error(window, 'Unpairing failed', 'Failed to unpair device\n%s .' % device.name)
|
||||||
|
|
||||||
def unpair(frame):
|
def unpair(frame):
|
||||||
return _action('remove', 'Unpair', _unpair_device, frame)
|
return _action('edit-delete', 'Unpair', _unpair_device, frame)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import ui
|
||||||
from logitech.unifying_receiver import status as _status
|
from logitech.unifying_receiver import status as _status
|
||||||
|
|
||||||
|
|
||||||
_RECEIVER_ICON_SIZE = Gtk.IconSize.BUTTON
|
_RECEIVER_ICON_SIZE = Gtk.IconSize.LARGE_TOOLBAR
|
||||||
_DEVICE_ICON_SIZE = Gtk.IconSize.DIALOG
|
_DEVICE_ICON_SIZE = Gtk.IconSize.DIALOG
|
||||||
_STATUS_ICON_SIZE = Gtk.IconSize.LARGE_TOOLBAR
|
_STATUS_ICON_SIZE = Gtk.IconSize.LARGE_TOOLBAR
|
||||||
_PLACEHOLDER = '~'
|
_PLACEHOLDER = '~'
|
||||||
|
@ -32,7 +32,7 @@ def _make_receiver_box(name):
|
||||||
label.set_name('label')
|
label.set_name('label')
|
||||||
label.set_alignment(0, 0.5)
|
label.set_alignment(0, 0.5)
|
||||||
|
|
||||||
pairing_icon = Gtk.Image.new_from_icon_name('network-wireless', Gtk.IconSize.MENU)
|
pairing_icon = Gtk.Image.new_from_icon_name('network-wireless', _RECEIVER_ICON_SIZE)
|
||||||
pairing_icon.set_name('pairing-icon')
|
pairing_icon.set_name('pairing-icon')
|
||||||
pairing_icon.set_tooltip_text('The pairing lock is open.')
|
pairing_icon.set_tooltip_text('The pairing lock is open.')
|
||||||
pairing_icon._tick = 0
|
pairing_icon._tick = 0
|
||||||
|
@ -40,7 +40,7 @@ def _make_receiver_box(name):
|
||||||
toolbar = Gtk.Toolbar()
|
toolbar = Gtk.Toolbar()
|
||||||
toolbar.set_name('toolbar')
|
toolbar.set_name('toolbar')
|
||||||
toolbar.set_style(Gtk.ToolbarStyle.ICONS)
|
toolbar.set_style(Gtk.ToolbarStyle.ICONS)
|
||||||
toolbar.set_icon_size(Gtk.IconSize.MENU)
|
toolbar.set_icon_size(_RECEIVER_ICON_SIZE - 1)
|
||||||
toolbar.set_show_arrow(False)
|
toolbar.set_show_arrow(False)
|
||||||
|
|
||||||
hbox = Gtk.HBox(homogeneous=False, spacing=8)
|
hbox = Gtk.HBox(homogeneous=False, spacing=8)
|
||||||
|
|
|
@ -91,7 +91,7 @@ def _prepare(assistant, page, receiver):
|
||||||
assert receiver.status.get(_status.ERROR) is None
|
assert receiver.status.get(_status.ERROR) is None
|
||||||
spinner = page.get_children()[-1]
|
spinner = page.get_children()[-1]
|
||||||
spinner.start()
|
spinner.start()
|
||||||
GObject.timeout_add(500, _check_lock_state, assistant, receiver)
|
GObject.timeout_add(2000, _check_lock_state, assistant, receiver)
|
||||||
assistant.set_page_complete(page, True)
|
assistant.set_page_complete(page, True)
|
||||||
else:
|
else:
|
||||||
GObject.idle_add(_pairing_failed, assistant, receiver, 'the pairing lock did not open')
|
GObject.idle_add(_pairing_failed, assistant, receiver, 'the pairing lock did not open')
|
||||||
|
@ -147,17 +147,15 @@ def _pairing_succeeded(assistant, receiver, device):
|
||||||
device_label = Gtk.Label()
|
device_label = Gtk.Label()
|
||||||
device_label.set_markup('<b>' + device.name + '</b>')
|
device_label.set_markup('<b>' + device.name + '</b>')
|
||||||
device_label.set_alignment(0.5, 0)
|
device_label.set_alignment(0.5, 0)
|
||||||
page.pack_start(device_label, False, False, 0)
|
page.pack_start(device_label, True, True, 0)
|
||||||
|
|
||||||
if device.status.get('encrypted') == False:
|
if device.status.get('encrypted') == False:
|
||||||
hbox = Gtk.HBox(False, 8)
|
hbox = Gtk.HBox(False, 8)
|
||||||
hbox.pack_start(Gtk.Image.new_from_icon_name('dialog-warning', Gtk.IconSize.MENU), False, False, 0)
|
hbox.pack_start(Gtk.Image.new_from_icon_name('dialog-warning', Gtk.IconSize.MENU), False, False, 0)
|
||||||
hbox.pack_start(Gtk.Label('The wireless link is not encrypted!'), False, False, 0)
|
hbox.pack_start(Gtk.Label('The wireless link is not encrypted!'), False, False, 0)
|
||||||
halign = Gtk.Alignment.new(0.5, 0, 0, 0)
|
hbox.set_property('expand', False)
|
||||||
halign.add(hbox)
|
hbox.set_property('halign', Gtk.Align.CENTER)
|
||||||
page.pack_start(halign, False, False, 0)
|
page.pack_start(hbox, False, False, 0)
|
||||||
|
|
||||||
page.pack_start(Gtk.Label(), True, True, 0)
|
|
||||||
|
|
||||||
page.show_all()
|
page.show_all()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue