1
0

bug fixing

This commit is contained in:
acn 2016-05-31 15:35:32 +02:00
parent 09661e7243
commit 793da44300
8 changed files with 75 additions and 710 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
*.sublime-project
*.sublime-workspace
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/

16
cept.py
View File

@ -5,14 +5,14 @@ by Anna Christina Naß <acn@acn.wtf>
released under GPL
'''
CR = "\x0d",
LF = "\x0a",
UMLAUT = "\xc9",
INI = "\x13",
TER = "\x1c",
SEND = "\x1a",
CURSOR_ON = "\x11",
BSP = "\x08", # backspace
CR = "\x0d"
LF = "\x0a"
UMLAUT = "\xc9"
INI = "\x13"
TER = "\x1c"
SEND = "\x1a"
CURSOR_ON = "\x11"
BSP = "\x08" # backspace
CLEARLINE = "\x18"
clear_line24 = (

View File

@ -15,12 +15,13 @@ DEMOPAGES="demopages/"
LOGLEVEL=logging.DEBUG
## serial port settings:
#PORT="/dev/pts/12"
PORT="/dev/ttyUSB0"
PORT="/dev/pts/10"
#PORT="/dev/ttyUSB0"
BAUDRATE="2400"
# if the system is connected directly (null-modem): MODE=direct
# if the system is connected via a modem: MODE=modem
MODE="modem"
#MODE="modem"
MODE="direct"
# the init strings for the modem, sent serially at startup
MODEM_INIT1="AT&F"
MODEM_INIT2="AT%B1200/75%C0%E0%G1-J0\\N0&G1"

5
rtx.py
View File

@ -36,7 +36,8 @@ while True:
while True:
in_byte = glob.ser.read(1)
rtxHelpers.process_byte(in_byte)
if config.MODE == "modem" and glob.ser.getCD() == False:
break
if config.MODE == "modem":
if glob.ser.getCD() == False:
break

View File

@ -1,11 +0,0 @@
{
"folders":
[
{
"path": "."
},
{
"path": "../norbert"
}
]
}

View File

@ -1,648 +0,0 @@
{
"auto_complete":
{
"selected_items":
[
[
"_",
"_pos_cur_to_line"
],
[
"by",
"bytesclass"
],
[
"b",
"btxlogo"
],
[
"rtx",
"rtxHelpers"
],
[
"next",
"nextid"
],
[
"check",
"check_and_send_page"
],
[
"che",
"check_and_send_page"
],
[
"get",
"get_link"
],
[
"cmdline",
"cmdline"
],
[
"in",
"in_byte"
],
[
"link",
"link_liste"
]
]
},
"buffers":
[
{
"file": "rtx.py",
"settings":
{
"buffer_size": 918,
"line_ending": "Unix"
}
},
{
"file": "README.md",
"settings":
{
"buffer_size": 8,
"line_ending": "Unix"
}
},
{
"file": "rtxMask.py",
"settings":
{
"buffer_size": 2011,
"line_ending": "Unix"
}
},
{
"contents": "Präsentation retroText\n----------------------\n\nBildschirmtext (Btx) war ein inter-\naktiver Onlinedienst.\n\nVorstellung auf der IFA '77 in Berlin \nvon Postminister Kurt Gscheidle\nEntwickelt unter der Leitung von Eric \nDanke, inspiriert 1975 durch Veröffent-\nlichung über das britische\nPRESTEL-System.\n\n----\n\n1980 Feldversuch mit 2000 Teilnehmern.\n18. März 1983 Unterzeichnung des \n Btx-Staatsvertrags\n1. Sept. 1983 Start zur IFA\n\nNutzer: 1986 ca. 60.000 (gepl.: 1 Mio.) \nerst 1996 1 Mio., aber da war es schon\n T-Online mit Internet+E-Mail\n\n31.12.2001: Abschaltung des \n klassischen Btx\nOnline-Banking noch bis 10. Mai 2007\n\n----\n\nBtx-Leitzentrale in Ulm\nZu Beginn Vermittlungsstellen in \n Düsseldorf, Hamburg, Frankfurt/M, \n München, Stuttgart\nGeplant waren 150 VSt...\n\n----\n\nÖsterreich: \nStart Juni 1982,\nMUPID als eigenes Terminal \n (vgl. RetroPulsiv 7.0)\nEnde: November 2001\n\n----\n\nÄhnliche Systeme in Europa:\n\nSchweiz: Videotex\nUK: Prestel\nSchweden: Prestel plus\nFrankreich: Minitel\nDänemark: Teledata\nItalien: Videotel\nNiederlande: Viditel\nSpanien: Ibertex\n\nDeutschland\n-----------\n\nBtx-Endgerät:\n- Fernseher mit Btx-Decoder oder \n Set-Top-Box (z.B. btxTv)\n- Btx-Terminal (z.B. MultiTel, MultiKom)\n- Computer mit Btx-Karten/-Modulen \n oder Software\n\nPostmodem:\n- D-BT 03 war lange der Standard\n- 1200 Bit/s empfangen, \n 75 Bit/s senden (V.23)\n- feste Anschlußkennung (EPROM)\n- fest programmierte Telefonnummer\n- eigenes Anschlußinterface\n\n- später auch alternative Modems, \n Akustikkoppler erlaubt\n- hierfür war \"Software-Kennung\" nötig\n- Zugänge mit höherer Datenrate kamen \n erst über die Jahre\n\nZugangsdaten:\n- Anschlußkennung (12 Stellen) identi-\n fiziert den Telefonanschluß\n- aufgrunnd fehlender \"CallerID\", da ja\n noch viele VSt Analogtechnik hatten\n\n- Benutzerkennung identifiziert den \n Teilnehmer\n- Mitbenutzerkennung z.B. andere \n Familienmitglieder\n- Persönliches Kennwort als Sicherheit\n\n- Für nomadische Benutzer:\n - Anschlußfreizügigkeit\n - Teilnehmerfreizügigkeit\n\nBtx-Server:\n- Hierarchisch organisiert\n- Leitzentrale in Ulm mit IBM-Technik\n- weitere VSt waren \"Caches\"\n- \"externe Rechner\" wurden direkt \n angesprochen, waren per Datex-P \n (X.25) angebunden\n - Beispiele: Quelle, Fluglinien, Bahn,\n Banken ...\n\nKosten für Inhalte:\n- \"seitenabhängige Vergütung\":\n 0,01 DM bis 9,99 DM möglich\n- \"zeitabhängige Vergütung\": \n 0,01 DM bis 1,30 DM pro Min. möglich\n- Abrechnung über Telefonrechnung\n\n1993: Trennung von Netz (Datex-J) \n und Inhalt (Btx)\nBtx blieb aber der einzige Dienst \n im Datex-J\n1995: Umbenennung in T-Online\n\nÖsterreich: \"PAN\" (Public Access \n Network), 1993-1995\n\nDer CEPT-Standard\n-----------------\n\n\nhttps://de.wikipedia.org/wiki/Minitel\n",
"file": "Vorbereitung Praesentation.txt",
"file_size": 2729,
"file_write_time": 131082227097403787,
"settings":
{
"buffer_size": 2695,
"line_ending": "Unix"
}
},
{
"file": "rtxPage.py",
"settings":
{
"buffer_size": 2466,
"line_ending": "Unix"
}
},
{
"contents": "# -*- coding: UTF-8 -*-\n'''\nrtx - RetroText\nrtxHelpers: verschiedene Hilfsfunktionen\nby Anna Christina Naß <acn@acn.wtf>\nreleased under GPL\n'''\n\nfrom rtxPage import rtxPage\nimport cept\nimport glob\nimport logging\n\ndef process_byte(in_byte):\n \"\"\" takes the received byte and processes the command line\n if a new command has been entered, it will call process_command()\n if a short link has been entered, the link_list of the current page will be searched\n and the found target will be sent to process_command()\n \"\"\"\n instr=str(in_byte, encoding=\"latin-1\")\n \n logging.debug(\"> %s < CD: %s\", instr, glob.ser.getCD())\n\n # what to send back to the client\n if instr == cept.INI:\n logging.debug(\"INI\")\n echo_char = \"*\"\n elif instr == cept.TER:\n logging.debug(\"TER\")\n echo_char = \"#\"\n else:\n echo_char=instr\n\n # start of line: clear rest of cmdline\n if len(glob.cmdline) == 0:\n glob.ser.write(bytes(cept.CLEARLINE, \"latin-1\"))\n\n # echo the character to the client\n glob.ser.write(bytes(echo_char, \"latin-1\"))\n\n glob.cmdline += instr\n\n # Backspace:\n if instr == cept.BSP:\n glob.cmdline = glob.cmdline[:-1]\n return\n\n logging.debug(\"Cmdline: >%s<\", glob.cmdline)\n\n # process links inside the page:\n if ( len(glob.cmdline) == 1 or len(glob.cmdline) == 2 ) and glob.curpage.get_link(glob.cmdline):\n glob.cmdline = cept.INI + glob.curpage.get_link(glob.cmdline) + cept.TER\n process_command(glob.cmdline)\n return\n\n # reset cmdline:\n if instr == cept.INI and glob.cmdline[-2:] == cept.INI+cept.INI:\n logging.debug(\"reset cmdline\")\n glob.cmdline = \"\"\n glob.ser.write(bytes(clear_line24, \"latin-1\"))\n return\n\n # goto last page:\n if instr == cept.TER and glob.cmdline == cept.INI+cept.TER:\n if glob.prevpage.get_page_id() == -1:\n glob.cmdline = \"\"\n send_error(\"Keine vorige Seite vorhanden.\")\n return\n glob.cmdline = \"\" # reset cmdline\n goto_last_page()\n return\n\n # \"Make it so\":\n if instr == cept.TER:\n # or instr == cept.SEND or instr == cept.CR:\n logging.info(\"Kommando: >%s<\", glob.cmdline)\n process_command(glob.cmdline)\n return\n\ndef process_command(cmd):\n \"\"\" processes the given command line\n \"\"\"\n\n # reset cmdline\n glob.cmdline = \"\"\n\n # process *cmdline#, normally a page-loading command:\n if cmd[0] == cept.INI and cmd[-1:] == cept.TER:\n pgnr = cmd[1:-1]\n check_and_send_page(pgnr, \"Die Seite kann nicht gefunden werden.\")\n\n # if only # is entered, either go to the link behind '#'\n # or to the next sub-page (2000a => 2000b) if it exists\n if cmd == cept.TER:\n if glob.curpage.get_link(\"#\"):\n pgnr = glob.curpage.get_link(\"#\")\n check_and_send_page(pgnr, \"Die Seite kann nicht gefunden werden.\")\n else:\n # check if the next page exists, e.g. 2000a => 2000b\n curid = glob.curpage.get_page_id()\n if curid[-1:].isalpha():\n # aus 2000a 2000b machen:\n nextid = curid[:-1] + chr(ord(curid[-1:])+1)\n check_and_send_page(nextid, \"Keine n\"+str(cept['UMLAUT'])+\"achste Seite gefunden.\")\n\n # special commands:\n# if cmd == \"!1\" + cept.TER\n# glob.ser.write(bytes(c#ept.btxlogo, \"latin-1\"))\n# return\n# if cmd == \"!2\" + cept.TER:\n# glob.ser.write(bytes(cept.init_screen, \"latin-1\"))\n# return\n\ndef goto_last_page():\n \"\"\" go back to the previous page and make the current page the previous page\n \"\"\"\n logging.info(\"Letzte Seite: %s\", str(glob.prevpage.get_page_id()))\n\n # swap prevpage and curpage\n temp = glob.curpage\n glob.curpage = glob.prevpage\n glob.prevpage = temp\n\n # send the previous page (now curpage) to the client\n send_page(glob.curpage)\n\ndef send_welcome_page():\n \"\"\" get the btxlogo, make a rtxPage of it and send it to the client \"\"\"\n wpage = rtxPage()\n wpage.set_page(bytes(cept.btxlogo, \"latin-1\"))\n send_page(wpage)\n\ndef check_and_send_page(pgnr, errormsg):\n \"\"\" checks if the page \"pgnr\" exists\n if yes, it loads it into curpage and sends it to the client\n if not, it sends the error message \"errormsg\" to the client\n \"\"\"\n logging.info(\"suche Seite: >%s<\", pgnr)\n\n if rtxPage.exists(pgnr):\n glob.prevpage = glob.curpage\n glob.curpage = rtxPage(pgnr)\n send_page(glob.curpage) # takes a rtxPage object!\n return True\n elif pgnr[-1:].isnumeric() and rtxPage.exists(pgnr + \"a\"):\n glob.prevpage = glob.curpage\n glob.curpage = rtxPage(pgnr + \"a\")\n send_page(glob.curpage) # takes a rtxPage object!\n return True\n else:\n send_error(errormsg)\n return False\n\ndef send_error(msg):\n \"\"\" send an error message to the client \"\"\"\n glob.ser.write(bytes(cept.error_prefix + msg + cept.error_suffix, \"latin-1\"))\n\ndef send_page(page):\n \"\"\" sends a page to the client \"\"\"\n glob.ser.write(page.get_page())\n\n",
"file": "rtxHelpers.py",
"file_size": 4698,
"file_write_time": 131080701920000000,
"settings":
{
"buffer_size": 4542,
"line_ending": "Unix"
}
},
{
"file": "rtxModem.py",
"settings":
{
"buffer_size": 1504,
"line_ending": "Unix"
}
},
{
"file": "config.py",
"settings":
{
"buffer_size": 738,
"line_ending": "Unix"
}
},
{
"contents": "'''\nrtx - RetroText\ncept: Enthält CEPT-Steuerzeichen\nby Anna Christina Naß <acn@acn.wtf>\nreleased under GPL\n'''\n\nCR = \"\\x0d\",\nLF = \"\\x0a\",\nUMLAUT = \"\\xc9\",\nINI = \"\\x13\",\nTER = \"\\x1c\",\nSEND = \"\\x1a\",\nCURSOR_ON = \"\\x11\",\nBSP = \"\\x08\", # backspace\nCLEARLINE = \"\\x18\"\n\nclear_line24 = (\n \"\\x1f\\x58\\x41\" # Cursor Zeile 24, Spalte 0\n \"\\x18\" # Zeile löschen\n )\n\nerror_prefix = (\n \"\\x1f\\x2f\\x40\\x58\" # Servicesprung Zeile 24\n )\nerror_suffix = (\n \"\\x1f\\x2f\\x4f\" # Ende Servicesprung\n \"\\x1f\\x58\\x41\" # Cursor Zeile 24, Spalte 0\n )\n\neingabezeile = ( \n \"\\x1b\" # Hintergrund blau ganze Reihe\n \"\\x23\" \n \"\\x21\" \n \"\\x54\"\n \"\\x44\" # Hintergrund blau, Vordergrund gelb\n \"\\x83\" )\n\ninit_screen = ( \n \"\\x1f\" \"\\x2f\" \"\\x42\" # Grundzustand parallel\n \"\\x9b\"\n \"\\x30\" \"\\x32\" \"\\x3b\" \"\\x32\" \"\\x33\" \"\\x55\" # Scrollbereich ist Zeile 2 - 23\n \"\\x9b\"\n \"\\x32\" \"\\x60\" # Implizites Scrollen an\n \"\\x1b\" \"\\x23\" \"\\x21\" \"\\x54\" # Hintergrund blau ganze Reihe\n \"\\x94\" \"\\x83\" # Hintergrund blau, Vordergrund gelb\n \"\\x42\" \"\\x74\" \"\\x78\" \"\\x20\" \"\\x53\" \"\\x65\" \"\\x72\" \"\\x76\" \"\\x65\" \"\\x72\" # Btx Server\n \"\\x20\" \"\\x2d\" \"\\x20\" \"\\x4E\" \"\\x6F\" \"\\x72\" \"\\x62\" \"\\x65\" \"\\x72\" \"\\x74\" # - Norbert\n \"\\x20\" \"\\x4B\" \"\\x65\" \"\\x68\" \"\\x72\" \"\\x65\" \"\\x72\" \"\\x2c\" \"\\x20\" # Kehrer, \n \"\\x41\" \"\\x70\" \"\\x72\" \"\\x69\" \"\\x6C\" \"\\x20\" \"\\x32\" \"\\x30\" \"\\x31\" \"\\x36\" # April 2016 \n \"\\x90\" \"\\x87\" # Hintergrund schwarz, Vordergrund weisz\n \"\\x0d\" \"\\x0a\" # CR/LF\n \"\\x11\" # Cursor on\n )\n\nbtxlogo = (\n \"\\x1f\\x2f\\x42\" # Grundzustand parallel\n \"\\x1b\\x7e\" # Zeichensatz G1 rechts\n \"\\x9b\\x31\\x40\" # Farbtafel 1 (Halbtöne)\n \"\\x1b\\x23\\x20\\x54\" # ganzer Schirm blau\n \"\\x1f\\x3d1# 200961a\\x1f\" # Link zur Demo-Startseite 200961a\n \"\\x1f\\x43\\x48\\xb8\\xa3\\x12\\x57\\xe4\"\n \"\\x1f\\x44\\x47\\xea\\xa0\\x12\\x59\\xb5\"\n \"\\x1f\\x45\\x47\\xea \\xe8\\xfc\\xdf\\x12\\x49\\xfc\\xb4 \\xb5\"\n \"\\x1f\\x46\\x47\\xea \\xe8\\xdf\\x12\\x44\\xa3\\x12\\x45\\xdf\\x12\\x44\\xb4 \\xb5\"\n \"\\x1f\\x47\\x47\\xea \\xaa\\xdf\\xdf\\xdf\\xaf\\xa1 \\xfc\\xdf\\xdf\\xfc \\xa2\\xaf\\xdf\\xdf\\xdf\\xa5 \\xb5\"\n \"\\x1f\\x48\\x47\\xea \\xa2\\xe3\\xf8\\xfe\\xdf\\xea\\xdf\\x12\\x43\\xb5\\xdf\\xfd\\xf4\\xb3\\xa1 \\xb5\"\n \"\\x1f\\x49\\x47\\xea \\xdf\\x12\\x43\\xea\\xdf\\x12\\x43\\xb5\\xdf\\x12\\x43 \\xb5\"\n \"\\x1f\\x4a\\x47\\xea \\xdf\\x12\\x43\\xfd\\xf3\\xaf\\xaf\\xf3\\xfe\\xdf\\x12\\x43 \\xb5\"\n \"\\x1f\\x4b\\x47\\xea \\xdf\\x12\\x4d \\xb5\" # Ende Telefon-Logo\n \"\\x1f\\x4c\\x47\\xea \\x12\\x59\\xb5\"\n \"\\x1f\\x4d\\x47\\xea \\x12\\x44\\xbc\\xb4\\xf0\\xb0\\xf4\\xe0\\xb0\\xf0\\xb0\\xec\\xa4\\xf0\\xb0\\xb0\\xb0\\xf4 \\x12\\x44\\xb5\" # Logo-Text 1\n \"\\x1f\\x4e\\x47\\xea \\x12\\x44\\xbf\\xb1\\xbd\\xa5\\xb5\\xea \\xb5\\xb5\\xea \\xbd\\xa5\\xb9\\xb1\\xb5 \\x12\\x44\\xb5\" # Logo-Text 2\n \"\\x1f\\x4f\\x47\\xea \\x12\\x44\\xa1\\xa1\\xa3\\xa1\\xa3\\xa2 \\xa3\\xa1\\xa2 \\xa3\\xa1\\xa1\\xa1\\xa3 \\x12\\x44\\xb5\" # Logo-Text 3\n \"\\x1f\\x50\\x47\\xa2\\xe4\\xa0\\x12\\x57\\xb8\\xa1\"\n \"\\x1f\\x51\\x49\\xa3\\x12\\x57\\r\\n\"\n \"\\x9b\\x31\\x40\" # Farbtafel 1\n \"\\x87\\x19\\x50\\x12\\x67\" # Strich\n \"\\x9b\\x30\\x40\" # Farbtafel 0\n \"\\x87 Herzlich Willkommen in\\r\\n\"\n \"\\x87 retroText!\\r\\n\"\n \"\\x9b\\x31\\x40\" # Farbtafel 1\n \"\\x87\\x19\\x50\\x12\\x67\"\n \"\\x9b\\x30\\x40\" # Farbtafel 0\n \"\\x83Mit # fortfahren\\r\\n\"\n )",
"file": "cept.py",
"file_size": 3169,
"file_write_time": 131080704460000000,
"settings":
{
"buffer_size": 3113,
"line_ending": "Unix"
}
}
],
"build_system": "",
"build_system_choices":
[
],
"build_varint": "",
"command_palette":
{
"height": 392.0,
"last_filter": "git st",
"selected_items":
[
[
"git st",
"Git: Status"
],
[
"git comm",
"Git: Commit"
],
[
"git",
"Git: Commit"
],
[
"git ad",
"Git: Add..."
],
[
"inst",
"Package Control: Install Package"
],
[
"Package Control: ",
"Package Control: Remove Package"
],
[
"pack",
"Package Control: List Packages"
],
[
"install",
"Package Control: Install Package"
],
[
"ruler",
"QuickRulers: Open Panel"
],
[
"line",
"Line Ending: Unix"
],
[
"",
"Hex Viewer: Toggle Hex View"
],
[
"hex",
"Hex Viewer: Toggle Hex View"
]
],
"width": 528.0
},
"console":
{
"height": 584.0,
"history":
[
"import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)"
]
},
"distraction_free":
{
"menu_visible": true,
"show_minimap": false,
"show_open_files": false,
"show_tabs": false,
"side_bar_visible": false,
"status_bar_visible": false
},
"expanded_folders":
[
"/C/Daten/ownCloud/btx/rtx",
"/C/Daten/ownCloud/btx/norbert"
],
"file_history":
[
"/C/Temp/2_git.imzadi.de.crt",
"/C/Users/nass/AppData/Roaming/Sublime Text 3/Packages/User/Git.sublime-settings",
"/C/Users/nass/AppData/Roaming/Sublime Text 3/Packages/Git/Git.sublime-settings",
"/C/Users/nass/AppData/Roaming/Sublime Text 3/Packages/User/Preferences.sublime-settings",
"/C/Users/nass/AppData/Roaming/Sublime Text 3/Packages/Default/Preferences.sublime-settings",
"/C/Daten/ownCloud/btx/rtx/Vorbereitung Praesentation.txt",
"/S/ZDV-IVS/Abteilung/AG-Infrastruktur/KVM over IP mit neuem Java.txt",
"/C/Temp/java.security",
"/C/Temp/kvm.cgi.jnlp",
"/C/Program Files (x86)/Java/jre1.8.0_92/lib/security/java.security",
"/C/Daten/ownCloud/btx/rtx/rtx.sublime-project",
"/X/Projekte/rtx/config.py",
"/X/Projekte/rtx/norbert/btx_server.js",
"/X/Projekte/rtx/cept.py",
"/X/Projekte/rtx/rtx.py",
"/X/Projekte/rtx/rtxPage.py",
"/X/Projekte/rtx/rtxHelpers.py",
"/X/Projekte/rtx/pages/200961a",
"/X/Projekte/rtx/rtxSerial.py",
"/C/Users/nass/AppData/Roaming/Sublime Text 3/Packages/User/hex_viewer.sublime-settings",
"/X/Projekte/rtx/norbert/pages/amiga/20000a",
"/C/Users/nass/AppData/Roaming/Sublime Text 3/Packages/HexViewer/hex_viewer.sublime-settings",
"/X/Projekte/rtx/rtx-page.py",
"/X/Projekte/rtx/rtx-cept.py"
],
"find":
{
"height": 26.0
},
"find_in_files":
{
"height": 0.0,
"where_history":
[
]
},
"find_state":
{
"case_sensitive": true,
"find_history":
[
"cept",
"cept['TER']",
"cept['INI']",
"0x(..),",
"BTX_UML"
],
"highlight": true,
"in_selection": false,
"preserve_case": false,
"regex": false,
"replace_history":
[
"cept.TER",
"cept.INI",
"\"\\\\x\\1\"",
"\"\\\\x\\1",
"\"\\\\x\\1\""
],
"reverse": false,
"show_context": true,
"use_buffer2": true,
"whole_word": false,
"wrap": true
},
"groups":
[
{
"selected": 1,
"sheets":
[
{
"buffer": 0,
"file": "rtx.py",
"semi_transient": false,
"settings":
{
"buffer_size": 918,
"regions":
{
},
"selection":
[
[
254,
254
]
],
"settings":
{
"auto_complete": false,
"syntax": "Packages/Python/Python.sublime-syntax"
},
"translation.x": 0.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 1,
"type": "text"
},
{
"buffer": 1,
"file": "README.md",
"semi_transient": true,
"settings":
{
"buffer_size": 8,
"regions":
{
},
"selection":
[
[
0,
0
]
],
"settings":
{
"syntax": "Packages/Markdown/Markdown.sublime-syntax"
},
"translation.x": 0.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 0,
"type": "text"
},
{
"buffer": 2,
"file": "rtxMask.py",
"semi_transient": false,
"settings":
{
"buffer_size": 2011,
"regions":
{
},
"selection":
[
[
1961,
1961
]
],
"settings":
{
"auto_complete": false,
"syntax": "Packages/Python/Python.sublime-syntax"
},
"translation.x": 0.0,
"translation.y": 450.0,
"zoom_level": 1.0
},
"stack_index": 2,
"type": "text"
},
{
"buffer": 3,
"file": "Vorbereitung Praesentation.txt",
"semi_transient": false,
"settings":
{
"buffer_size": 2695,
"regions":
{
},
"selection":
[
[
2656,
2656
]
],
"settings":
{
"rulers":
[
40
],
"syntax": "Packages/Text/Plain text.tmLanguage"
},
"translation.x": 0.0,
"translation.y": 1260.0,
"zoom_level": 1.0
},
"stack_index": 3,
"type": "text"
},
{
"buffer": 4,
"file": "rtxPage.py",
"semi_transient": false,
"settings":
{
"buffer_size": 2466,
"regions":
{
},
"selection":
[
[
2466,
2466
]
],
"settings":
{
"auto_complete": false,
"syntax": "Packages/Python/Python.sublime-syntax",
"translate_tabs_to_spaces": false
},
"translation.x": 0.0,
"translation.y": 972.0,
"zoom_level": 1.0
},
"stack_index": 4,
"type": "text"
},
{
"buffer": 5,
"file": "rtxHelpers.py",
"semi_transient": false,
"settings":
{
"buffer_size": 4542,
"regions":
{
},
"selection":
[
[
962,
1005
]
],
"settings":
{
"auto_complete": false,
"syntax": "Packages/Python/Python.sublime-syntax",
"translate_tabs_to_spaces": false
},
"translation.x": 0.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 5,
"type": "text"
},
{
"buffer": 6,
"file": "rtxModem.py",
"semi_transient": false,
"settings":
{
"buffer_size": 1504,
"regions":
{
},
"selection":
[
[
0,
0
]
],
"settings":
{
"auto_complete": false,
"syntax": "Packages/Python/Python.sublime-syntax"
},
"translation.x": 0.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 8,
"type": "text"
},
{
"buffer": 7,
"file": "config.py",
"semi_transient": false,
"settings":
{
"buffer_size": 738,
"regions":
{
},
"selection":
[
[
0,
0
]
],
"settings":
{
"auto_complete": false,
"syntax": "Packages/Python/Python.sublime-syntax"
},
"translation.x": 0.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 7,
"type": "text"
},
{
"buffer": 8,
"file": "cept.py",
"semi_transient": false,
"settings":
{
"buffer_size": 3113,
"regions":
{
},
"selection":
[
[
1782,
1794
]
],
"settings":
{
"auto_complete": false,
"syntax": "Packages/Python/Python.sublime-syntax",
"translate_tabs_to_spaces": false
},
"translation.x": 0.0,
"translation.y": 702.0,
"zoom_level": 1.0
},
"stack_index": 6,
"type": "text"
}
]
}
],
"incremental_find":
{
"height": 26.0
},
"input":
{
"height": 34.0
},
"layout":
{
"cells":
[
[
0,
0,
1,
1
]
],
"cols":
[
0.0,
1.0
],
"rows":
[
0.0,
1.0
]
},
"menu_visible": true,
"output.find_results":
{
"height": 0.0
},
"output.hex_viewer_inspector":
{
"height": 142.0
},
"pinned_build_system": "",
"project": "rtx.sublime-project",
"replace":
{
"height": 48.0
},
"save_all_on_build": true,
"select_file":
{
"height": 0.0,
"last_filter": "",
"selected_items":
[
],
"width": 0.0
},
"select_project":
{
"height": 0.0,
"last_filter": "",
"selected_items":
[
],
"width": 0.0
},
"select_symbol":
{
"height": 0.0,
"last_filter": "",
"selected_items":
[
],
"width": 0.0
},
"selected_group": 0,
"settings":
{
},
"show_minimap": true,
"show_open_files": true,
"show_tabs": true,
"side_bar_visible": true,
"side_bar_width": 150.0,
"status_bar_visible": true,
"template_settings":
{
}
}

View File

@ -10,6 +10,7 @@ from rtxPage import rtxPage
import cept
import glob
import logging
import config
def process_byte(in_byte):
""" takes the received byte and processes the command line
@ -19,7 +20,8 @@ def process_byte(in_byte):
"""
instr=str(in_byte, encoding="latin-1")
logging.debug("> %s < CD: %s", instr, glob.ser.getCD())
if config.MODE=="modem":
logging.debug("> %s < CD: %s", instr, glob.ser.getCD())
# what to send back to the client
if instr == cept.INI:
@ -57,7 +59,7 @@ def process_byte(in_byte):
if instr == cept.INI and glob.cmdline[-2:] == cept.INI+cept.INI:
logging.debug("reset cmdline")
glob.cmdline = ""
glob.ser.write(bytes(clear_line24, "latin-1"))
glob.ser.write(bytes(cept.clear_line24, "latin-1"))
return
# goto last page:
@ -104,12 +106,12 @@ def process_command(cmd):
check_and_send_page(nextid, "Keine n"+str(cept['UMLAUT'])+"achste Seite gefunden.")
# special commands:
# if cmd == "!1" + cept.TER
# glob.ser.write(bytes(c#ept.btxlogo, "latin-1"))
# return
# if cmd == "!2" + cept.TER:
# glob.ser.write(bytes(cept.init_screen, "latin-1"))
# return
if cmd == "!1" + cept.TER:
send_welcome_page()
return
if cmd == "!2" + cept.TER:
glob.ser.write(bytes(cept.init_screen, "latin-1"))
return
def goto_last_page():
""" go back to the previous page and make the current page the previous page

View File

@ -15,16 +15,17 @@ class rtxMask:
""" Klasse zur Verarbeitung einer Eingabemaske
"""
posx = 0
posy = 0
lines = []
answers = []
def __init__(self):
def addLine(x, y, length, linetype="text"):
def addLine(x, y, length):
""" adds a new line for the mask to the object """
lines.append((x,y,length, linetype))
newLine['x'] = x
newLine['y'] = y
newLine['length'] = length
self.lines.append(newLine)
def get_answer(self, nr):
""" returns the answer for a specific line """
@ -39,8 +40,8 @@ class rtxMask:
def _pos_cur_to_line(self, line):
""" positions the cursor to the beginning of a line """
zeile=lines(line)
_pos_cur_to_xy(self, zeile.posx, zeile.posy)
zeile=self.lines[line]
self._pos_cur_to_xy(zeile['x'], zeile['y'])
def _pos_cur_to_xy(self, x, y):
""" positions the cursor to a (x,y) position on screen """
@ -49,36 +50,52 @@ class rtxMask:
gotoString = "\x1f" + chr(toX) + chr(toY)
glob.ser.write(bytes(gotoString, "latin-1"))
def _set_str_at_pos(self, char, pos, line):
""" changes the 'char' at a position 'pos' of a specific answer 'line' """
zeile = self.answers[line]
# if the line is shorter than the position, add spaces
while len(zeile) < pos:
zeile += " "
zeile = zeile[:pos-1] + char + zeile[pos:]
answers[line] = zeile
def process_input(self):
""" reads the input from the client, fills the mask and gets the input """
for i in range(len(lines)):
# position the cursor
self._pos_cur_to_line(lines[i])
lineinput = "" # this will be the answer
if len(lines) == 0:
logging.debug("Keine Zeilen in der Maske definiert!")
return False
weiter = True
# read input and interpret it
while weiter==True:
if config.MODE == "modem" and glob.ser.getCD() == False:
weiter=False
in_byte = glob.ser.read(1)
instr = str(in_byte, encoding="latin-1")
echostr = instr
# position the cursor into the first field
self._pos_cur_to_line(lines[1])
posx = 1 # cursor position inside the line
posy = 0 # the current line
if instr == cept.TER:
answer[i] = lineinput
weiter=False
elif instr.isalnum():
lineinput += instr
elif instr == cept.BSP:
lineinput = lineinput[:-1]
else:
echostr = ""
weiter = True
# read input and interpret it
while weiter==True:
#if config.MODE == "modem" and glob.ser.getCD() == False:
# weiter=False
in_byte = glob.ser.read(1)
instr = str(in_byte, encoding="latin-1")
echostr = instr
# lineinput == Zeilenende beachten
# dafür aber die Konstruktion von lines nochmal umbauen, um auf "length" zugreifen zu können...
if instr == cept.TER or instr == cept.CR:
# TODO: weiter in nächster Zeile
elif instr.isalnum():
self._set_str_at_pos(instr, posx, posy)
posx += 1
elif instr == cept.BSP:
answers[posy] = answers[posy][:-1]
posx -= 1
else:
echostr = ""
glob.ser.write(bytes(echostr, "latin-1"))
# lineinput == Zeilenende beachten
# dafür aber die Konstruktion von lines nochmal umbauen, um auf "length" zugreifen zu können...
glob.ser.write(bytes(echostr, "latin-1"))