mirror of
https://github.com/rr-/pq-cli.git
synced 2026-09-29 06:44:00 -06:00
ui/urwid: respect --no-colors
This commit is contained in:
+1
-1
@@ -42,7 +42,7 @@ def parse_args() -> argparse.Namespace:
|
|||||||
"--no-colors",
|
"--no-colors",
|
||||||
dest="colors",
|
dest="colors",
|
||||||
action="store_false",
|
action="store_false",
|
||||||
help="Disable color highlighting in curses interface",
|
help="Disable color highlighting in curses and urwid interface",
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from ..base import BaseUserInterface
|
|||||||
|
|
||||||
TICK_FREQ = 0.1
|
TICK_FREQ = 0.1
|
||||||
SAVE_FREQ = 60.0
|
SAVE_FREQ = 60.0
|
||||||
PALETTE: T.List[T.Tuple[str, ...]] = [
|
PALETTE_COLORS: T.List[T.Tuple[str, ...]] = [
|
||||||
("logo", "light green", ""),
|
("logo", "light green", ""),
|
||||||
("button", "", ""),
|
("button", "", ""),
|
||||||
("button-focus", "light red", "black"),
|
("button-focus", "light red", "black"),
|
||||||
@@ -29,6 +29,13 @@ PALETTE: T.List[T.Tuple[str, ...]] = [
|
|||||||
("scrollable", "", ""),
|
("scrollable", "", ""),
|
||||||
("scrollable-focus", "", ""),
|
("scrollable-focus", "", ""),
|
||||||
]
|
]
|
||||||
|
PALETTE_NO_COLORS: T.List[T.Tuple[str, ...]] = [
|
||||||
|
("button-focus", "", "", "standout"),
|
||||||
|
("linebox-focus", "", "", "standout"),
|
||||||
|
("progressbar-normal", "black", "white"),
|
||||||
|
("progressbar-done", "black", "white", "standout"),
|
||||||
|
("progressbar-smooth", "black", "white"),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class ConfirmExitDialog(ConfirmView):
|
class ConfirmExitDialog(ConfirmView):
|
||||||
@@ -54,8 +61,12 @@ class UrwidUserInterface(BaseUserInterface):
|
|||||||
bind_commands()
|
bind_commands()
|
||||||
|
|
||||||
self.loop = urwid.MainLoop(
|
self.loop = urwid.MainLoop(
|
||||||
None, PALETTE, unhandled_input=self.unhandled_input
|
None,
|
||||||
|
PALETTE_COLORS if args.colors else PALETTE_NO_COLORS,
|
||||||
|
unhandled_input=self.unhandled_input,
|
||||||
)
|
)
|
||||||
|
if not args.colors:
|
||||||
|
self.loop.screen.set_terminal_properties(1)
|
||||||
self.old_views: T.List[urwid.Widget] = []
|
self.old_views: T.List[urwid.Widget] = []
|
||||||
|
|
||||||
self.switch_to_roster_view()
|
self.switch_to_roster_view()
|
||||||
|
|||||||
Reference in New Issue
Block a user