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
e07c9a28
Commit
e07c9a28
authored
Aug 27, 2019
by
Fjen Undso
Browse files
black code
parent
9d2d5e52
Changes
5
Hide whitespace changes
Inline
Side-by-side
gui/checkbox.py
View file @
e07c9a28
...
...
@@ -12,8 +12,17 @@ class CheckBox(Drawable):
toggle_key_unfocused: Key to toggle the state without focus.
"""
def
__init__
(
self
,
*
,
window
,
row
=
0
,
col
=
0
,
text
=
None
,
name
=
None
,
toggle_key
=
None
,
toggle_key_unfocused
=
None
):
def
__init__
(
self
,
*
,
window
,
row
=
0
,
col
=
0
,
text
=
None
,
name
=
None
,
toggle_key
=
None
,
toggle_key_unfocused
=
None
):
self
.
text
=
text
self
.
name
=
name
self
.
toggle_key
=
toggle_key
...
...
gui/curseshandler.py
View file @
e07c9a28
...
...
@@ -14,8 +14,7 @@ class CursesHandler(logging.Handler):
win_log
.
idlok
(
True
)
win_log
.
leaveok
(
True
)
self
.
screen
=
win_log
formatter
=
logging
.
Formatter
(
'%(name) -10s | %(levelname) -5s | %(message)s'
)
formatter
=
logging
.
Formatter
(
"%(name) -10s | %(levelname) -5s | %(message)s"
)
self
.
setFormatter
(
formatter
)
def
emit
(
self
,
record
):
...
...
gui/numberrange.py
View file @
e07c9a28
...
...
@@ -15,9 +15,20 @@ class NumberRange(Drawable):
next_key: Key to decrease number value.
"""
def
__init__
(
self
,
*
,
window
,
row
=
0
,
col
=
0
,
value
=
0
,
min_value
=
0
,
max_value
=
255
,
text
=
''
,
attr
=
curses
.
A_STANDOUT
,
prev_key
=
None
,
next_key
=
None
):
def
__init__
(
self
,
*
,
window
,
row
=
0
,
col
=
0
,
value
=
0
,
min_value
=
0
,
max_value
=
255
,
text
=
""
,
attr
=
curses
.
A_STANDOUT
,
prev_key
=
None
,
next_key
=
None
):
self
.
value
=
value
self
.
min
=
min_value
self
.
max
=
max_value
...
...
gui/progressbar.py
View file @
e07c9a28
...
...
@@ -14,10 +14,21 @@ class ProgressBar(Drawable):
attr: Curses attribute of the progress indicator.
"""
def
__init__
(
self
,
*
,
window
,
row
=
0
,
col
=
0
,
width
=
0
,
height
=
0
,
value
=
0
,
max_value
=
100
,
text
=
''
,
attr
=
curses
.
A_STANDOUT
):
assert
(
width
>
2
)
assert
(
height
>
2
)
def
__init__
(
self
,
*
,
window
,
row
=
0
,
col
=
0
,
width
=
0
,
height
=
0
,
value
=
0
,
max_value
=
100
,
text
=
""
,
attr
=
curses
.
A_STANDOUT
):
assert
width
>
2
assert
height
>
2
self
.
value
=
value
self
.
max
=
max_value
self
.
text
=
text
...
...
@@ -28,8 +39,7 @@ class ProgressBar(Drawable):
if
len
(
self
.
text
)
>
width
:
self
.
window
.
addstr
(
self
.
text
)
else
:
self
.
window
.
addstr
(
0
,
(
width
-
len
(
self
.
text
))
//
2
,
self
.
text
)
self
.
window
.
addstr
(
0
,
(
width
-
len
(
self
.
text
))
//
2
,
self
.
text
)
# inner box
self
.
width
=
width
-
2
self
.
height
=
height
-
2
...
...
@@ -37,7 +47,7 @@ class ProgressBar(Drawable):
self
,
window
=
window
.
subwin
(
self
.
height
,
self
.
width
,
row
+
1
,
col
+
1
),
row
=
row
+
1
,
col
=
col
+
1
col
=
col
+
1
,
)
def
draw
(
self
):
...
...
@@ -46,7 +56,7 @@ class ProgressBar(Drawable):
top
=
self
.
height
-
int
(
self
.
value
/
self
.
max
*
self
.
height
)
bottom
=
self
.
height
for
i
in
range
(
top
,
bottom
):
self
.
window
.
insstr
(
i
,
0
,
' '
*
self
.
width
,
self
.
attr
)
self
.
window
.
insstr
(
i
,
0
,
" "
*
self
.
width
,
self
.
attr
)
self
.
window
.
refresh
()
def
set
(
self
,
value
):
...
...
nchl.py
View file @
e07c9a28
...
...
@@ -24,7 +24,10 @@ class NCHL:
def
__init__
(
self
,
screen
):
self
.
screen
=
screen
self
.
logger
=
logging
.
getLogger
(
__name__
)
self
.
strips
=
[
LEDStrip
(
host_id
=
i
,
pixel_count
=
PIXEL_COUNT
,
address
=
IP_ADDRESS
)
for
i
in
range
(
1
,
9
)]
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
...
...
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