Style the file picker
This commit is contained in:
parent
bb7a45751e
commit
1c458b456e
2 changed files with 24 additions and 3 deletions
lazy_player
|
@ -1,12 +1,13 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Any, cast
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "4.0")
|
||||
from gi.repository import Gtk # NOQA: E402
|
||||
from gi.repository import Gdk, Gtk # NOQA: E402
|
||||
|
||||
|
||||
class MainWindow(Gtk.ApplicationWindow):
|
||||
|
@ -81,8 +82,8 @@ class MainWindow(Gtk.ApplicationWindow):
|
|||
else:
|
||||
files.append(entry.name)
|
||||
|
||||
directories.sort()
|
||||
files.sort()
|
||||
directories.sort(key=lambda x: x.lower())
|
||||
files.sort(key=lambda x: x.lower())
|
||||
|
||||
for name in directories:
|
||||
list_store.append(f"{name}/")
|
||||
|
@ -95,6 +96,21 @@ class App(Gtk.Application):
|
|||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
# Load CSS
|
||||
css_provider = Gtk.CssProvider()
|
||||
css_file = Path(__file__).parent / "style.css"
|
||||
css_provider.load_from_path(str(css_file))
|
||||
|
||||
display = Gdk.Display.get_default()
|
||||
if display is None:
|
||||
raise RuntimeError("No display available")
|
||||
|
||||
Gtk.StyleContext.add_provider_for_display(
|
||||
display,
|
||||
css_provider,
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION,
|
||||
)
|
||||
|
||||
def do_activate(self):
|
||||
win = MainWindow(application=self)
|
||||
win.present()
|
||||
|
|
5
lazy_player/style.css
Normal file
5
lazy_player/style.css
Normal file
|
@ -0,0 +1,5 @@
|
|||
listview > row {
|
||||
padding: 8px;
|
||||
font-size: 48px;
|
||||
font-family: monospace;
|
||||
}
|
Loading…
Reference in a new issue