ATLAS Offline Software
Loading...
Searching...
No Matches
modals.py
Go to the documentation of this file.
1# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2
3import curses.textpad
4
5
6class Modal:
8 self, start_x: int, start_y: int, width: int, height: int
9 ) -> None:
10 self.width: int = width
11 self.height: int = height
12 self.start_x: int = start_x
13 self.start_y: int = start_y
14 self.window = curses.newwin(height, width, start_y, start_x)
15 self.window.box()
16 self.refresh()
17
18 def refresh(self) -> None:
19 self.window.refresh()
20
21 def destroy(self) -> None:
22 del self.window
23
24
27 self, start_x: int, start_y: int, width: int, height: int
28 ) -> None:
29 super().__init__(start_x, start_y, width, height)
30 self.search_window = self.window.derwin(
31 self.height - 2, self.width - 2, 1, 1
32 )
33 self.search = curses.textpad.Textbox(self.search_window)
34
35 def edit(self) -> str:
36 return self.search.edit().strip()
37
38
41 self, start_x: int, start_y: int, width: int, height: int
42 ) -> None:
43 super().__init__(start_x, start_y, width, height)
44 self.help_window = self.window.derwin(
45 self.height - 2, self.width - 2, 1, 1
46 )
47
48 self.begin_y, self.begin_x = self.window.getparyx()
49 self.y, self.x = self.begin_y, self.begin_x
50 self.y += 2
51 self.x += 2
52
53 def add_line(self, text: str, blank_lines: int = 1) -> None:
54 self.window.addstr(self.y, self.x, text)
55 self.y += blank_lines
56
57 def show_help(self) -> None:
58 pass
59
60
61class SingleHelpModal(HelpModal):
62 def show_help(self) -> None:
63
64 self.add_line("Help", 2)
65
66 self.add_line("Arrows for navigation", 2)
67
68 self.add_line("h - display this help")
69 self.add_line("m - search")
70 self.add_line("space - mark/unmark")
71 self.add_line("r - refresh the screen", 2)
72
73 self.add_line("q - quit the program")
74
75 self.refresh()
76
77
79 def show_help(self) -> None:
80
81 self.add_line("Help", 2)
82
83 self.add_line("Arrows for navigation", 2)
84
85 self.add_line("tab - change column")
86
87 self.add_line("h - display this help")
88 self.add_line("m - search")
89 self.add_line("space - mark/unmark")
90 self.add_line("r - refresh the screen", 2)
91
92 self.add_line("q - quit the program")
93
94 self.refresh()
None add_line(self, str text, int blank_lines=1)
Definition modals.py:53
None __init__(self, int start_x, int start_y, int width, int height)
Definition modals.py:42
None __init__(self, int start_x, int start_y, int width, int height)
Definition modals.py:9
None __init__(self, int start_x, int start_y, int width, int height)
Definition modals.py:28