Skip to content

Commit a5497bd

Browse files
committed
refactor: view: Group related lines together in __init__.
To improve readability in `__init__` method of StreaView and TopicView, related variables were grouped together using comments.
1 parent 52b0034 commit a5497bd

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

zulipterminal/ui_tools/views.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,18 @@ def __init__(self) -> None:
302302
class StreamsView(urwid.Frame):
303303
def __init__(self, streams_btn_list: List[Any], view: Any) -> None:
304304
self.view = view
305-
self.log = urwid.SimpleFocusListWalker(streams_btn_list)
305+
# Stream List
306306
self.streams_btn_list = streams_btn_list
307-
self.focus_index_before_search = 0
307+
self.log = urwid.SimpleFocusListWalker(streams_btn_list)
308308
list_box = urwid.ListBox(self.log)
309+
# Stream Search
310+
self.empty_search = False
311+
self.focus_index_before_search = 0
312+
self.search_lock = threading.Lock()
309313
self.stream_search_box = PanelSearchBox(
310314
self, "SEARCH_STREAMS", self.update_streams
311315
)
316+
312317
super().__init__(
313318
list_box,
314319
header=urwid.LineBox(
@@ -323,8 +328,6 @@ def __init__(self, streams_btn_list: List[Any], view: Any) -> None:
323328
brcorner="─",
324329
),
325330
)
326-
self.search_lock = threading.Lock()
327-
self.empty_search = False
328331

329332
@asynch
330333
def update_streams(self, search_box: Any, new_text: str) -> None:
@@ -404,17 +407,22 @@ def __init__(
404407
self, topics_btn_list: List[Any], view: Any, stream_button: Any
405408
) -> None:
406409
self.view = view
407-
self.log = urwid.SimpleFocusListWalker(topics_btn_list)
408-
self.topics_btn_list = topics_btn_list
409410
self.stream_button = stream_button
410-
self.focus_index_before_search = 0
411+
# Topic List
412+
self.topics_btn_list = topics_btn_list
413+
self.log = urwid.SimpleFocusListWalker(topics_btn_list)
411414
self.list_box = urwid.ListBox(self.log)
415+
# Topic Search
416+
self.empty_search = False
417+
self.focus_index_before_search = 0
418+
self.search_lock = threading.Lock()
412419
self.topic_search_box = PanelSearchBox(
413420
self, "SEARCH_TOPICS", self.update_topics
414421
)
415422
self.header_list = urwid.Pile(
416423
[self.stream_button, urwid.Divider("─"), self.topic_search_box]
417424
)
425+
418426
super().__init__(
419427
self.list_box,
420428
header=urwid.LineBox(
@@ -429,8 +437,6 @@ def __init__(
429437
brcorner="─",
430438
),
431439
)
432-
self.search_lock = threading.Lock()
433-
self.empty_search = False
434440

435441
@asynch
436442
def update_topics(self, search_box: Any, new_text: str) -> None:

0 commit comments

Comments
 (0)