master
parent
e78c60aca9
commit
b724b0e9b9
1
main.py
1
main.py
|
@ -17,6 +17,7 @@ from mpd.base import MPDClient
|
||||||
app_id = 'fun.wkit.sonist'
|
app_id = 'fun.wkit.sonist'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Application(Gtk.Application):
|
class Application(Gtk.Application):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Gtk.Application.__init__(self, application_id = app_id)
|
Gtk.Application.__init__(self, application_id = app_id)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk, Gdk
|
||||||
|
|
||||||
from .image import ScaleImage
|
from .image import ScaleImage
|
||||||
|
|
||||||
|
@ -16,17 +16,22 @@ class ImageButton(Gtk.Button):
|
||||||
image = ScaleImage(filepath)
|
image = ScaleImage(filepath)
|
||||||
image.resize(width, height)
|
image.resize(width, height)
|
||||||
|
|
||||||
|
# 针对macos的设置, 但只解决了普通状态下的边框问题, 鼠标经过的样式还在
|
||||||
|
self.set_relief(Gtk.ReliefStyle.NONE)
|
||||||
|
|
||||||
self.set_image(image)
|
self.set_image(image)
|
||||||
|
|
||||||
css_provider = Gtk.CssProvider()
|
css_provider = Gtk.CssProvider()
|
||||||
style = f"""
|
style = f"""
|
||||||
#ImageButton {{
|
#ImageButton, #ImageButton:hover {{
|
||||||
border: 0;
|
border: 0;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
outline: none;
|
border-color:transparent;
|
||||||
|
outline: transparent;
|
||||||
}}
|
}}
|
||||||
"""
|
"""
|
||||||
css_provider.load_from_data(style.encode('UTF-8'))
|
css_provider.load_from_data(style.encode('UTF-8'))
|
||||||
|
|
||||||
context = self.get_style_context()
|
context = self.get_style_context()
|
||||||
|
path = context.get_path()
|
||||||
context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
|
context.add_provider(css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER)
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 504 B |
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 1004 B |
|
@ -37,6 +37,10 @@ class SonistWindow(Gtk.Window):
|
||||||
self.set_background_image(album_img)
|
self.set_background_image(album_img)
|
||||||
|
|
||||||
layout = Gtk.Layout()
|
layout = Gtk.Layout()
|
||||||
|
|
||||||
|
# 菜单按钮
|
||||||
|
menu = ImageButton('./usr/share/sonist/menu.png')
|
||||||
|
layout.put(menu, 276, 6)
|
||||||
|
|
||||||
# 唱片
|
# 唱片
|
||||||
disk = ScaleImage('./usr/share/sonist/disk.png')
|
disk = ScaleImage('./usr/share/sonist/disk.png')
|
||||||
|
|
Loading…
Reference in New Issue