Commit 9550c16a authored by Bram Schoenmakers's avatar Bram Schoenmakers

Merge branch 'column-ui' of https://github.com/bram85/topydo into column-ui

parents 274ddf0e c8eccd69
......@@ -149,7 +149,12 @@ class UIApplication(CLIApplicationBase):
self._blur_commandline()
self._screen = urwid.raw_display.Screen()
self._screen.register_palette(self._create_color_palette())
if config().colors():
self._screen.register_palette(self._create_color_palette())
else:
self._screen.register_palette(self._create_mono_palette())
self._screen.set_terminal_properties(256)
self.mainloop = urwid.MainLoop(
......@@ -163,10 +168,6 @@ class UIApplication(CLIApplicationBase):
self._set_alarm_for_next_midnight_update()
def _create_color_palette(self):
if not config().colors():
# return an empty palette:
return []
project_color = to_urwid_color(config().project_color())
context_color = to_urwid_color(config().context_color())
metadata_color = to_urwid_color(config().metadata_color())
......@@ -200,6 +201,23 @@ class UIApplication(CLIApplicationBase):
return palette
def _create_mono_palette(self):
palette = [
(PaletteItem.DEFAULT_FOCUS, 'black', 'light gray'),
(PaletteItem.PROJECT_FOCUS, PaletteItem.DEFAULT_FOCUS),
(PaletteItem.CONTEXT_FOCUS, PaletteItem.DEFAULT_FOCUS),
(PaletteItem.METADATA_FOCUS, PaletteItem.DEFAULT_FOCUS),
(PaletteItem.LINK_FOCUS, PaletteItem.DEFAULT_FOCUS),
(PaletteItem.MARKED, 'default,underline,bold', 'default'),
]
for C in ascii_uppercase:
palette.append(
('pri_' + C + '_focus', PaletteItem.DEFAULT_FOCUS)
)
return palette
def _set_alarm_for_next_midnight_update(self):
def callback(p_loop, p_data):
self._update_all_columns()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment