def update_mute_button(self, muted): """ Update mute button """ text, icon = get_volume_label(muted) self._mute.set_icon_name(icon) self._mute.set_tooltip_text(text) self._mute.disconnect(self._mute_handler) if not muted: self._mute_handler = self._mute.connect("clicked", self._on_mute) else: self._mute_handler = self._mute.connect("clicked", self._on_unmute)
def __init__(self, app): Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL) self._app = app self.set_spacing(6) self.set_border_width(6) # Playback Button text, icon = get_playback_label() self._playback = create_toolbutton(text, icon) self._playback_handler = self._playback.connect("clicked", self._on_play) # Send message Button send_msg = create_toolbutton(_("Send message"), "gtk-edit") send_msg.connect("clicked", self._on_im) # Separator sep = Gtk.SeparatorToolItem() # Refresh schedule Button self._refresh = create_toolbutton(_("Update schedule"), "gtk-refresh") self._refresh.connect("clicked", self._on_refresh) # Spinner self._spinner = Gtk.Spinner() # Status self._status = Gtk.Label() self._status.set_selectable(True) self._status.set_alignment(-1, 0.45) self._status.set_use_markup(True) # Mute Button text, icon = get_volume_label() self._mute = create_toolbutton(text, icon) self._mute_handler = self._mute.connect("clicked", self._on_mute) # Volume scale ad = Gtk.Adjustment(value=100, lower=0, upper=100, step_increment=5, page_increment=10, page_size=0) self._volume = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=ad) self._volume.set_property("draw-value", False) self._volume_handler_id = self._volume.connect("value-changed", self._on_volume_changed) self._volume.set_size_request(80, 0) # Pack toolbar toolbar = Gtk.Toolbar() toolbar.set_orientation(Gtk.Orientation.HORIZONTAL) toolbar.set_style(Gtk.ToolbarStyle.ICONS) for x, el in enumerate([self._playback, send_msg, sep, self._refresh]): toolbar.insert(el, x) # Pack panel self.pack_start(toolbar, False, False, 0) self.pack_start(self._spinner, False, False, 0) self.pack_start(self._status, True, False, 0) self.pack_end(self._volume, False, False, 0) self.pack_end(self._mute, False, False, 0) self.show_all() self._spinner.hide()