Skip to content

Commit

Permalink
status icons updated, removed all Logitech images
Browse files Browse the repository at this point in the history
  • Loading branch information
pwr committed Oct 13, 2012
1 parent d880c41 commit cccf269
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 8 deletions.
20 changes: 15 additions & 5 deletions app/ui/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
from logitech.devices import constants as C


_SMALL_DEVICE_ICON_SIZE = Gtk.IconSize.BUTTON
_DEVICE_ICON_SIZE = Gtk.IconSize.DIALOG
_STATUS_ICON_SIZE = Gtk.IconSize.DND
_PLACEHOLDER = '~'


theme = Gtk.IconTheme.get_default()


def _find_children(container, *child_names):
def _iterate_children(widget, names, result, count):
wname = widget.get_name()
Expand Down Expand Up @@ -53,18 +57,23 @@ def _update_device_box(frame, devstatus):
frame.set_visible(True)
if frame.get_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)
label.set_markup('<b>' + devstatus.name + '</b>')

status = _find_children(frame, 'status')
if devstatus.code < C.STATUS.CONNECTED:
icon.set_sensitive(False)
icon.set_tooltip_text(devstatus.text)
label.set_sensitive(False)
status.set_visible(False)
return

icon.set_sensitive(True)
icon.set_tooltip_text('')
label.set_sensitive(True)
status.set_visible(True)
status_icons = status.get_children()
Expand All @@ -78,7 +87,7 @@ def _update_device_box(frame, devstatus):
battery_label.set_text('')
else:
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_label.set_sensitive(True)
battery_label.set_text('%d%%' % battery_level)
Expand All @@ -96,7 +105,7 @@ def _update_device_box(frame, devstatus):
light_label.set_visible(False)
else:
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_label.set_visible(True)
light_label.set_text('%d lux' % light_level)
Expand All @@ -120,10 +129,11 @@ def _device_box(name=None, has_status_icons=True, has_frame=True):

icon = Gtk.Image()
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_padding(2, 2)
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_name('icon')
box.pack_start(icon, False, False, 0)
Expand Down
6 changes: 3 additions & 3 deletions share/README
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Battery and weather icons from the Oxygen icon theme.
Lightbulb icon from the GNOME icon theme.
Unifying receiver and Wireless Keyboard K750 icons from Logitech web pages.
Solaar application icon drawn by me, roughly guided by Logitech's Unifying logo.

All other images are from the GNOME and Oxygen free icon themes.
Binary file modified share/icons/hicolor/128x128/apps/Solaar-fail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified share/icons/hicolor/128x128/apps/Solaar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified share/icons/hicolor/128x128/devices/Unifying Receiver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cccf269

Please sign in to comment.