1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-19 12:28:08 +01:00

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
2012-11-15 16:38:06 +01:00
parent 882c295982
commit 6ba96c6c52
85 changed files with 43 additions and 43 deletions

View File

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

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Before

Width:  |  Height:  |  Size: 608 B

After

Width:  |  Height:  |  Size: 608 B

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 877 B

After

Width:  |  Height:  |  Size: 877 B

View File

Before

Width:  |  Height:  |  Size: 922 B

After

Width:  |  Height:  |  Size: 922 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

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

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1022 B

After

Width:  |  Height:  |  Size: 1022 B

View File

Before

Width:  |  Height:  |  Size: 1022 B

After

Width:  |  Height:  |  Size: 1022 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 946 B

After

Width:  |  Height:  |  Size: 946 B

View File

Before

Width:  |  Height:  |  Size: 946 B

After

Width:  |  Height:  |  Size: 946 B

View File

Before

Width:  |  Height:  |  Size: 1014 B

After

Width:  |  Height:  |  Size: 1014 B

View File

Before

Width:  |  Height:  |  Size: 1014 B

After

Width:  |  Height:  |  Size: 1014 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 978 B

After

Width:  |  Height:  |  Size: 978 B

View File

Before

Width:  |  Height:  |  Size: 978 B

After

Width:  |  Height:  |  Size: 978 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 978 B

After

Width:  |  Height:  |  Size: 978 B

View File

Before

Width:  |  Height:  |  Size: 978 B

After

Width:  |  Height:  |  Size: 978 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 978 B

After

Width:  |  Height:  |  Size: 978 B

View File

Before

Width:  |  Height:  |  Size: 978 B

After

Width:  |  Height:  |  Size: 978 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

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

View File

Before

Width:  |  Height:  |  Size: 1018 B

After

Width:  |  Height:  |  Size: 1018 B

View File

Before

Width:  |  Height:  |  Size: 1018 B

After

Width:  |  Height:  |  Size: 1018 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 941 B

After

Width:  |  Height:  |  Size: 941 B

View File

Before

Width:  |  Height:  |  Size: 941 B

After

Width:  |  Height:  |  Size: 941 B

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

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

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

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