mirror of
https://github.com/ihabunek/toot
synced 2025-01-11 17:13:58 +01:00
Merge pull request #373 from danschwarz/nocolor
--no-color now works for tui mode
This commit is contained in:
commit
a3435b4b96
@ -8,7 +8,7 @@ from toot.console import get_default_visibility
|
|||||||
from toot.exceptions import ApiError
|
from toot.exceptions import ApiError
|
||||||
|
|
||||||
from .compose import StatusComposer
|
from .compose import StatusComposer
|
||||||
from .constants import PALETTE
|
from .constants import PALETTE, MONO_PALETTE
|
||||||
from .entities import Status
|
from .entities import Status
|
||||||
from .overlays import ExceptionStackTrace, GotoMenu, Help, StatusSource, StatusLinks, StatusZoom
|
from .overlays import ExceptionStackTrace, GotoMenu, Help, StatusSource, StatusLinks, StatusZoom
|
||||||
from .overlays import StatusDeleteConfirmation, Account
|
from .overlays import StatusDeleteConfirmation, Account
|
||||||
@ -78,9 +78,10 @@ class TUI(urwid.Frame):
|
|||||||
"""Factory method, sets up TUI and an event loop."""
|
"""Factory method, sets up TUI and an event loop."""
|
||||||
|
|
||||||
tui = cls(app, user, args)
|
tui = cls(app, user, args)
|
||||||
|
|
||||||
loop = urwid.MainLoop(
|
loop = urwid.MainLoop(
|
||||||
tui,
|
tui,
|
||||||
palette=PALETTE,
|
palette=MONO_PALETTE if args.no_color else PALETTE,
|
||||||
event_loop=urwid.AsyncioEventLoop(),
|
event_loop=urwid.AsyncioEventLoop(),
|
||||||
unhandled_input=tui.unhandled_input,
|
unhandled_input=tui.unhandled_input,
|
||||||
)
|
)
|
||||||
@ -98,6 +99,12 @@ class TUI(urwid.Frame):
|
|||||||
self.executor = ThreadPoolExecutor(max_workers=1)
|
self.executor = ThreadPoolExecutor(max_workers=1)
|
||||||
self.timeline_generator = api.home_timeline_generator(app, user, limit=40)
|
self.timeline_generator = api.home_timeline_generator(app, user, limit=40)
|
||||||
|
|
||||||
|
self.screen = urwid.raw_display.Screen()
|
||||||
|
|
||||||
|
if args.no_color:
|
||||||
|
self.screen.set_terminal_properties(1)
|
||||||
|
self.screen.reset_default_terminal_palette()
|
||||||
|
|
||||||
# Show intro screen while toots are being loaded
|
# Show intro screen while toots are being loaded
|
||||||
self.body = self.build_intro()
|
self.body = self.build_intro()
|
||||||
self.header = Header(app, user)
|
self.header = Header(app, user)
|
||||||
@ -111,7 +118,6 @@ class TUI(urwid.Frame):
|
|||||||
self.overlay = None
|
self.overlay = None
|
||||||
self.exception = None
|
self.exception = None
|
||||||
self.can_translate = False
|
self.can_translate = False
|
||||||
self.screen = urwid.raw_display.Screen()
|
|
||||||
self.account = None
|
self.account = None
|
||||||
|
|
||||||
super().__init__(self.body, header=self.header, footer=self.footer)
|
super().__init__(self.body, header=self.header, footer=self.footer)
|
||||||
|
@ -40,6 +40,47 @@ PALETTE = [
|
|||||||
('white_bold', 'white,bold', '')
|
('white_bold', 'white,bold', '')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
MONO_PALETTE = [
|
||||||
|
# Components
|
||||||
|
('button', 'white', 'black'),
|
||||||
|
('button_focused', 'black', 'white'),
|
||||||
|
('columns_divider', 'white', 'black'),
|
||||||
|
('content_warning', 'white', 'black'),
|
||||||
|
('editbox', 'white', 'black'),
|
||||||
|
('editbox_focused', 'black', 'white'),
|
||||||
|
('footer_message', 'white', 'black'),
|
||||||
|
('footer_message_error', 'white,bold', 'black'),
|
||||||
|
('footer_status', 'black', 'white'),
|
||||||
|
('footer_status_bold', 'black,bold', 'white'),
|
||||||
|
('header', 'black', 'white'),
|
||||||
|
('header_bold', 'black,bold', 'white'),
|
||||||
|
('intro_bigtext', 'white', 'black'),
|
||||||
|
('intro_smalltext', 'white', 'black'),
|
||||||
|
('poll_bar', 'black', 'white'),
|
||||||
|
|
||||||
|
# Functional
|
||||||
|
('hashtag', 'white,bold', 'black'),
|
||||||
|
('followed_hashtag', 'white,bold', 'black'),
|
||||||
|
('link', ',italics', 'black'),
|
||||||
|
('link_focused', ',bold,italics', 'black'),
|
||||||
|
|
||||||
|
# Colors
|
||||||
|
('bold', ',bold', 'black'),
|
||||||
|
('blue', 'white', 'black'),
|
||||||
|
('blue_bold', 'white, bold', 'black'),
|
||||||
|
('blue_selected', 'white, bold', 'black'),
|
||||||
|
('cyan', 'white', 'black'),
|
||||||
|
('cyan_bold', 'white,bold', 'black'),
|
||||||
|
('gray', 'white', 'black'),
|
||||||
|
('green', 'white', 'black'),
|
||||||
|
('green_selected', 'black', 'white'),
|
||||||
|
('yellow', 'white', 'black'),
|
||||||
|
('yellow_bold', 'white,bold', 'black'),
|
||||||
|
('red', 'white', 'black'),
|
||||||
|
('warning', 'white,bold', 'black'),
|
||||||
|
('white_bold', 'white,bold', 'black')
|
||||||
|
]
|
||||||
|
|
||||||
VISIBILITY_OPTIONS = [
|
VISIBILITY_OPTIONS = [
|
||||||
("public", "Public", "Post to public timelines"),
|
("public", "Public", "Post to public timelines"),
|
||||||
("unlisted", "Unlisted", "Do not post to public timelines"),
|
("unlisted", "Unlisted", "Do not post to public timelines"),
|
||||||
|
Loading…
Reference in New Issue
Block a user