Skip to content
Snippets Groups Projects
Commit 269d60c3 authored by Mark Tearle's avatar Mark Tearle
Browse files

Widgets put into layout

Display widget added
parent 4dd48502
Branches
Tags
No related merge requests found
...@@ -8,38 +8,46 @@ class ContainedMultiSelect(npyscreen.BoxTitle): ...@@ -8,38 +8,46 @@ class ContainedMultiSelect(npyscreen.BoxTitle):
class VirtualSnack(npyscreen.Form): class VirtualSnack(npyscreen.Form):
def while_waiting(self): def while_waiting(self):
self.date_widget.value = datetime.now() self.date_widget.value = datetime.now().ctime()
self.display() self.display()
def create(self, *args, **keywords): def create(self, *args, **keywords):
super(VirtualSnack, self).create(*args, **keywords) super(VirtualSnack, self).create(*args, **keywords)
self.wStatus1 = self.add(npyscreen.FixedText, value="Last Command", editable=False)
self.textdisplay = self.add(npyscreen.FixedText, value="*5N4CK0RZ*", editable=False, relx=9)
self.textdisplay.important = True
self.kpbuttons = []
kpx = 1
kpy = 1
for keypad in range(0,10):
kpx = ((keypad % 4) * 6 ) + 3
kpy = int(keypad / 4) + 4
self.kpbuttons.append(self.add(npyscreen.MiniButton,name="%d"%keypad, relx = kpx, rely = kpy))
self.reset= self.add(npyscreen.MiniButton,name="RESET", relx = kpx + 7, rely = kpy)
self.wStatus2 = self.add(npyscreen.FixedText, value="", editable=False) self.dip = self.add(npyscreen.MultiSelect, name = "Door", max_width=15, relx = 4, rely = 10, max_height=4, value = [], values = ["DOOR"], scroll_exit=True)
self.wStatus1.important = True self.dip = self.add(npyscreen.MultiSelect, name = "DIP Switch", max_width = 45, rely =3, relx = 30, max_height=10, value = [], values = ["DIP1", "DIP2", "DIP3","DIP4","DIP5","DIP6","DIP7","DIP8"], scroll_exit=True)
self.date_widget = self.add(npyscreen.FixedText, value=datetime.now(), editable=False)
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.nickel= self.add(npyscreen.MiniButton,name="0.05", rely= 3, relx=50)
self.dip = self.add(npyscreen.MultiSelect, name = "Door", max_width=15, relx = 2, max_height=4, value = [], values = ["DOOR"], scroll_exit=True) self.dime= self.add(npyscreen.MiniButton,name="0.10", relx=50)
self.quarter= self.add(npyscreen.MiniButton,name="0.25", relx=50)
self.dollar= self.add(npyscreen.MiniButton,name="1.00", relx=50)
self.nickel= self.add(npyscreen.MiniButton,name="0.05") self.mode= self.add(npyscreen.MiniButton,name="MODE", relx=50)
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.wStatus1 = self.add(npyscreen.FixedText, value="Last Command", editable=False, relx=2, rely=12)
self.reset= self.add(npyscreen.MiniButton,name="RESET") self.wStatus1.important = True
self.kpbuttons = [] self.wStatus2 = self.add(npyscreen.FixedText, value="", editable=False)
for keypad in range(0,10):
self.kpbuttons.append(self.add(npyscreen.MiniButton,name="%d"%keypad))
self.date_widget = self.add(npyscreen.FixedText, value=datetime.now().ctime(), editable=False)
self.date_widget.value = "Hello"
self.add_handlers({"^T": self.exit_application})
def exit_application(self,name): def exit_application(self,name):
self.parentApp.setNextForm(None) self.parentApp.setNextForm(None)
......
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