Skip to content

Commit 51e5344

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 8f3b193 commit 51e5344

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

zulipterminal/ui_tools/views.py

+15-9
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,18 @@ def __init__(self) -> None:
285285
class StreamsView(urwid.Frame):
286286
def __init__(self, streams_btn_list: List[Any], view: Any) -> None:
287287
self.view = view
288-
self.log = urwid.SimpleFocusListWalker(streams_btn_list)
288+
# Stream List
289289
self.streams_btn_list = streams_btn_list
290-
self.focus_index_before_search = 0
290+
self.log = urwid.SimpleFocusListWalker(streams_btn_list)
291291
list_box = urwid.ListBox(self.log)
292+
# Stream Search
293+
self.empty_search = False
294+
self.focus_index_before_search = 0
295+
self.search_lock = threading.Lock()
292296
self.stream_search_box = PanelSearchBox(
293297
self, "SEARCH_STREAMS", self.update_streams
294298
)
299+
295300
super().__init__(
296301
list_box,
297302
header=urwid.LineBox(
@@ -306,8 +311,6 @@ def __init__(self, streams_btn_list: List[Any], view: Any) -> None:
306311
brcorner="─",
307312
),
308313
)
309-
self.search_lock = threading.Lock()
310-
self.empty_search = False
311314

312315
@asynch
313316
def update_streams(self, search_box: Any, new_text: str) -> None:
@@ -384,17 +387,22 @@ def __init__(
384387
self, topics_btn_list: List[Any], view: Any, stream_button: Any
385388
) -> None:
386389
self.view = view
387-
self.log = urwid.SimpleFocusListWalker(topics_btn_list)
388-
self.topics_btn_list = topics_btn_list
389390
self.stream_button = stream_button
390-
self.focus_index_before_search = 0
391+
# Topic List
392+
self.topics_btn_list = topics_btn_list
393+
self.log = urwid.SimpleFocusListWalker(topics_btn_list)
391394
self.list_box = urwid.ListBox(self.log)
395+
# Topic Search
396+
self.empty_search = False
397+
self.focus_index_before_search = 0
398+
self.search_lock = threading.Lock()
392399
self.topic_search_box = PanelSearchBox(
393400
self, "SEARCH_TOPICS", self.update_topics
394401
)
395402
self.header_list = urwid.Pile(
396403
[self.stream_button, urwid.Divider("─"), self.topic_search_box]
397404
)
405+
398406
super().__init__(
399407
self.list_box,
400408
header=urwid.LineBox(
@@ -409,8 +417,6 @@ def __init__(
409417
brcorner="─",
410418
),
411419
)
412-
self.search_lock = threading.Lock()
413-
self.empty_search = False
414420

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

0 commit comments

Comments
 (0)