Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Fjen Undso
nchl
Commits
eb553edc
Commit
eb553edc
authored
Jan 23, 2018
by
Fjen Undso
Browse files
nchl: center elements
parent
99352034
Changes
1
Hide whitespace changes
Inline
Side-by-side
nchl.py
View file @
eb553edc
...
...
@@ -16,6 +16,8 @@ from gui.container.numberbar import NumberBarContainer
def
main
(
stdscr
):
stdscr
.
clear
()
maxy
,
maxx
=
stdscr
.
getmaxyx
()
scr_center_x
=
maxx
//
2
# hide cursor
curses
.
curs_set
(
0
)
# init colors
...
...
@@ -32,7 +34,9 @@ def main(stdscr):
logger
.
addHandler
(
CursesHandler
(
stdscr
))
logger
.
setLevel
(
logging
.
INFO
)
stdscr
.
addstr
(
0
,
2
,
"nchl - ncurses HoneyLight control"
,
curses
.
A_BOLD
)
# draw title
title
=
"nchl - ncurses HoneyLight control"
stdscr
.
addstr
(
0
,
scr_center_x
-
len
(
title
)
//
2
,
title
,
curses
.
A_BOLD
)
# draw colors
numbers_text
=
[
...
...
@@ -45,7 +49,7 @@ def main(stdscr):
ProgressBar
(
window
=
stdscr
,
row
=
1
,
col
=
4
+
i
*
8
,
col
=
scr_center_x
-
1
4
+
i
*
8
,
width
=
5
,
height
=
12
,
value
=
255
,
...
...
@@ -55,7 +59,7 @@ def main(stdscr):
numbers
=
[
NumberRange
(
window
=
stdscr
,
col
=
4
+
i
*
8
,
col
=
scr_center_x
-
14
+
i
*
8
,
row
=
13
,
value
=
255
,
prev_key
=
'KEY_DOWN'
,
...
...
@@ -72,7 +76,7 @@ def main(stdscr):
checkboxes_top
=
[
CheckBox
(
window
=
stdscr
,
col
=
i
//
2
*
11
,
col
=
scr_center_x
-
21
+
i
//
2
*
11
,
row
=
15
,
toggle_key
=
' '
,
toggle_key_unfocused
=
str
(
i
),
...
...
@@ -81,7 +85,7 @@ def main(stdscr):
checkboxes_bottom
=
[
CheckBox
(
window
=
stdscr
,
col
=
(
i
-
1
)
//
2
*
11
,
col
=
scr_center_x
-
21
+
(
i
-
1
)
//
2
*
11
,
row
=
16
,
toggle_key
=
' '
,
toggle_key_unfocused
=
str
(
i
),
...
...
@@ -93,8 +97,13 @@ def main(stdscr):
next_key
=
'KEY_RIGHT'
)
# draw settings
continous
=
CheckBox
(
window
=
stdscr
,
col
=
6
,
row
=
18
,
toggle_key_unfocused
=
'c'
,
text
=
'(C)ontinuous updating'
)
stdscr
.
addstr
(
20
,
8
,
'S to send, Q to quit'
,
curses
.
color_pair
(
curses
.
COLOR_YELLOW
))
continous
=
CheckBox
(
window
=
stdscr
,
col
=
scr_center_x
-
12
,
row
=
18
,
toggle_key_unfocused
=
'c'
,
text
=
'(C)ontinuous updating'
)
stdscr
.
addstr
(
19
,
scr_center_x
-
10
,
'S to send, Q to quit'
,
curses
.
color_pair
(
curses
.
COLOR_YELLOW
))
# focusswitcher
fs_n_cb
=
FocusSwitcher
(
elements
=
[
fs_n
,
fs_cb
],
prev_key
=
'
\t
'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment