acn/rtx
acn
/
rtx
1
0
Fork 0

send_status added, cept.HOME added

This commit is contained in:
acn 2016-06-06 16:52:53 +02:00
parent 9e1ee97095
commit b245761134
2 changed files with 19 additions and 14 deletions

View File

@ -20,6 +20,7 @@ LEFT = "\x08"
RIGHT = "\x09"
DOWN = "\x0a"
UP = "\x0b"
HOME = "\x1e"
clear_line24 = (
"\x1f\x58\x41" # Cursor Zeile 24, Spalte 0

View File

@ -60,18 +60,7 @@ class rtxMask:
zeile = zeile[:pos-1] + char + zeile[pos:]
answers[line] = zeile
"""
def _cut_off_rest_of_line(self, line, pos):
""" erases the rest of the line from the 'lines' variable and from the screen """
zeile = self.answers[line]
self.answers[line] = zeile[:pos]
if zeile[pos:] != "":
numOfSpaces = len(zeile[pos:])
spaces = " " * numOfSpaces
backSpaces = cept.BSP * numOfSpaces
glob.ser.write(bytes(spaces + backSpaces, "latin-1"))
"""
def process_input(self):
""" reads the input from the client, fills the mask and gets the input """
@ -100,8 +89,8 @@ class rtxMask:
# go to the beginning of the next line
# or finish the mask
if posy == len(lines)-1:
# this was the last line, now send the data
# TODO: weitermachen
weiter = False
self._send_data()
else:
# go to the beginning of the next line
posy += 1
@ -135,8 +124,14 @@ class rtxMask:
posx += 1
else:
echostr = ""
elif instr == cept.HOME:
posy = 0
posx = 0
self._pos_cur_to_line(lines[posy])
echostr = ""
elif instr == cept.SEND: # ist das DCT??
# TODO: send data
weiter = False
self._send_data()
elif instr.isalnum():
# "normal" input
# TODO: lineinput == Zeilenende beachten
@ -149,4 +144,13 @@ class rtxMask:
# now send the echo
glob.ser.write(bytes(echostr, "latin-1"))
def _send_data(self):
""" strip spaces from the right of the answers and save them """
new_answers = []
for answer in self.answers:
temp = answer.rstrip()
new_answers.append(temp)
self.answers = new_answers