Add even more config options

This commit is contained in:
Joscha 2019-06-21 06:31:37 +00:00
parent f3bbd42420
commit cd90649111
2 changed files with 81 additions and 10 deletions

View file

@ -120,11 +120,51 @@ class EuphConfig(TransparentConfig):
def indent_cursor_style(self) -> str:
return self["visual.indent.cursor.style"]
# other
# scroll
@property
def scrolloff(self) -> int:
return self["visual.scrolloff"]
return self["visual.scroll.scrolloff"]
@property
def vertical_scroll(self) -> int:
return self["visual.scroll.vertical"]
@property
def horizontal_scroll(self) -> int:
return self["visual.scroll.horizontal"]
@property
def half_page_scroll(self) -> bool:
return self["visual.scroll.half_page"]
# borders
@property
def room_name_separator(self) -> str:
return self["visual.borders.room_name_separator"]
@property
def room_name_split(self) -> str:
return self["visual.borders.room_name_split"]
@property
def nick_list_separator(self) -> str:
return self["visual.borders.nick_list_separator"]
@property
def nick_list_split(self) -> str:
return self["visual.borders.nick_list_split"]
@property
def edit_separator(self) -> str:
return self["visual.borders.edit_separator"]
@property
def borders_style(self) -> str:
return self["visual.borders.style"]
# other
@property
def palette(self) -> Any:
@ -176,8 +216,10 @@ class EuphLoader(TreeLoader):
self.add_style("visual.surround.style", "bold")
# cursor
self.add("visual.cursor.surround.left", Kind.STR, "<", self.SINGLE_CHAR)
self.add("visual.cursor.surround.right", Kind.STR, ">", self.SINGLE_CHAR)
self.add("visual.cursor.surround.left", Kind.STR, "<",
self.SINGLE_CHAR)
self.add("visual.cursor.surround.right", Kind.STR, ">",
self.SINGLE_CHAR)
self.add_style("visual.cursor.surround.style", "cursor")
self.add_style("visual.cursor.own_nick_style", "cursor")
self.add("visual.cursor.fill.char", Kind.STR, " ", self.SINGLE_CHAR)
@ -189,13 +231,31 @@ class EuphLoader(TreeLoader):
self.add("visual.indent.fill", Kind.STR, " ", self.SINGLE_CHAR)
self.add_style("visual.indent.style", "gray")
self.add("visual.indent.cursor.char", Kind.STR, "", self.SINGLE_CHAR)
self.add("visual.indent.cursor.corner", Kind.STR, "", self.SINGLE_CHAR)
self.add("visual.indent.cursor.corner", Kind.STR, "",
self.SINGLE_CHAR)
self.add("visual.indent.cursor.fill", Kind.STR, "", self.SINGLE_CHAR)
self.add_style("visual.indent.cursor.style", "cursor")
# other
self.add("visual.scrolloff", Kind.INT, 3, self.AT_LEAST_0)
# scroll
self.add("visual.scroll.scrolloff", Kind.INT, 3, self.AT_LEAST_0)
self.add("visual.scroll.vertical", Kind.INT, 2, self.AT_LEAST_1)
self.add("visual.scroll.horizontal", Kind.INT, 8, self.AT_LEAST_1)
self.add("visual.scroll.half_page", Kind.BOOL, True)
# borders
self.add("visual.borders.room_name_separator", Kind.STR, "",
self.SINGLE_CHAR)
self.add("visual.borders.room_name_split", Kind.STR, "",
self.SINGLE_CHAR)
self.add("visual.borders.nick_list_separator", Kind.STR, "",
self.SINGLE_CHAR)
self.add("visual.borders.nick_list_split", Kind.STR, "",
self.SINGLE_CHAR)
self.add("visual.borders.edit_separator", Kind.STR, "",
self.SINGLE_CHAR)
self.add_style("visual.borders.style", "gray")
# other
self.add("styles", Kind.DICT, self.DEFAULT_STYLES)
def add_style(self, name: str, default: str) -> None:

View file

@ -287,7 +287,11 @@ class RoomWidget(urwid.WidgetWrap):
)
def _create_tree_widget(self) -> Any:
return CursorTreeWidget(self._tree)
return CursorTreeWidget(self._tree,
vertical_scroll_step=self.c.vertical_scroll,
horizontal_scroll_step=self.c.vertical_scroll,
half_page_scroll=self.c.half_page_scroll,
)
def _create_edit_widget(self) -> Any:
return urwid.Edit(multiline=True)
@ -301,10 +305,17 @@ class RoomWidget(urwid.WidgetWrap):
tree: Any,
edit: Any,
) -> Any:
return RoomLayout(room_name, nick_list, tree, edit)
return RoomLayout(room_name, nick_list, tree, edit,
border_attrs={"style": self.c.borders_style},
room_name_separator=self.c.room_name_separator,
room_name_split=self.c.room_name_split,
nick_list_separator=self.c.nick_list_separator,
nick_list_split=self.c.nick_list_split,
edit_separator=self.c.edit_separator,
)
def _create_edit_nick_widget(self) -> Any:
return EditWidget("Choose a nick: ", "@")
return EditWidget("Choose a nick: ", "@", style=self.c.own_nick_style)
## Room life cycle