15 Commits

Autor SHA1 Mensagem Data
mendhak 020786c6e3 Unity specific icons 2013-07-09 23:35:57 +01:00
mendhak 3746f990c4 Set rating fix 2013-07-09 21:32:17 +01:00
mendhak 1fe50235bb lib peas compatibility 2013-07-09 21:30:02 +01:00
mendhak 63b80b21a7 Print messages 2013-07-09 06:38:27 +01:00
mendhak 83e76536f0 Set a track's rating 2013-07-09 06:08:28 +01:00
mendhak e90fda09f3 Play/Pause 2013-07-08 22:23:50 +01:00
mendhak d0e1674ad4 Next and previous 2013-07-08 22:21:27 +01:00
mendhak 81f9c23e6f Exception handling and Rhythmbox quit 2013-07-08 22:14:49 +01:00
mendhak aba352b8a5 Refactored menu values setters 2013-07-08 21:59:07 +01:00
mendhak b4d1b88452 Refactored menu values setters 2013-07-08 21:48:34 +01:00
mendhak f1a939ff1f Reads playback status at startup and sets icon 2013-07-08 21:19:57 +01:00
mendhak 1b0fd7319e Rating submenu items 2013-07-07 23:57:35 +01:00
mendhak 5443fe3ad7 Display current song 2013-07-07 23:34:20 +01:00
mendhak 98736ee0eb Basic unity tray worker 2013-07-07 23:07:02 +01:00
mendhak 96ddf70d67 Moved tray icon into general, split with Unity 2013-07-07 23:06:53 +01:00
5 arquivos alterados com 527 adições e 251 exclusões
+21 -251
Ver Arquivo
@@ -3,275 +3,45 @@
from gi.repository import Gtk, Gdk, GdkPixbuf, Peas, GObject, RB
import os
import platform
import subprocess
import sys
import math
from tray_icon_general import TrayIconGeneral
class TrayIcon(GObject.Object, Peas.Activatable):
__gtype_name = 'TrayIcon'
__gtype_name = 'TrayIconGeneral'
object = GObject.property(type=GObject.Object)
rhythmbox_icon = os.path.join(sys.path[0], "tray_stopped.png")
play_icon = os.path.join(sys.path[0], "tray_playing.png")
menu = None
isUnity = False
plugin = None
def show_popup_menu(self, icon, button, time, data = None):
"""
Called when the icon is right clicked, displays the menu
"""
def __init__(self):
super(TrayIcon, self).__init__()
self.create_popup_menu()
self.menu.popup(None, None, lambda w,x: self.icon.position_menu(self.menu, self.icon), self.icon, 3, time)
if platform.dist()[0] == 'Ubuntu' and float(platform.dist()[1]) >= 13.04:
self.isUnity = True
def create_popup_menu(self):
"""
Creates menu items for popup menu, including star rating
"""
if not self.menu:
self.set_menu_css()
self.menu = Gtk.Menu()
menuitem_playpause = Gtk.MenuItem("Play/Pause")
menuitem_next = Gtk.MenuItem("Next")
menuitem_prev = Gtk.MenuItem("Prev")
menuitem_quit = Gtk.MenuItem("Quit")
menuitem_star = self.get_rating_menuitem()
if menuitem_star:
self.menu.append(menuitem_star)
menuitem_playpause.connect("activate", self.play)
menuitem_next.connect("activate", self.next)
menuitem_prev.connect("activate", self.previous)
menuitem_quit.connect("activate", self.quit)
self.menu.append(menuitem_playpause)
self.menu.append(menuitem_next)
self.menu.append(menuitem_prev)
self.menu.append(menuitem_quit)
self.menu.show_all()
def set_menu_css(self):
"""
Sets style for popup menu, hides hover background for stars
"""
#Prevent background color when mouse hovers
screen = Gdk.Screen.get_default()
css_provider = Gtk.CssProvider()
#The only way I could do it: Re-set bg, border colors, causing menuitem to 'expand', then set the :hover colors with unico
#Also strange, background-color is ignored, but background is not.
css_provider.load_from_data("GtkMenuItem { border:@bg_color; background:@bg_color; } GtkMenuItem:hover { background:@selected_bg_color; } GtkWidget{ border: @bg_color; } #starMenu:hover { color:@fg_color;background: @bg_color; -unico-inner-stroke-width: 0; }")
context = Gtk.StyleContext()
context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
def get_rating_menuitem(self):
"""
Gets a Gtk.MenuItem with the current song's ratings in filled stars
"""
menuitem_star = Gtk.MenuItem(self.get_stars_markup(0,5))
self.star_value = self.get_song_rating()
label = menuitem_star.get_children()[0]
label.set_markup(self.get_stars_markup(self.star_value,5))
menuitem_star.set_name('starMenu')
menuitem_star.connect("motion_notify_event", self.on_star_mouseover)
menuitem_star.connect("button_press_event", self.on_star_click)
menuitem_star.connect("leave_notify_event", self.on_star_mouseout)
if self.star_value >= 0:
return menuitem_star
else:
return None
def get_song_rating(self):
"""
Gets the current song's user rating from Rhythmbox.
"""
current_entry = self.shell.props.shell_player.get_playing_entry()
if current_entry:
return int(current_entry.get_double(RB.RhythmDBPropType.RATING))
else:
return -1
def on_star_click(self, widget, event):
"""
Method called when stars are clicked on. Determines chosen stars and sets song rating.
"""
label = widget.get_children()[0]
self.star_value = self.get_chosen_stars(label, event.x)
self.set_song_rating(self.star_value)
def set_song_rating(self, rating):
"""
Sets the current song rating in Rhythmbox.
"""
current_entry = self.shell.props.shell_player.get_playing_entry()
self.db.entry_set(current_entry, RB.RhythmDBPropType.RATING, rating)
def get_chosen_stars(self, label, mouseX):
"""
Calculates the number of chosen stars to show based on the mouse's X position
"""
star_width = int(label.get_layout().get_pixel_size()[0]/5)
chosen = math.ceil((mouseX-label.get_layout_offsets()[0])/star_width)
if chosen <= 0:
chosen = 0
if chosen >= 5:
chosen = 5
return chosen
def on_star_mouseout(self, widget, event):
"""
Method called when mouse leaves the rating stars. Resets stars to original value.
"""
label = widget.get_children()[0]
label.set_markup(self.get_stars_markup(self.star_value, 5))
def on_star_mouseover(self, widget, event):
"""
Method called when mouse hovers over the rating stars. Shows filled stars as mouse hovers.
"""
label = widget.get_children()[0]
label.set_markup(self.get_stars_markup(self.get_chosen_stars(label,event.x), 5))
def get_stars_markup(self, filled_stars, total_stars):
"""
Gets the Pango Markup for the star rating label
"""
if filled_stars is None or filled_stars <= 0:
filled_stars = 0
if filled_stars >= total_stars:
filled_stars = total_stars
filled_stars = int(math.ceil(filled_stars))
total_stars = int(total_stars)
starString = '' * filled_stars + '' * (total_stars-filled_stars)
return "<span size='x-large' foreground='#000000'>" + starString + "</span>"
def toggle_player_visibility(self, icon, event, data = None):
"""
Toggles visibility of Rhythmbox player
"""
if event.button == 1: # left button
if self.wind.get_visible():
self.wind.hide()
else:
self.wind.show()
self.wind.present()
def play(self, widget):
"""
Starts playing
"""
self.player.playpause(True) # does nothing argument
def next(self, widget):
"""
Goes to next song
"""
self.player.do_next()
def previous(self, widget):
"""
Goes to previous song
"""
self.player.do_previous()
def quit(self, widget):
"""
Exits Rhythmbox
"""
self.shell.quit()
def hide_on_delete(self, widget, event):
self.wind.hide()
return True # don't actually delete
def on_playing_changed(self, player, playing):
"""
Sets icon and tooltip when playing status changes
"""
if playing:
self.icon.set_from_file(self.play_icon)
current_entry = self.shell.props.shell_player.get_playing_entry()
self.set_tooltip_text(current_entry.get_string(RB.RhythmDBPropType.ARTIST) + " - " + current_entry.get_string(RB.RhythmDBPropType.TITLE))
else:
self.icon.set_from_file(self.rhythmbox_icon)
self.set_tooltip_text()
def set_tooltip_text(self, message=""):
"""
Sets tooltip to given message
"""
prepend = ""
if len(message) > 0:
prepend = "\r\n"
tooltip_text = message + prepend + "(Scroll = volume, click = visibility)"
self.icon.set_tooltip_text(tooltip_text)
print self.isUnity
def do_activate(self):
"""
Called when the plugin is activated
"""
self.shell = self.object
self.wind = self.shell.get_property("window")
self.player = self.shell.props.shell_player
self.db = self.shell.props.db
self.wind.connect("delete-event", self.hide_on_delete)
self.create_popup_menu()
self.icon = Gtk.StatusIcon()
self.icon.set_from_file(self.rhythmbox_icon)
self.icon.connect("scroll-event", self.on_scroll)
self.icon.connect("popup-menu", self.show_popup_menu)
self.icon.connect("button-press-event", self.toggle_player_visibility)
self.player.connect("playing-changed", self.on_playing_changed)
self.set_tooltip_text()
def on_scroll(self, widget, event):
"""
Lowers or raises Rhythmbox's volume
"""
vol = round(self.player.get_volume()[1],1)
if event.direction == Gdk.ScrollDirection.UP:
vol+=0.1
elif event.direction == Gdk.ScrollDirection.DOWN:
vol-=0.1
if vol <= 0:
vol = 0
if vol >=1:
vol = 1
self.player.set_volume(vol)
if not self.isUnity:
self.plugin = TrayIconGeneral()
self.plugin.do_activate()
else:
self.proc = subprocess.Popen(os.path.join(sys.path[0], "tray_icon_unity.py"))
def do_deactivate(self):
"""
Called when plugin is deactivated
"""
self.icon.set_visible(False)
del self.icon
if not self.isUnity:
self.plugin.do_deactivate()
else:
if self.proc:
self.proc.kill()
Arquivo executável
+274
Ver Arquivo
@@ -0,0 +1,274 @@
#!/usr/bin/python
# coding=utf-8
from gi.repository import Gtk, Gdk, GdkPixbuf, Peas, GObject, RB
import os
import sys
import math
class TrayIconGeneral():
rhythmbox_icon = os.path.join(sys.path[0], "tray_stopped.png")
play_icon = os.path.join(sys.path[0], "tray_playing.png")
menu = None
def show_popup_menu(self, icon, button, time, data = None):
"""
Called when the icon is right clicked, displays the menu
"""
self.create_popup_menu()
self.menu.popup(None, None, lambda w,x: self.icon.position_menu(self.menu, self.icon), self.icon, 3, time)
def create_popup_menu(self):
"""
Creates menu items for popup menu, including star rating
"""
if not self.menu:
self.set_menu_css()
self.menu = Gtk.Menu()
menuitem_playpause = Gtk.MenuItem("Play/Pause")
menuitem_next = Gtk.MenuItem("Next")
menuitem_prev = Gtk.MenuItem("Prev")
menuitem_quit = Gtk.MenuItem("Quit")
menuitem_star = self.get_rating_menuitem()
if menuitem_star:
self.menu.append(menuitem_star)
menuitem_playpause.connect("activate", self.play)
menuitem_next.connect("activate", self.next)
menuitem_prev.connect("activate", self.previous)
menuitem_quit.connect("activate", self.quit)
self.menu.append(menuitem_playpause)
self.menu.append(menuitem_next)
self.menu.append(menuitem_prev)
self.menu.append(menuitem_quit)
self.menu.show_all()
def set_menu_css(self):
"""
Sets style for popup menu, hides hover background for stars
"""
#Prevent background color when mouse hovers
screen = Gdk.Screen.get_default()
css_provider = Gtk.CssProvider()
#The only way I could do it: Re-set bg, border colors, causing menuitem to 'expand', then set the :hover colors with unico
#Also strange, background-color is ignored, but background is not.
css_provider.load_from_data("GtkMenuItem { border:@bg_color; background:@bg_color; } GtkMenuItem:hover { background:@selected_bg_color; } GtkWidget{ border: @bg_color; } #starMenu:hover { color:@fg_color;background: @bg_color; -unico-inner-stroke-width: 0; }")
context = Gtk.StyleContext()
context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
def get_rating_menuitem(self):
"""
Gets a Gtk.MenuItem with the current song's ratings in filled stars
"""
menuitem_star = Gtk.MenuItem(self.get_stars_markup(0,5))
self.star_value = self.get_song_rating()
label = menuitem_star.get_children()[0]
label.set_markup(self.get_stars_markup(self.star_value,5))
menuitem_star.set_name('starMenu')
menuitem_star.connect("motion_notify_event", self.on_star_mouseover)
menuitem_star.connect("button_press_event", self.on_star_click)
menuitem_star.connect("leave_notify_event", self.on_star_mouseout)
if self.star_value >= 0:
return menuitem_star
else:
return None
def get_song_rating(self):
"""
Gets the current song's user rating from Rhythmbox.
"""
current_entry = self.shell.props.shell_player.get_playing_entry()
if current_entry:
return int(current_entry.get_double(RB.RhythmDBPropType.RATING))
else:
return -1
def on_star_click(self, widget, event):
"""
Method called when stars are clicked on. Determines chosen stars and sets song rating.
"""
label = widget.get_children()[0]
self.star_value = self.get_chosen_stars(label, event.x)
self.set_song_rating(self.star_value)
def set_song_rating(self, rating):
"""
Sets the current song rating in Rhythmbox.
"""
current_entry = self.shell.props.shell_player.get_playing_entry()
self.db.entry_set(current_entry, RB.RhythmDBPropType.RATING, rating)
def get_chosen_stars(self, label, mouseX):
"""
Calculates the number of chosen stars to show based on the mouse's X position
"""
star_width = int(label.get_layout().get_pixel_size()[0]/5)
chosen = math.ceil((mouseX-label.get_layout_offsets()[0])/star_width)
if chosen <= 0:
chosen = 0
if chosen >= 5:
chosen = 5
return chosen
def on_star_mouseout(self, widget, event):
"""
Method called when mouse leaves the rating stars. Resets stars to original value.
"""
label = widget.get_children()[0]
label.set_markup(self.get_stars_markup(self.star_value, 5))
def on_star_mouseover(self, widget, event):
"""
Method called when mouse hovers over the rating stars. Shows filled stars as mouse hovers.
"""
label = widget.get_children()[0]
label.set_markup(self.get_stars_markup(self.get_chosen_stars(label,event.x), 5))
def get_stars_markup(self, filled_stars, total_stars):
"""
Gets the Pango Markup for the star rating label
"""
if filled_stars is None or filled_stars <= 0:
filled_stars = 0
if filled_stars >= total_stars:
filled_stars = total_stars
filled_stars = int(math.ceil(filled_stars))
total_stars = int(total_stars)
starString = '' * filled_stars + '' * (total_stars-filled_stars)
return "<span size='x-large' foreground='#000000'>" + starString + "</span>"
def toggle_player_visibility(self, icon, event, data = None):
"""
Toggles visibility of Rhythmbox player
"""
if event.button == 1: # left button
if self.wind.get_visible():
self.wind.hide()
else:
self.wind.show()
self.wind.present()
def play(self, widget):
"""
Starts playing
"""
self.player.playpause(True) # does nothing argument
def next(self, widget):
"""
Goes to next song
"""
self.player.do_next()
def previous(self, widget):
"""
Goes to previous song
"""
self.player.do_previous()
def quit(self, widget):
"""
Exits Rhythmbox
"""
self.shell.quit()
def hide_on_delete(self, widget, event):
self.wind.hide()
return True # don't actually delete
def on_playing_changed(self, player, playing):
"""
Sets icon and tooltip when playing status changes
"""
if playing:
self.icon.set_from_file(self.play_icon)
current_entry = self.shell.props.shell_player.get_playing_entry()
self.set_tooltip_text(current_entry.get_string(RB.RhythmDBPropType.ARTIST) + " - " + current_entry.get_string(RB.RhythmDBPropType.TITLE))
else:
self.icon.set_from_file(self.rhythmbox_icon)
self.set_tooltip_text()
def set_tooltip_text(self, message=""):
"""
Sets tooltip to given message
"""
prepend = ""
if len(message) > 0:
prepend = "\r\n"
tooltip_text = message + prepend + "(Scroll = volume, click = visibility)"
self.icon.set_tooltip_text(tooltip_text)
def do_activate(self):
"""
Called when the plugin is activated
"""
self.shell = self.object
self.wind = self.shell.get_property("window")
self.player = self.shell.props.shell_player
self.db = self.shell.props.db
self.wind.connect("delete-event", self.hide_on_delete)
self.create_popup_menu()
self.icon = Gtk.StatusIcon()
self.icon.set_from_file(self.rhythmbox_icon)
self.icon.connect("scroll-event", self.on_scroll)
self.icon.connect("popup-menu", self.show_popup_menu)
self.icon.connect("button-press-event", self.toggle_player_visibility)
self.player.connect("playing-changed", self.on_playing_changed)
self.set_tooltip_text()
def on_scroll(self, widget, event):
"""
Lowers or raises Rhythmbox's volume
"""
vol = round(self.player.get_volume()[1],1)
if event.direction == Gdk.ScrollDirection.UP:
vol+=0.1
elif event.direction == Gdk.ScrollDirection.DOWN:
vol-=0.1
if vol <= 0:
vol = 0
if vol >=1:
vol = 1
self.player.set_volume(vol)
def do_deactivate(self):
"""
Called when plugin is deactivated
"""
self.icon.set_visible(False)
del self.icon
Arquivo executável
+232
Ver Arquivo
@@ -0,0 +1,232 @@
#!/usr/bin/python
# coding=utf-8
from gi.repository import AppIndicator3 as AI
from gi.repository import Gtk, Gio, GLib
import os
import sys
import dbus
from dbus.mainloop.glib import DBusGMainLoop
import traceback
class TrayIconUnity():
playIcon = os.path.join(sys.path[0], "tray_playing_unity.png")
stopIcon = os.path.join(sys.path[0], "tray_stopped_unity.png")
APPNAME = "Rhythmbox Tray Icon"
def quit(self, item):
print "Quitting"
try:
session_bus = dbus.SessionBus()
player = session_bus.get_object('org.mpris.MediaPlayer2.rhythmbox','/org/mpris/MediaPlayer2')
mplayeriface = dbus.Interface(player, dbus_interface='org.mpris.MediaPlayer2')
mplayeriface.Quit()
Gtk.main_quit()
except:
sys.exit()
def next(self, item):
print "Next"
try:
session_bus = dbus.SessionBus()
player = session_bus.get_object('org.mpris.MediaPlayer2.rhythmbox','/org/mpris/MediaPlayer2')
mplayeriface = dbus.Interface(player, dbus_interface='org.mpris.MediaPlayer2.Player')
mplayeriface.Next()
except:
pass
def previous(self, item):
print "Previous"
try:
session_bus = dbus.SessionBus()
player = session_bus.get_object('org.mpris.MediaPlayer2.rhythmbox','/org/mpris/MediaPlayer2')
mplayeriface = dbus.Interface(player, dbus_interface='org.mpris.MediaPlayer2.Player')
mplayeriface.Previous()
except:
pass
def playpause(self, item):
print "Play/Pause"
try:
session_bus = dbus.SessionBus()
player = session_bus.get_object('org.mpris.MediaPlayer2.rhythmbox','/org/mpris/MediaPlayer2')
mplayeriface = dbus.Interface(player, dbus_interface='org.mpris.MediaPlayer2.Player')
mplayeriface.PlayPause()
except:
pass
def rate(self, item, *data):
print "Setting rating to " + str(data[0])
self.set_track_rating(data[0])
def scroll(self, aai, ind, steps):
pass
#Not working due to this bug: https://bugs.launchpad.net/indicator-application/+bug/1075152
#bus = dbus.SessionBus()
#mplayer = bus.get_object('org.mpris.MediaPlayer2.rhythmbox', '/org/mpris/MediaPlayer2')
#iface = dbus.Interface(mplayer, dbus.PROPERTIES_IFACE)
#current_volume = iface.Get('org.mpris.MediaPlayer2.Player', 'Volume')
#iface.Set('org.mpris.MediaPlayer2.Player', 'Volume', 0.5)
def makemenu(self):
print "Creating menu items"
menu = Gtk.Menu()
self.currentsong_menuitem = Gtk.MenuItem('')
self.currentsong_menuitem.set_sensitive(False)
self.currentsong_menuitem.show()
self.rating_menuitem = Gtk.MenuItem('☆☆☆☆☆')
self.rating_menuitem.show()
submenu = Gtk.Menu()
for i in [5,4,3,2,1,0]:
starString = '' * i + '' * (5-i)
ratingsubmenuitem = Gtk.MenuItem(starString)
ratingsubmenuitem.connect('activate', self.rate, i)
ratingsubmenuitem.show()
submenu.append(ratingsubmenuitem)
self.rating_menuitem.set_submenu(submenu)
playpause_item = Gtk.MenuItem('Play/Pause')
playpause_item.connect('activate', self.playpause)
playpause_item.show()
next_item = Gtk.MenuItem('Next')
next_item.connect('activate', self.next)
next_item.show()
prev_item = Gtk.MenuItem('Previous')
prev_item.connect('activate', self.previous)
prev_item.show()
exit_item = Gtk.MenuItem('Quit')
exit_item.connect('activate', self.quit)
exit_item.show()
menu.append(self.currentsong_menuitem)
menu.append(self.rating_menuitem)
menu.append(playpause_item)
menu.append(next_item)
menu.append(prev_item)
menu.append(exit_item)
menu.show()
return menu
def startapp(self):
print "Starting app"
self.ai = AI.Indicator.new(self.APPNAME, self.stopIcon, AI.IndicatorCategory.HARDWARE)
self.ai.set_status(AI.IndicatorStatus.ACTIVE)
self.ai.set_menu(self.makemenu())
self.ai.connect("scroll-event", self.scroll)
self.set_menu_values()
Gtk.main()
def set_menu_values(self):
print "Setting menu values"
if self.is_playing():
self.ai.set_icon(self.playIcon)
else:
self.ai.set_icon(self.stopIcon)
currentTrack = self.get_current_track()
if currentTrack:
self.currentsong_menuitem.set_label(self.get_current_track())
rating = self.get_current_rating()
if rating:
starString = '' * rating + '' * (5-rating)
self.rating_menuitem.set_label(starString)
def filter_cb(self, bus, message):
print "Filter event raised"
# the NameAcquired message comes through before match string gets applied
# args = message.get_args_list()
try:
self.set_menu_values()
except:
print traceback.print_exc()
def is_playing(self):
try:
bus = dbus.SessionBus()
mplayer = bus.get_object('org.mpris.MediaPlayer2.rhythmbox', '/org/mpris/MediaPlayer2')
iface = dbus.Interface(mplayer, dbus.PROPERTIES_IFACE)
return iface.Get('org.mpris.MediaPlayer2.Player', 'PlaybackStatus') == 'Playing'
except:
return False
def get_current_track(self):
try:
bus = dbus.SessionBus()
mplayer = bus.get_object('org.mpris.MediaPlayer2.rhythmbox', '/org/mpris/MediaPlayer2')
iface = dbus.Interface(mplayer, dbus.PROPERTIES_IFACE)
return iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')[dbus.String(u'xesam:title')]
except:
return None
def get_current_track_url(self):
try:
bus = dbus.SessionBus()
mplayer = bus.get_object('org.mpris.MediaPlayer2.rhythmbox', '/org/mpris/MediaPlayer2')
iface = dbus.Interface(mplayer, dbus.PROPERTIES_IFACE)
return iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')[dbus.String(u'xesam:url')]
except:
return None
def get_current_rating(self):
try:
bus = dbus.SessionBus()
mplayer = bus.get_object('org.mpris.MediaPlayer2.rhythmbox', '/org/mpris/MediaPlayer2')
iface = dbus.Interface(mplayer, dbus.PROPERTIES_IFACE)
return int(iface.Get('org.mpris.MediaPlayer2.Player', 'Metadata')[dbus.String(u'xesam:userRating')] * 5)
except:
return None
def set_track_rating(self, rating):
"""
Sets the current song rating in Rhythmbox.
"""
try:
currentSongURI = self.get_current_track_url()
if currentSongURI:
busType = Gio.BusType.SESSION
flags = 0
ratingInterface = None
proxy = Gio.DBusProxy.new_for_bus_sync(busType, flags, ratingInterface,
"org.gnome.Rhythmbox3",
"/org/gnome/Rhythmbox3/RhythmDB",
"org.gnome.Rhythmbox3.RhythmDB", None)
variantRating = GLib.Variant("d", float(rating))
proxy.SetEntryProperties("(sa{sv})", currentSongURI, {"rating": variantRating})
self.set_menu_values()
except:
print traceback.print_exc()
DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()
bus.add_match_string_non_blocking("type='signal',member='PropertiesChanged',path='/org/mpris/MediaPlayer2'")
tiu = TrayIconUnity()
bus.add_message_filter(tiu.filter_cb)
# sbus = dbus.SessionBus()
# sbus.add_match_string_non_blocking("type='method_call'")
# sbus.add_message_filter(tiu.filter_scroll)
tiu.startapp()
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 1.4 KiB

Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 1.4 KiB