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'
|
||||
|
||||
|
||||
|
||||
class Application(Gtk.Application):
|
||||
def __init__(self):
|
||||
Gtk.Application.__init__(self, application_id = app_id)
|
||||
|
|
|
@ -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)
|
||||
|
|
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 |
Loading…
Reference in New Issue