mirror of
https://github.com/SoongNoonien/mpdevil.git
synced 2023-08-10 21:12:44 +03:00
improved open with button appearance
This commit is contained in:
parent
d920da9e52
commit
4925b0288c
28
bin/mpdevil
28
bin/mpdevil
@ -1441,13 +1441,22 @@ class SongPopover(Gtk.Popover):
|
|||||||
song=client.wrapped_call("get_metadata", uri)
|
song=client.wrapped_call("get_metadata", uri)
|
||||||
abs_path=client.wrapped_call("get_absolute_path", uri)
|
abs_path=client.wrapped_call("get_absolute_path", uri)
|
||||||
|
|
||||||
# css
|
# popover css
|
||||||
style_context=self.get_style_context()
|
style_context=self.get_style_context()
|
||||||
provider=Gtk.CssProvider()
|
provider=Gtk.CssProvider()
|
||||||
css=b"""* {background-color: @theme_base_color}"""
|
css=b"""* {background-color: @theme_base_color}"""
|
||||||
provider.load_from_data(css)
|
provider.load_from_data(css)
|
||||||
style_context.add_provider(provider, 600)
|
style_context.add_provider(provider, 600)
|
||||||
|
|
||||||
|
# open with button
|
||||||
|
open_button=Gtk.Button(image=Gtk.Image.new_from_icon_name("document-open-symbolic",Gtk.IconSize.BUTTON),tooltip_text=_("Open with…"))
|
||||||
|
style_context=open_button.get_style_context()
|
||||||
|
style_context.add_class("circular")
|
||||||
|
open_button_revealer=Gtk.Revealer() # needed for open_button tooltip
|
||||||
|
open_button_revealer.set_halign(Gtk.Align.END)
|
||||||
|
open_button_revealer.set_valign(Gtk.Align.END)
|
||||||
|
open_button_revealer.add(open_button)
|
||||||
|
|
||||||
# treeview
|
# treeview
|
||||||
# (tag, display-value, tooltip)
|
# (tag, display-value, tooltip)
|
||||||
store=Gtk.ListStore(str, str, str)
|
store=Gtk.ListStore(str, str, str)
|
||||||
@ -1478,22 +1487,21 @@ class SongPopover(Gtk.Popover):
|
|||||||
store.append([tag+":", value, tooltip])
|
store.append([tag+":", value, tooltip])
|
||||||
|
|
||||||
# packing
|
# packing
|
||||||
box=Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6, border_width=3)
|
overlay=Gtk.Overlay()
|
||||||
scroll=Gtk.ScrolledWindow()
|
scroll=Gtk.ScrolledWindow(border_width=3)
|
||||||
scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
|
scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
|
||||||
window=self.get_toplevel()
|
window=self.get_toplevel()
|
||||||
scroll.set_max_content_height(window.get_size()[1]//2)
|
scroll.set_max_content_height(window.get_size()[1]//2)
|
||||||
scroll.set_propagate_natural_height(True)
|
scroll.set_propagate_natural_height(True)
|
||||||
scroll.add(treeview)
|
scroll.add(treeview)
|
||||||
box.pack_start(scroll, True, True, 0)
|
overlay.add(scroll)
|
||||||
|
overlay.add_overlay(open_button_revealer)
|
||||||
if abs_path is not None: # show open with button when song is on the same computer
|
if abs_path is not None: # show open with button when song is on the same computer
|
||||||
open_button=Gtk.Button(label=_("Open with…"),image=Gtk.Image.new_from_icon_name("document-open-symbolic",Gtk.IconSize.BUTTON))
|
|
||||||
open_button.connect("clicked", self._on_open_button_clicked)
|
|
||||||
self._gfile=Gio.File.new_for_path(abs_path)
|
self._gfile=Gio.File.new_for_path(abs_path)
|
||||||
box.pack_start(open_button, False, False, 0)
|
open_button.connect("clicked", self._on_open_button_clicked)
|
||||||
self.add(box)
|
open_button_revealer.set_reveal_child(True)
|
||||||
|
self.add(overlay)
|
||||||
box.show_all()
|
overlay.show_all()
|
||||||
|
|
||||||
def _on_open_button_clicked(self, *args):
|
def _on_open_button_clicked(self, *args):
|
||||||
self.popdown()
|
self.popdown()
|
||||||
|
Loading…
Reference in New Issue
Block a user