예제 #1
0
 def update(self, info):
     """ Update icon """
     [volume, muted, var, card_name, mixer_name] = info
     vol = volume[0]
     if (muted):
         vol = 0
     icon = Icons.get_icon_name_by_volume(vol)
     self.set_from_icon_name(icon)
     
     #""" Update tooltip """
     tooltip = "<b>%s: %s%s </b>\n<small>%s: %s\n%s: %s</small>" % (
             _("Output"), Icons.get_volume_name(vol, muted),
             var, _("Card"), card_name,
             _("Mixer"), mixer_name)
     self.set_tooltip_markup(tooltip)
예제 #2
0
 def show(self):
     """ Show the notification """
     if (not self.info):
         return
     
     duration = self.config.getfloat(self.config.get_default_section(), "notify_timeout")
     
     [volume, muted, var, card_name, mixer_name] = self.info
     volume = volume[0]
     icon = Icons.get_icon_name_by_volume(volume)
     
     body = self.format(volume, muted, var, card_name, mixer_name)
     hints = {"urgency": dbus.Byte(0), "desktop-entry": dbus.String("volti")}
     
     if self.config.getboolean(self.config.get_default_section(), "notify_position") and self.server_capable:
         hints["x"], hints["y"] = self.get_position()
         
     self.last_id = self.notify.Notify('volume', self.last_id, icon, self.title, body, [], hints, duration * 1000)