def on_query_tooltip(self, widget, x, y, keyboard_tip, tooltip): artist = "Artist" title = "Title" if self.current_bean: if self.current_bean.artist and self.current_bean.title: artist = self.current_bean.artist #artist = string.join(["&" if x == '&' else x for x in artist], '') artist = artist.replace('&', '&') title = self.current_bean.title else: artist = "Unknown artist" title = self.current_bean.text max_str_len = 40 if len(title) > max_str_len: title = split_string(title, max_str_len) alabel = Gtk.Label.new(None) alabel.set_markup("<b>%s</b>" % artist) hbox1 = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) hbox1.pack_start(alabel, False, False, 0) hbox2 = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) hbox2.pack_start(Gtk.Label.new(title), False, False, 0) vbox = VBoxDecorator(Gtk.Label.new(None), hbox1, Gtk.Label.new(None), hbox2) """if self.tooltip_image.size == 150: alignment = Gtk.Alignment(0, 0.4) else: alignment = Gtk.Alignment() alignment.set_padding(padding_top=0, padding_bottom=0, padding_left=10, padding_right=10) alignment.add(vbox)""" vbox.set_halign(Gtk.Align.CENTER) tooltip.set_icon(self.tooltip_image.get_pixbuf()) tooltip.set_custom(vbox) return True
def __init__(self, controls): self.controls = controls box = Gtk.VBox(False, 0) box.hide() '''static_icon''' self.static_icon = IconBlock(_("Icon"), controls, FC().static_icon_entry) """dynamic icons""" self.play_icon = IconBlock(_("Play"), controls, FC().play_icon_entry) self.pause_icon = IconBlock(_("Pause"), controls, FC().pause_icon_entry) self.stop_icon = IconBlock(_("Stop"), controls, FC().stop_icon_entry) self.radio_icon = IconBlock(_("Radio"), controls, FC().radio_icon_entry) self.tray_icon_button = Gtk.CheckButton(label=_("Show tray icon"), use_underline=True) self.hide_in_tray_on_start = Gtk.CheckButton(label=_("Hide player in tray on start"), use_underline=True) #self.tray_icon_button.connect("clicked", self.on_show_tray_icon) self.close_button = Gtk.RadioButton(group=None, label=_("On close window - close player")) self.hide_button = Gtk.RadioButton(group=self.close_button, label=_("On close window - hide player")) self.hide_button.connect("toggled", self.on_show_tray_icon) self.minimize_button = Gtk.RadioButton(group=self.close_button, label=_("On close window - minimize player")) """system icon""" self.static_tray_icon = ChooseDecorator(None, FrameDecorator(_("System Icon Static"), self.static_icon)) """dynamic icons""" line = VBoxDecorator(self.play_icon, self.pause_icon, self.stop_icon, self.radio_icon) self.icon_controls = ChooseDecorator(self.static_tray_icon.get_radio_button(), FrameDecorator(_("System Icons Dynamic"), line)) """disc image icon""" image = ImageBase(ICON_BLANK_DISK, 30) self.change_tray_icon = ChooseDecorator(self.static_tray_icon.get_radio_button(), FrameDecorator(_("Disc cover image"), image)) self.notifier = Gtk.CheckButton(_("Notification pop-up")) self.notifier.connect("toggled", self.on_toggle) self.n_time = self.notify_time() box.pack_start(self.hide_in_tray_on_start, False, True, 0) box.pack_start(self.tray_icon_button, False, True, 0) box.pack_start(self.close_button, False, True, 0) box.pack_start(self.hide_button, False, True, 0) box.pack_start(self.minimize_button, False, True, 0) box.pack_start(self.static_tray_icon, True, True, 0) box.pack_start(self.icon_controls, True, True, 0) box.pack_start(self.change_tray_icon, False, False, 0) notifier_box = Gtk.VBox() notifier_box.pack_start(self.notifier, False, False, 0) notifier_box.pack_start(self.n_time, False, False, 0) box.pack_start(FrameDecorator(_("Notification"), notifier_box), False, False, 0) self.widget = box