Commit 0a1fe1ac authored by Fjen Undso's avatar Fjen Undso
Browse files

c.py: pep8 stuff

parent 18e54a8a
......@@ -176,6 +176,7 @@ class NumberProgressContainer(FocusSwitcher):
super().__init__(elements=elements, prev_key=None, next_key=None)
def send_key(self, key):
"""Same as FocusSwitcher, but sets ProgressBar.value to NumberRange.value"""
super().send_key(key)
val = 0
for e in self.elements:
......@@ -213,7 +214,8 @@ class ProgressBar:
if len(self.text) > self.width:
self.window.addstr(self.text)
else:
self.window.addstr(0, (self.width - len(self.text)) // 2, self.text)
self.window.addstr(
0, (self.width - len(self.text)) // 2, self.text)
# draw bar
top = self.height - 1 - int(self.value / self.max * (self.height - 2))
......@@ -262,11 +264,12 @@ def main(stdscr):
('G', curses.COLOR_GREEN),
('B', curses.COLOR_BLUE),
('W', curses.COLOR_WHITE)
]
]
progress_bars = [
ProgressBar(stdscr,
ProgressBar(
stdscr,
row=0,
col=i*8,
col=i * 8,
width=5,
height=12,
max_value=255,
......@@ -275,23 +278,31 @@ def main(stdscr):
numbers = [
NumberRange(
stdscr,
col = i*8,
col=i * 8,
row=12,
value=i,
prev_key='KEY_DOWN',
next_key='KEY_UP') for i in range(len(numbers_text))]
fs_pbn = [NumberProgressContainer(elements=i) for i in zip(numbers, progress_bars)]
fs_n = FocusSwitcher(elements=fs_pbn, prev_key='KEY_LEFT', next_key='KEY_RIGHT')
fs_pbn = [
NumberProgressContainer(
elements=i) for i in zip(numbers, progress_bars)]
fs_n = FocusSwitcher(
elements=fs_pbn,
prev_key='KEY_LEFT',
next_key='KEY_RIGHT')
checkboxes = [
CheckBox(
stdscr,
col=0,
row=i+13,
row=i + 13,
toggle_key=' ',
text='ESP' +
str(i)) for i in range(1,9)]
fs_cb = FocusSwitcher(elements=checkboxes, prev_key='KEY_UP', next_key='KEY_DOWN')
str(i)) for i in range(1, 9)]
fs_cb = FocusSwitcher(
elements=checkboxes,
prev_key='KEY_UP',
next_key='KEY_DOWN')
fs_main = FocusSwitcher(elements=[fs_n, fs_cb], prev_key='\t')
fs_main.toggle_focus()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment