ATLAS Offline Software
Loading...
Searching...
No Matches
Control
AthenaConfiguration
python
iconfTool
gui
modals.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2
3
import
curses.textpad
4
5
6
class
Modal
:
7
def
__init__
(
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
25
class
SearchModal
(
Modal
):
26
def
__init__
(
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
39
class
HelpModal
(
Modal
):
40
def
__init__
(
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
61
class
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
78
class
DoubleHelpModal
(
HelpModal
):
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
()
SiliconTech::strip
@ strip
Definition
FPGATrackSimTypes.h:25
python.iconfTool.gui.modals.DoubleHelpModal
Definition
modals.py:78
python.iconfTool.gui.modals.DoubleHelpModal.show_help
None show_help(self)
Definition
modals.py:79
python.iconfTool.gui.modals.HelpModal
Definition
modals.py:39
python.iconfTool.gui.modals.HelpModal.show_help
None show_help(self)
Definition
modals.py:57
python.iconfTool.gui.modals.HelpModal.help_window
help_window
Definition
modals.py:44
python.iconfTool.gui.modals.HelpModal.begin_y
begin_y
Definition
modals.py:48
python.iconfTool.gui.modals.HelpModal.begin_x
begin_x
Definition
modals.py:48
python.iconfTool.gui.modals.HelpModal.y
y
Definition
modals.py:49
python.iconfTool.gui.modals.HelpModal.x
x
Definition
modals.py:49
python.iconfTool.gui.modals.HelpModal.add_line
None add_line(self, str text, int blank_lines=1)
Definition
modals.py:53
python.iconfTool.gui.modals.HelpModal.__init__
None __init__(self, int start_x, int start_y, int width, int height)
Definition
modals.py:42
python.iconfTool.gui.modals.Modal
Definition
modals.py:6
python.iconfTool.gui.modals.Modal.width
int width
Definition
modals.py:10
python.iconfTool.gui.modals.Modal.height
int height
Definition
modals.py:11
python.iconfTool.gui.modals.Modal.refresh
None refresh(self)
Definition
modals.py:18
python.iconfTool.gui.modals.Modal.start_x
int start_x
Definition
modals.py:12
python.iconfTool.gui.modals.Modal.start_y
int start_y
Definition
modals.py:13
python.iconfTool.gui.modals.Modal.window
window
Definition
modals.py:14
python.iconfTool.gui.modals.Modal.destroy
None destroy(self)
Definition
modals.py:21
python.iconfTool.gui.modals.Modal.__init__
None __init__(self, int start_x, int start_y, int width, int height)
Definition
modals.py:9
python.iconfTool.gui.modals.SearchModal
Definition
modals.py:25
python.iconfTool.gui.modals.SearchModal.edit
str edit(self)
Definition
modals.py:35
python.iconfTool.gui.modals.SearchModal.__init__
None __init__(self, int start_x, int start_y, int width, int height)
Definition
modals.py:28
python.iconfTool.gui.modals.SearchModal.search
search
Definition
modals.py:33
python.iconfTool.gui.modals.SearchModal.search_window
search_window
Definition
modals.py:30
python.iconfTool.gui.modals.SingleHelpModal.show_help
None show_help(self)
Definition
modals.py:62
Generated on
for ATLAS Offline Software by
1.14.0