diff --git a/main.py b/main.py index 54143b4..1859506 100755 --- a/main.py +++ b/main.py @@ -17,6 +17,7 @@ from mpd.base import MPDClient app_id = 'fun.wkit.sonist' + class Application(Gtk.Application): def __init__(self): Gtk.Application.__init__(self, application_id = app_id) diff --git a/ui/image_button.py b/ui/image_button.py index 7645b05..ff04074 100644 --- a/ui/image_button.py +++ b/ui/image_button.py @@ -2,7 +2,7 @@ import gi gi.require_version('Gtk', '3.0') -from gi.repository import Gtk +from gi.repository import Gtk, Gdk from .image import ScaleImage @@ -16,17 +16,22 @@ class ImageButton(Gtk.Button): image = ScaleImage(filepath) image.resize(width, height) + # 针对macos的设置, 但只解决了普通状态下的边框问题, 鼠标经过的样式还在 + self.set_relief(Gtk.ReliefStyle.NONE) + self.set_image(image) css_provider = Gtk.CssProvider() style = f""" - #ImageButton {{ + #ImageButton, #ImageButton:hover {{ border: 0; background-color: transparent; - outline: none; + border-color:transparent; + outline: transparent; }} """ css_provider.load_from_data(style.encode('UTF-8')) context = self.get_style_context() + path = context.get_path() context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER) diff --git a/usr/share/sonist/info.png b/usr/share/sonist/info.png new file mode 100644 index 0000000..63d2fdd Binary files /dev/null and b/usr/share/sonist/info.png differ diff --git a/usr/share/sonist/menu.png b/usr/share/sonist/menu.png new file mode 100644 index 0000000..4db64e9 Binary files /dev/null and b/usr/share/sonist/menu.png differ diff --git a/usr/share/sonist/pin.png b/usr/share/sonist/pin.png new file mode 100644 index 0000000..31a48fe Binary files /dev/null and b/usr/share/sonist/pin.png differ diff --git a/usr/share/sonist/setting.png b/usr/share/sonist/setting.png new file mode 100644 index 0000000..bacfdf0 Binary files /dev/null and b/usr/share/sonist/setting.png differ diff --git a/usr/share/sonist/switch.png b/usr/share/sonist/switch.png new file mode 100644 index 0000000..2279022 Binary files /dev/null and b/usr/share/sonist/switch.png differ diff --git a/window.py b/window.py index 2a8989d..cac680c 100644 --- a/window.py +++ b/window.py @@ -37,6 +37,10 @@ class SonistWindow(Gtk.Window): self.set_background_image(album_img) layout = Gtk.Layout() + + # 菜单按钮 + menu = ImageButton('./usr/share/sonist/menu.png') + layout.put(menu, 276, 6) # 唱片 disk = ScaleImage('./usr/share/sonist/disk.png')