Ensure icon resource stream is closed
parent
79e4f603ae
commit
178aa35e7e
|
@ -236,12 +236,12 @@ class Notifier(object):
|
|||
|
||||
def show_status_icon(self):
|
||||
loader = GdkPixbuf.PixbufLoader()
|
||||
img = pkg_resources.resource_stream('mpdnotify', 'mpd-logo.png')
|
||||
with contextlib.closing(loader):
|
||||
for d in iter(lambda: img.read(1), b''):
|
||||
loader.write(d)
|
||||
self.icon = Gtk.StatusIcon.new_from_pixbuf(loader.get_pixbuf())
|
||||
self.icon.set_tooltip_text('Not connected')
|
||||
with pkg_resources.resource_stream('mpdnotify', 'mpd-logo.png') as img:
|
||||
with contextlib.closing(loader):
|
||||
for d in iter(lambda: img.read(1), b''):
|
||||
loader.write(d)
|
||||
self.icon = Gtk.StatusIcon.new_from_pixbuf(loader.get_pixbuf())
|
||||
self.icon.set_tooltip_text('Not connected')
|
||||
|
||||
def stop(self):
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue