From 66594e9cc6ceaaa9cfaa4f532b12f2a209760c81 Mon Sep 17 00:00:00 2001 From: George Farris Date: Sat, 19 Sep 2020 10:50:44 -0700 Subject: [PATCH] Add ability to turn of box drawing characters so cut and paste works --- .idea/h19term.iml | 2 +- h19-readme.txt | 7 +++++++ h19term.py | 31 ++++++++++++++++++++++++------- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/.idea/h19term.iml b/.idea/h19term.iml index 3b80170..2c1d26d 100644 --- a/.idea/h19term.iml +++ b/.idea/h19term.iml @@ -2,7 +2,7 @@ - + diff --git a/h19-readme.txt b/h19-readme.txt index 41c85b6..32c8eeb 100644 --- a/h19-readme.txt +++ b/h19-readme.txt @@ -83,6 +83,12 @@ Function Keys ------------- + IL Keypad 1 + DL Keypad 3 + HOME Keypad 5 + IC Keypad 7 + DC Keypad 9 + F1-F5 Same as PC keyboard BLUE F6 key on PC RED F7 @@ -122,6 +128,7 @@ Ctrl-A K Toggle the Keypad between normal and alternate mode Ctrl-A L Toggle logging of serial data to h19term.log Ctrl-A M Show this user manual + Ctrl-A N Toggle window box characters, for copy and paste of terminal Ctrl-A Q CP/M Quick Help Ctrl-A P Select serial port and baud rate Ctrl-A R Reset the terminal to power up mode diff --git a/h19term.py b/h19term.py index cb51e9a..b5b9374 100755 --- a/h19term.py +++ b/h19term.py @@ -75,6 +75,8 @@ # May 30, 2020 V2.3 Fix window sizes on Raspberry pi/ Linux console # and only use 16x32 font. # Jun 01, 2020 V2.4 Added Xmodem transfer. +# Aug 22, 2020 V2.5 Add toggling window box drawing characters for Linux copy and paste. +# Add keypad associations to help screen. import os import re @@ -151,8 +153,8 @@ # ************ END OF USER MODIFIABLE SETTINGS ***************************** -VERSION = 'V2.4 - Python 3' -VERSION_DATE = 'Jun 01, 2020' +VERSION = 'V2.5 - Python 3' +VERSION_DATE = 'Aug 22, 2020' CONFIG_FILE = os.path.join(os.environ['HOME'], '.h19termrc') LOG_FILE = os.path.join(os.environ['HOME'], 'h19term.log') @@ -540,6 +542,7 @@ def __init__(self): self.screen = None self.status = None self.logio = False + self.showbox = True self.baudrate = [110, 150, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 7200, 9600, 19200, 38400] H19Screen.__init__(self, self.screen, self.status) @@ -1485,11 +1488,12 @@ def popup_help(self): H19 BREAK Key..................B | KP_ENTER..F10 H19 DEL Key....................D | ERASE.....F11 CP/M Quick Help................Q | OFFLINE...F12 - Set H19term colours............C | - Set Baud Rate and Port.........P | - Send file by XMODEM............S | - - Press command key or to close help. + Set H19term colours............C | IL.......KP_1 + Set Baud Rate and Port.........P | DL.......KP_3 + Send file by XMODEM............S | HOME.... KP_5 + Toggle window box char.........N | IC.......KP_7 + | DC.......KP_9 + Press command key or to close help. """ try: self.background_clear() @@ -1576,6 +1580,19 @@ def parse_ctrl_a(self, sio, scr, scn, st): self.show_ascii_file('h19-readme.txt') break + elif s == 'n' or s == 'N': # Toggle box around window for copy paste reasons + if self.showbox: + self.cur.border(' ',' ',' ',' ',' ',' ',' ',' ') + self.showbox = False + else: + self.cur.border() + self.showbox = True + self.cur.refresh() + self.show_status_line() + self.screen.touchwin() + self.screen.refresh() + break + elif s == 'p' or s == 'P': # Set baud rate self.popup_baud_rate(sio) break