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
UCC
virtualsnack
Commits
4dd48502
Commit
4dd48502
authored
Oct 12, 2014
by
Mark Tearle
Browse files
Add initial widgets for buttons
parent
8caba669
Changes
2
Hide whitespace changes
Inline
Side-by-side
buttons
View file @
4dd48502
...
...
@@ -11,10 +11,13 @@ RESET
0
9
2
0.05
0.10
0.25
$1
MODE
DIP1
DIP2
...
...
@@ -24,4 +27,5 @@ DIP5
DIP6
DIP7
DIP8
DOOR
virtualsnack.py
View file @
4dd48502
...
...
@@ -2,6 +2,9 @@
import
npyscreen
from
datetime
import
datetime
class
ContainedMultiSelect
(
npyscreen
.
BoxTitle
):
_contained_widget
=
npyscreen
.
TitleMultiSelect
class
VirtualSnack
(
npyscreen
.
Form
):
def
while_waiting
(
self
):
...
...
@@ -22,6 +25,21 @@ class VirtualSnack(npyscreen.Form):
self
.
date_widget
.
value
=
"Hello"
self
.
add_handlers
({
"^T"
:
self
.
exit_application
})
self
.
dip
=
self
.
add
(
npyscreen
.
MultiSelect
,
name
=
"DIP Switch"
,
max_width
=
45
,
relx
=
2
,
max_height
=
10
,
value
=
[],
values
=
[
"DIP1"
,
"DIP2"
,
"DIP3"
,
"DIP4"
,
"DIP5"
,
"DIP6"
,
"DIP7"
,
"DIP8"
],
scroll_exit
=
True
)
self
.
dip
=
self
.
add
(
npyscreen
.
MultiSelect
,
name
=
"Door"
,
max_width
=
15
,
relx
=
2
,
max_height
=
4
,
value
=
[],
values
=
[
"DOOR"
],
scroll_exit
=
True
)
self
.
nickel
=
self
.
add
(
npyscreen
.
MiniButton
,
name
=
"0.05"
)
self
.
dime
=
self
.
add
(
npyscreen
.
MiniButton
,
name
=
"0.10"
)
self
.
quarter
=
self
.
add
(
npyscreen
.
MiniButton
,
name
=
"0.25"
)
self
.
dollar
=
self
.
add
(
npyscreen
.
MiniButton
,
name
=
"1.00"
)
self
.
mode
=
self
.
add
(
npyscreen
.
MiniButton
,
name
=
"MODE"
)
self
.
reset
=
self
.
add
(
npyscreen
.
MiniButton
,
name
=
"RESET"
)
self
.
kpbuttons
=
[]
for
keypad
in
range
(
0
,
10
):
self
.
kpbuttons
.
append
(
self
.
add
(
npyscreen
.
MiniButton
,
name
=
"%d"
%
keypad
))
def
exit_application
(
self
,
name
):
self
.
parentApp
.
setNextForm
(
None
)
...
...
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