ui: add forced-refresh argument to window update
This commit is contained in:
parent
9f7c7209fe
commit
2654b6bbe0
|
@ -160,7 +160,7 @@ def run_loop(startup_hook, shutdown_hook, use_tray, show_window, args=None):
|
|||
#
|
||||
|
||||
|
||||
def _status_changed(device, alert, reason):
|
||||
def _status_changed(device, alert, reason, refresh=False):
|
||||
assert device is not None
|
||||
if _log.isEnabledFor(_DEBUG):
|
||||
_log.debug('status changed: %s (%s) %s', device, alert, reason)
|
||||
|
@ -170,11 +170,11 @@ def _status_changed(device, alert, reason):
|
|||
tray.attention(reason)
|
||||
|
||||
need_popup = alert & ALERT.SHOW_WINDOW
|
||||
window.update(device, need_popup)
|
||||
window.update(device, need_popup, refresh)
|
||||
|
||||
if alert & (ALERT.NOTIFICATION | ALERT.ATTENTION):
|
||||
notify.show(device, reason)
|
||||
|
||||
|
||||
def status_changed(device, alert=ALERT.NONE, reason=None):
|
||||
GLib.idle_add(_status_changed, device, alert, reason)
|
||||
def status_changed(device, alert=ALERT.NONE, reason=None, refresh=False):
|
||||
GLib.idle_add(_status_changed, device, alert, reason, refresh)
|
||||
|
|
|
@ -840,7 +840,7 @@ def destroy(_ignore1=None, _ignore2=None):
|
|||
_model = None
|
||||
|
||||
|
||||
def update(device, need_popup=False):
|
||||
def update(device, need_popup=False, refresh=False):
|
||||
if _window is None:
|
||||
return
|
||||
|
||||
|
@ -877,7 +877,7 @@ def update(device, need_popup=False):
|
|||
item = _device_row(path, device.number, device if bool(device) else None)
|
||||
|
||||
if bool(device) and item:
|
||||
update_device(device, item, selected_device_id, need_popup)
|
||||
update_device(device, item, selected_device_id, need_popup, full=refresh)
|
||||
elif item:
|
||||
_model.remove(item)
|
||||
_config_panel.clean(device)
|
||||
|
@ -886,7 +886,7 @@ def update(device, need_popup=False):
|
|||
_tree.expand_all()
|
||||
|
||||
|
||||
def update_device(device, item, selected_device_id, need_popup):
|
||||
def update_device(device, item, selected_device_id, need_popup, full=False):
|
||||
was_online = _model.get_value(item, _COLUMN.ACTIVE)
|
||||
is_online = bool(device.online)
|
||||
_model.set_value(item, _COLUMN.ACTIVE, is_online)
|
||||
|
@ -912,5 +912,5 @@ def update_device(device, item, selected_device_id, need_popup):
|
|||
if selected_device_id is None or need_popup:
|
||||
select(device.receiver.path if device.receiver else device.path, device.number)
|
||||
elif selected_device_id == (device.receiver.path if device.receiver else device.path, device.number):
|
||||
full_update = need_popup or was_online != is_online
|
||||
full_update = full or was_online != is_online
|
||||
_update_info_panel(device, full=full_update)
|
||||
|
|
Loading…
Reference in New Issue