mirror of
https://github.com/rr-/pq-cli.git
synced 2026-09-28 22:33:59 -06:00
ui/urwid: drop customizing color palettes
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
import argparse
|
||||
import json
|
||||
import typing as T
|
||||
from pathlib import Path
|
||||
|
||||
import urwid
|
||||
import xdg
|
||||
|
||||
from pqcli import lingo, random
|
||||
from pqcli.mechanic import Player
|
||||
@@ -30,21 +28,6 @@ PALETTE: T.List[T.Tuple[str, ...]] = [
|
||||
("scrollable", "", ""),
|
||||
("scrollable-focus", "", ""),
|
||||
]
|
||||
PALETTE_PATH = Path(xdg.XDG_CONFIG_HOME) / "pqcli" / "palette.json"
|
||||
|
||||
|
||||
def load_palette() -> bool:
|
||||
global PALETTE
|
||||
if PALETTE_PATH.exists():
|
||||
PALETTE = json.loads(PALETTE_PATH.read_text())
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def save_palette() -> None:
|
||||
global PALETTE
|
||||
PALETTE_PATH.parent.mkdir(exist_ok=True, parents=True)
|
||||
PALETTE_PATH.write_text(json.dumps(PALETTE, indent=4))
|
||||
|
||||
|
||||
class ConfirmExitDialog(ConfirmView):
|
||||
@@ -69,10 +52,6 @@ class UrwidUserInterface(BaseUserInterface):
|
||||
|
||||
bind_commands()
|
||||
|
||||
if args.use_config:
|
||||
if not load_palette():
|
||||
save_palette() # create a file for the user to edit
|
||||
|
||||
self.loop = urwid.MainLoop(
|
||||
None, PALETTE, unhandled_input=self.unhandled_input
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user