Support icon themes in WICD -- we still miss most sizes for most icons, but it's a start.

This commit is contained in:
David Paleino committed 2012-11-15 16:38:06 +01:00
1 parent 882c295982
commit 6ba96c6c52
85 files changed
+43 -43

No files matched your search

+26 -27
View File
@@ -85,6 +85,9 @@ if __name__ == '__main__':
daemon = wireless = wired = lost_dbus_id = None
DBUS_AVAIL = False
theme = gtk.icon_theme_get_default()
theme.append_search_path(wpath.images)
def catchdbus(func):
def wrapper(*args, **kwargs):
try:
@@ -261,7 +264,7 @@ class TrayIcon(object):
wired_ip = info[0]
self.network_addr = str(info[0])
self.network_type = "wired"
self.tr.set_from_file(os.path.join(wpath.images, "wired.png"))
self.tr.set_from_name('wired')
# status_string = _('Connected to wired network (IP: $A)').replace('$A',
#wired_ip)
# self.tr.set_tooltip(status_string)
@@ -314,7 +317,7 @@ class TrayIcon(object):
cur_network + "..."
self.update_tooltip()
# self.tr.set_tooltip(status_string)
self.tr.set_from_file(os.path.join(wpath.images, "no-signal.png"))
self.tr.set_from_name('no-signal')
if wired:
self._show_notification(cur_network,
_('Establishing connection...'),
@@ -328,7 +331,7 @@ class TrayIcon(object):
@catchdbus
def set_not_connected_state(self, info=None):
""" Set the icon info for the not connected state. """
self.tr.set_from_file(wpath.images + "no-signal.png")
self.tr.set_from_name('no-signal')
if not DBUS_AVAIL:
status = _('Wicd daemon unreachable')
elif wireless.GetKillSwitchEnabled():
@@ -393,9 +396,8 @@ class TrayIcon(object):
signal_img = "low-signal"
else:
signal_img = "bad-signal"
img_file = ''.join([wpath.images, prefix, signal_img, lock, ".png"])
self.tr.set_from_file(img_file)
img_name = ''.join([prefix, signal_img, lock])
self.tr.set_from_name(img_name)
@catchdbus
def get_bandwidth_activity(self):
@@ -677,10 +679,7 @@ TX:'''))
if type_ == "__wired__":
image.set_from_icon_name("network-wired", 2)
else:
pb = gtk.gdk.pixbuf_new_from_file_at_size(self._get_img(n_id),
20, 20)
image.set_from_pixbuf(pb)
del pb
image.set_from_icon_name(self._get_img(n_id), 2)
item.set_image(image)
del image
item.connect("activate", network_selected, type_, n_id)
@@ -706,23 +705,23 @@ TX:'''))
if daemon.GetWPADriver() == 'ralink legacy' or \
daemon.GetSignalDisplayType() == 1:
if dbm_strength >= -60:
signal_img = 'signal-100.png'
signal_img = 'signal-100'
elif dbm_strength >= -70:
signal_img = 'signal-75.png'
signal_img = 'signal-75'
elif dbm_strength >= -80:
signal_img = 'signal-50.png'
signal_img = 'signal-50'
else:
signal_img = 'signal-25.png'
signal_img = 'signal-25'
else:
if strength > 75:
signal_img = 'signal-100.png'
signal_img = 'signal-100'
elif strength > 50:
signal_img = 'signal-75.png'
signal_img = 'signal-75'
elif strength > 25:
signal_img = 'signal-50.png'
signal_img = 'signal-50'
else:
signal_img = 'signal-25.png'
return wpath.images + signal_img
signal_img = 'signal-25'
return signal_img
@catchdbus
def on_net_menu_activate(self, item):
@@ -847,7 +846,7 @@ TX:'''))
self.tray = egg.trayicon.TrayIcon("WicdTrayIcon")
self.pic = gtk.Image()
self.tooltip.set_tip(self.eb, "Initializing wicd...")
self.pic.set_from_file(wpath.images + "no-signal.png")
self.pic.set_from_name('no-signal')
self.eb.connect('button_press_event', self.tray_clicked)
self.eb.add(self.pic)
@@ -864,7 +863,7 @@ TX:'''))
def set_from_file(self, val=None):
""" Calls set_from_file on the gtk.Image for the tray icon. """
self.pic.set_from_file(val)
self.pic.set_from_file(os.path.join(wpath.images, 'hicolor/22x22/status/%s.png' % val))
def set_tooltip(self, val):
""" Set the tooltip for this tray icon.
@@ -899,11 +898,11 @@ TX:'''))
TrayIcon.TrayIconGUI.__init__(self, parent)
gtk.StatusIcon.__init__(self)
self.current_icon_path = ''
self.current_icon_name = ''
self.set_visible(True)
self.connect('activate', self.on_activate)
self.connect('popup-menu', self.on_popup_menu)
self.set_from_file(wpath.images + "no-signal.png")
self.set_from_name('no-signal')
self.set_tooltip("Initializing wicd...")
def on_popup_menu(self, status, button, timestamp):
@@ -911,11 +910,11 @@ TX:'''))
self.init_network_menu()
self.menu.popup(None, None, None, button, timestamp)
def set_from_file(self, path=None):
def set_from_name(self, name=None):
""" Sets a new tray icon picture. """
if path != self.current_icon_path:
self.current_icon_path = path
gtk.StatusIcon.set_from_file(self, path)
if name != self.current_icon_name:
self.current_icon_name = name
gtk.StatusIcon.set_from_icon_name(self, name)
def visible(self, val):
""" Set if the icon is visible or not.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

File renamed without changes.
Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 881 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+17 -16
View File
@@ -139,9 +139,6 @@ class configure(Command):
self.share = '/usr/share/wicd/'
self.etc = '/etc/wicd/'
self.scripts = self.etc + "scripts/"
self.icons = '/usr/share/icons/hicolor/'
self.pixmaps = '/usr/share/pixmaps/'
self.images = self.pixmaps + 'wicd/'
self.encryption = self.etc + 'encryption/templates/'
self.bin = '/usr/bin/'
self.sbin = '/usr/sbin/'
@@ -150,6 +147,9 @@ class configure(Command):
self.curses = self.share + 'curses'
self.gtk = self.share + 'gtk'
self.cli = self.share + 'cli'
self.icons = '/usr/share/icons/hicolor/'
self.pixmaps = '/usr/share/pixmaps/'
self.images = self.share + 'icons'
self.varlib = '/var/lib/wicd/'
self.networks = self.varlib + 'configurations/'
self.log = '/var/log/wicd/'
@@ -462,19 +462,20 @@ class install(_install):
data.append((wpath.autostart, ['other/wicd-tray.desktop']))
if not wpath.no_install_man:
data.append((wpath.mandir + 'man1/', [ 'man/wicd-client.1' ]))
data.append((wpath.icons + 'scalable/apps/', ['icons/scalable/wicd-gtk.svg']))
data.append((wpath.icons + '192x192/apps/', ['icons/192px/wicd-gtk.png']))
data.append((wpath.icons + '128x128/apps/', ['icons/128px/wicd-gtk.png']))
data.append((wpath.icons + '96x96/apps/', ['icons/96px/wicd-gtk.png']))
data.append((wpath.icons + '72x72/apps/', ['icons/72px/wicd-gtk.png']))
data.append((wpath.icons + '64x64/apps/', ['icons/64px/wicd-gtk.png']))
data.append((wpath.icons + '48x48/apps/', ['icons/48px/wicd-gtk.png']))
data.append((wpath.icons + '36x36/apps/', ['icons/36px/wicd-gtk.png']))
data.append((wpath.icons + '32x32/apps/', ['icons/32px/wicd-gtk.png']))
data.append((wpath.icons + '24x24/apps/', ['icons/24px/wicd-gtk.png']))
data.append((wpath.icons + '22x22/apps/', ['icons/22px/wicd-gtk.png']))
data.append((wpath.icons + '16x16/apps/', ['icons/16px/wicd-gtk.png']))
data.append((wpath.images, [('images/' + b) for b in os.listdir('images') if not b.startswith('.')]))
for size in os.listdir('icons'):
for category in os.listdir(os.path.join('icons', size)):
imgdir = os.path.join('icons', size, category)
data.append(
(os.path.join(wpath.icons, size, category),
[(os.path.join(imgdir, f)) for f in os.listdir(imgdir) if not f.startswith('.')])
)
for size in os.listdir('images'):
for category in os.listdir(os.path.join('images', size)):
imgdir = os.path.join('images', size, category)
data.append(
(os.path.join(wpath.images, 'hicolor', size, category),
[(os.path.join(imgdir, f)) for f in os.listdir(imgdir) if not f.startswith('.')])
)
data.append((wpath.pixmaps, ['other/wicd-gtk.xpm']))
if not wpath.no_install_ncurses:
data.append((wpath.curses, ['curses/curses_misc.py']))