1
1
import curses
2
2
import ipaddress
3
+ from ui .colors import get_color
3
4
4
5
def get_user_input (prompt ):
5
6
# Calculate the dynamic height and width for the input window
@@ -10,6 +11,8 @@ def get_user_input(prompt):
10
11
11
12
# Create a new window for user input
12
13
input_win = curses .newwin (height , width , start_y , start_x )
14
+ input_win .bkgd (get_color ("background" ))
15
+ input_win .attrset (get_color ("window_frame" ))
13
16
input_win .border ()
14
17
15
18
# Display the prompt
@@ -54,6 +57,8 @@ def get_bool_selection(message, current_value):
54
57
start_x = (curses .COLS - width ) // 2
55
58
56
59
bool_win = curses .newwin (height , width , start_y , start_x )
60
+ bool_win .bkgd (get_color ("background" ))
61
+ bool_win .attrset (get_color ("window_frame" ))
57
62
bool_win .keypad (True )
58
63
59
64
while True :
@@ -63,9 +68,9 @@ def get_bool_selection(message, current_value):
63
68
64
69
for idx , option in enumerate (options ):
65
70
if idx == selected_index :
66
- bool_win .addstr (idx + 3 , 4 , option , curses . A_REVERSE )
71
+ bool_win .addstr (idx + 3 , 4 , option , get_color ( "settings_default" , reverse = True ) )
67
72
else :
68
- bool_win .addstr (idx + 3 , 4 , option )
73
+ bool_win .addstr (idx + 3 , 4 , option , get_color ( "settings_default" ) )
69
74
70
75
bool_win .refresh ()
71
76
key = bool_win .getch ()
@@ -87,6 +92,8 @@ def get_repeated_input(current_value):
87
92
start_x = (curses .COLS - width ) // 2
88
93
89
94
repeated_win = curses .newwin (height , width , start_y , start_x )
95
+ repeated_win .bkgd (get_color ("background" ))
96
+ repeated_win .attrset (get_color ("window_frame" ))
90
97
repeated_win .keypad (True ) # Enable keypad for special keys
91
98
92
99
curses .echo ()
@@ -128,18 +135,20 @@ def get_enum_input(options, current_value):
128
135
start_x = (curses .COLS - width ) // 2
129
136
130
137
enum_win = curses .newwin (height , width , start_y , start_x )
138
+ enum_win .bkgd (get_color ("background" ))
139
+ enum_win .attrset (get_color ("window_frame" ))
131
140
enum_win .keypad (True )
132
141
133
142
while True :
134
143
enum_win .clear ()
135
144
enum_win .border ()
136
- enum_win .addstr (1 , 2 , "Select an option:" , curses . A_BOLD )
145
+ enum_win .addstr (1 , 2 , "Select an option:" , get_color ( "settings_default" , bold = True ) )
137
146
138
147
for idx , option in enumerate (options ):
139
148
if idx == selected_index :
140
- enum_win .addstr (idx + 2 , 4 , option , curses . A_REVERSE )
149
+ enum_win .addstr (idx + 2 , 4 , option , get_color ( "settings_default" , reverse = True ) )
141
150
else :
142
- enum_win .addstr (idx + 2 , 4 , option )
151
+ enum_win .addstr (idx + 2 , 4 , option , get_color ( "settings_default" ) )
143
152
144
153
enum_win .refresh ()
145
154
key = enum_win .getch ()
@@ -163,6 +172,8 @@ def get_fixed32_input(current_value):
163
172
start_x = (curses .COLS - width ) // 2
164
173
165
174
fixed32_win = curses .newwin (height , width , start_y , start_x )
175
+ fixed32_win .bkgd (get_color ("background" ))
176
+ fixed32_win .attrset (get_color ("window_frame" ))
166
177
fixed32_win .keypad (True )
167
178
168
179
curses .echo ()
0 commit comments