master
yutent 2023-08-18 00:09:43 +08:00
parent e78c60aca9
commit b724b0e9b9
8 changed files with 13 additions and 3 deletions

View File

@ -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)

View File

@ -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)

BIN
usr/share/sonist/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
usr/share/sonist/menu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

BIN
usr/share/sonist/pin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
usr/share/sonist/switch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

View File

@ -38,6 +38,10 @@ class SonistWindow(Gtk.Window):
layout = Gtk.Layout()
# 菜单按钮
menu = ImageButton('./usr/share/sonist/menu.png')
layout.put(menu, 276, 6)
# 唱片
disk = ScaleImage('./usr/share/sonist/disk.png')
album = ScaleImage(album_img)