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
98cef37e
Commit
98cef37e
authored
Aug 27, 2019
by
Fjen Undso
Browse files
hotkeys with shift
parent
b1ea2f3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
nchl.py
View file @
98cef37e
...
...
@@ -10,6 +10,9 @@ from gui.progressbar import ProgressBar
from
gui.container.focusswitcher
import
FocusSwitcher
from
gui.container.numberbar
import
NumberBarContainer
PIXEL_COUNT
=
42
IP_ADDRESS
=
"10.0.0.255"
class
NCHL
:
fs_main
=
None
...
...
@@ -21,8 +24,8 @@ class NCHL:
def
__init__
(
self
,
screen
):
self
.
screen
=
screen
self
.
logger
=
logging
.
getLogger
(
__name__
)
self
.
strips
=
[
LEDStrip
(
host_id
=
i
)
for
i
in
range
(
1
,
9
)]
self
.
strips_all
=
LEDStrip
()
self
.
strips
=
[
LEDStrip
(
host_id
=
i
,
pixel_count
=
PIXEL_COUNT
,
address
=
IP_ADDRESS
)
for
i
in
range
(
1
,
9
)]
self
.
strips_all
=
LEDStrip
(
pixel_count
=
PIXEL_COUNT
,
address
=
IP_ADDRESS
)
# hide cursor
curses
.
curs_set
(
0
)
...
...
@@ -127,13 +130,13 @@ class NCHL:
window
=
self
.
screen
,
col
=
scr_center_x
-
12
,
row
=
18
,
toggle_key_unfocused
=
"
c
"
,
text
=
"(
c
)ontinuous updating"
,
toggle_key_unfocused
=
"
C
"
,
text
=
"(
C
)ontinuous updating"
,
)
self
.
screen
.
addstr
(
19
,
scr_center_x
-
20
,
"(
s
)end | all (
o
)ff | all (
w
)hite | (
q
)uit"
,
"(
S
)end | all (
O
)ff | all (
W
)hite | (
Q
)uit"
,
curses
.
color_pair
(
curses
.
COLOR_YELLOW
),
)
...
...
@@ -153,21 +156,21 @@ class NCHL:
self
.
fs_main
.
send_key
(
k
)
# quit
if
k
==
"
q
"
:
if
k
==
"
Q
"
:
break
# all off:
if
k
==
"
o
"
:
if
k
==
"
O
"
:
self
.
strips_all
.
set_all
([
0
]
*
4
)
self
.
strips_all
.
send
()
continue
# all white
if
k
==
"
w
"
:
if
k
==
"
W
"
:
self
.
strips_all
.
set_all
([
0
,
255
,
100
,
255
])
self
.
strips_all
.
send
()
continue
# send values to ESPs
if
k
==
"
s
"
or
self
.
continous
.
active
:
color
=
[
self
.
numbers
[
i
].
value
for
i
in
range
(
1
,
4
)]
if
k
==
"
S
"
or
self
.
continous
.
active
:
color
=
[
self
.
numbers
[
i
].
value
for
i
in
range
(
0
,
4
)]
for
e
in
self
.
checkboxes_top
+
self
.
checkboxes_bottom
:
if
e
.
active
:
self
.
strips
[
e
.
name
].
set_all
(
color
)
...
...
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