Commit 9e9d7af9 authored by Mark Tearle's avatar Mark Tearle

Make text display work

parent 0aefbe33
...@@ -33,14 +33,14 @@ class VirtualSnack(npyscreen.Form): ...@@ -33,14 +33,14 @@ class VirtualSnack(npyscreen.Form):
self.date_widget.value = datetime.now().ctime() self.date_widget.value = datetime.now().ctime()
self.sentfield.value = self.parentApp.sent self.sentfield.value = self.parentApp.sent
self.receivedfield.value = self.parentApp.received self.receivedfield.value = self.parentApp.received
self.textdisplay.value = self.parentApp.textdisplay
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.textdisplay = self.add(npyscreen.FixedText, value=self.parentApp.textdisplay, editable=False, relx=9)
self.textdisplay = self.add(npyscreen.FixedText, value="*5N4CK0RZ*", editable=False, relx=9)
self.textdisplay.important = True self.textdisplay.important = True
self.kpbuttons = [] self.kpbuttons = []
...@@ -86,6 +86,12 @@ class VirtualSnackApp(npyscreen.NPSAppManaged): ...@@ -86,6 +86,12 @@ class VirtualSnackApp(npyscreen.NPSAppManaged):
keypress_timeout_default = 1 keypress_timeout_default = 1
def onStart(self): def onStart(self):
# initialise virtual vending machine
# vending machine password set here
self.vendpw = "AAAAAAAAAAAAAAAA"
self.switches = Switches()
self.textdisplay = "*5N4CK0RZ*"
self.addForm("MAIN", VirtualSnack, name="Virtual Snack") self.addForm("MAIN", VirtualSnack, name="Virtual Snack")
# socket code # socket code
...@@ -218,9 +224,7 @@ Mark Tearle, October 2014 ...@@ -218,9 +224,7 @@ Mark Tearle, October 2014
self.do_send("100 Vend successful\n") self.do_send("100 Vend successful\n")
def do_display(self,string): def do_display(self,string):
# FIXME self.textdisplay = "%-10.10s" % (string)
# display = self.wTree.get_widget("label1")
# display.set_text("%-10.10s" % (string))
self.do_send('300 Written\n') self.do_send('300 Written\n')
def do_beep(self,command): def do_beep(self,command):
...@@ -238,7 +242,6 @@ Mark Tearle, October 2014 ...@@ -238,7 +242,6 @@ Mark Tearle, October 2014
def handle_command(self, command): def handle_command(self, command):
command = string.upper(command) command = string.upper(command)
print command
if string.find(command, "HELP",0) == 0: if string.find(command, "HELP",0) == 0:
self.do_help() self.do_help()
elif string.find(command, "ABOUT",0) == 0: elif string.find(command, "ABOUT",0) == 0:
...@@ -318,11 +321,7 @@ if __name__ == "__main__": ...@@ -318,11 +321,7 @@ if __name__ == "__main__":
# #
# display.set_text("*5N4CK0RZ*") # display.set_text("*5N4CK0RZ*")
# #
# # vending machine password set here
# self.vendpw = "AAAAAAAAAAAAAAAA"
#
# self.messageid = None # self.messageid = None
# self.switches = Switches()
# #
# #s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # #s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# #s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1) # #s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
......
Markdown is supported
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