status icons updated, removed all Logitech images
|
|
@ -7,11 +7,15 @@ from gi.repository import (Gtk, Gdk)
|
||||||
from logitech.devices import constants as C
|
from logitech.devices import constants as C
|
||||||
|
|
||||||
|
|
||||||
|
_SMALL_DEVICE_ICON_SIZE = Gtk.IconSize.BUTTON
|
||||||
_DEVICE_ICON_SIZE = Gtk.IconSize.DIALOG
|
_DEVICE_ICON_SIZE = Gtk.IconSize.DIALOG
|
||||||
_STATUS_ICON_SIZE = Gtk.IconSize.DND
|
_STATUS_ICON_SIZE = Gtk.IconSize.DND
|
||||||
_PLACEHOLDER = '~'
|
_PLACEHOLDER = '~'
|
||||||
|
|
||||||
|
|
||||||
|
theme = Gtk.IconTheme.get_default()
|
||||||
|
|
||||||
|
|
||||||
def _find_children(container, *child_names):
|
def _find_children(container, *child_names):
|
||||||
def _iterate_children(widget, names, result, count):
|
def _iterate_children(widget, names, result, count):
|
||||||
wname = widget.get_name()
|
wname = widget.get_name()
|
||||||
|
|
@ -53,18 +57,23 @@ def _update_device_box(frame, devstatus):
|
||||||
frame.set_visible(True)
|
frame.set_visible(True)
|
||||||
if frame.get_name() != devstatus.name:
|
if frame.get_name() != devstatus.name:
|
||||||
frame.set_name(devstatus.name)
|
frame.set_name(devstatus.name)
|
||||||
icon.set_from_icon_name(devstatus.name, _DEVICE_ICON_SIZE)
|
if theme.has_icon(devstatus.name):
|
||||||
|
icon.set_from_icon_name(devstatus.name, _DEVICE_ICON_SIZE)
|
||||||
|
else:
|
||||||
|
icon.set_from_icon_name(devstatus.type.lower(), _DEVICE_ICON_SIZE)
|
||||||
icon.set_tooltip_text(devstatus.name)
|
icon.set_tooltip_text(devstatus.name)
|
||||||
label.set_markup('<b>' + devstatus.name + '</b>')
|
label.set_markup('<b>' + devstatus.name + '</b>')
|
||||||
|
|
||||||
status = _find_children(frame, 'status')
|
status = _find_children(frame, 'status')
|
||||||
if devstatus.code < C.STATUS.CONNECTED:
|
if devstatus.code < C.STATUS.CONNECTED:
|
||||||
icon.set_sensitive(False)
|
icon.set_sensitive(False)
|
||||||
|
icon.set_tooltip_text(devstatus.text)
|
||||||
label.set_sensitive(False)
|
label.set_sensitive(False)
|
||||||
status.set_visible(False)
|
status.set_visible(False)
|
||||||
return
|
return
|
||||||
|
|
||||||
icon.set_sensitive(True)
|
icon.set_sensitive(True)
|
||||||
|
icon.set_tooltip_text('')
|
||||||
label.set_sensitive(True)
|
label.set_sensitive(True)
|
||||||
status.set_visible(True)
|
status.set_visible(True)
|
||||||
status_icons = status.get_children()
|
status_icons = status.get_children()
|
||||||
|
|
@ -78,7 +87,7 @@ def _update_device_box(frame, devstatus):
|
||||||
battery_label.set_text('')
|
battery_label.set_text('')
|
||||||
else:
|
else:
|
||||||
battery_icon.set_sensitive(True)
|
battery_icon.set_sensitive(True)
|
||||||
icon_name = 'battery_%02d' % (20 * ((battery_level + 10) // 20))
|
icon_name = 'battery_%03d' % (20 * ((battery_level + 10) // 20))
|
||||||
battery_icon.set_from_icon_name(icon_name, _STATUS_ICON_SIZE)
|
battery_icon.set_from_icon_name(icon_name, _STATUS_ICON_SIZE)
|
||||||
battery_label.set_sensitive(True)
|
battery_label.set_sensitive(True)
|
||||||
battery_label.set_text('%d%%' % battery_level)
|
battery_label.set_text('%d%%' % battery_level)
|
||||||
|
|
@ -96,7 +105,7 @@ def _update_device_box(frame, devstatus):
|
||||||
light_label.set_visible(False)
|
light_label.set_visible(False)
|
||||||
else:
|
else:
|
||||||
light_icon.set_visible(True)
|
light_icon.set_visible(True)
|
||||||
icon_name = 'light_%02d' % (20 * ((light_level + 50) // 100))
|
icon_name = 'light_%03d' % (20 * ((light_level + 50) // 100))
|
||||||
light_icon.set_from_icon_name(icon_name, _STATUS_ICON_SIZE)
|
light_icon.set_from_icon_name(icon_name, _STATUS_ICON_SIZE)
|
||||||
light_label.set_visible(True)
|
light_label.set_visible(True)
|
||||||
light_label.set_text('%d lux' % light_level)
|
light_label.set_text('%d lux' % light_level)
|
||||||
|
|
@ -120,10 +129,11 @@ def _device_box(name=None, has_status_icons=True, has_frame=True):
|
||||||
|
|
||||||
icon = Gtk.Image()
|
icon = Gtk.Image()
|
||||||
if name:
|
if name:
|
||||||
icon.set_from_icon_name(name, _DEVICE_ICON_SIZE)
|
icon.set_from_icon_name(name, _SMALL_DEVICE_ICON_SIZE)
|
||||||
icon.set_tooltip_text(name)
|
icon.set_tooltip_text(name)
|
||||||
|
icon.set_padding(2, 2)
|
||||||
else:
|
else:
|
||||||
icon.set_from_icon_name('dialog-question', _DEVICE_ICON_SIZE)
|
icon.set_from_icon_name('image-missing', _DEVICE_ICON_SIZE)
|
||||||
icon.set_alignment(0.5, 0)
|
icon.set_alignment(0.5, 0)
|
||||||
icon.set_name('icon')
|
icon.set_name('icon')
|
||||||
box.pack_start(icon, False, False, 0)
|
box.pack_start(icon, False, False, 0)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
Battery and weather icons from the Oxygen icon theme.
|
Solaar application icon drawn by me, roughly guided by Logitech's Unifying logo.
|
||||||
Lightbulb icon from the GNOME icon theme.
|
|
||||||
Unifying receiver and Wireless Keyboard K750 icons from Logitech web pages.
|
All other images are from the GNOME and Oxygen free icon themes.
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 2.4 KiB |