send_status added, cept.HOME added
This commit is contained in:
parent
9e1ee97095
commit
b245761134
1
cept.py
1
cept.py
@ -20,6 +20,7 @@ LEFT = "\x08"
|
|||||||
RIGHT = "\x09"
|
RIGHT = "\x09"
|
||||||
DOWN = "\x0a"
|
DOWN = "\x0a"
|
||||||
UP = "\x0b"
|
UP = "\x0b"
|
||||||
|
HOME = "\x1e"
|
||||||
|
|
||||||
clear_line24 = (
|
clear_line24 = (
|
||||||
"\x1f\x58\x41" # Cursor Zeile 24, Spalte 0
|
"\x1f\x58\x41" # Cursor Zeile 24, Spalte 0
|
||||||
|
32
rtxMask.py
32
rtxMask.py
@ -60,18 +60,7 @@ class rtxMask:
|
|||||||
|
|
||||||
zeile = zeile[:pos-1] + char + zeile[pos:]
|
zeile = zeile[:pos-1] + char + zeile[pos:]
|
||||||
answers[line] = zeile
|
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):
|
def process_input(self):
|
||||||
""" reads the input from the client, fills the mask and gets the input """
|
""" 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
|
# go to the beginning of the next line
|
||||||
# or finish the mask
|
# or finish the mask
|
||||||
if posy == len(lines)-1:
|
if posy == len(lines)-1:
|
||||||
# this was the last line, now send the data
|
weiter = False
|
||||||
# TODO: weitermachen
|
self._send_data()
|
||||||
else:
|
else:
|
||||||
# go to the beginning of the next line
|
# go to the beginning of the next line
|
||||||
posy += 1
|
posy += 1
|
||||||
@ -135,8 +124,14 @@ class rtxMask:
|
|||||||
posx += 1
|
posx += 1
|
||||||
else:
|
else:
|
||||||
echostr = ""
|
echostr = ""
|
||||||
|
elif instr == cept.HOME:
|
||||||
|
posy = 0
|
||||||
|
posx = 0
|
||||||
|
self._pos_cur_to_line(lines[posy])
|
||||||
|
echostr = ""
|
||||||
elif instr == cept.SEND: # ist das DCT??
|
elif instr == cept.SEND: # ist das DCT??
|
||||||
# TODO: send data
|
weiter = False
|
||||||
|
self._send_data()
|
||||||
elif instr.isalnum():
|
elif instr.isalnum():
|
||||||
# "normal" input
|
# "normal" input
|
||||||
# TODO: lineinput == Zeilenende beachten
|
# TODO: lineinput == Zeilenende beachten
|
||||||
@ -149,4 +144,13 @@ class rtxMask:
|
|||||||
# now send the echo
|
# now send the echo
|
||||||
glob.ser.write(bytes(echostr, "latin-1"))
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user