Package: uglierpty
PyQt6 SSH Terminal Widget: UglierPTYOverviewUglierPTY is a very functional proof-of-concept (POC) application created to construct a fully functional SSH Terminal Widget using PyQt6. This POC is inspired by its sister project, UglyPTY, a full-featured SSH client that utilizes xterm.js. The aim is to offer a similar, if not superior, feature set without relying on browser technologies or JavaScript, resulting in a more streamlined and resource-efficient solution.This is a work in progress, but feel free to give it a try!
REPO:https://github.com/scottpeterman/UglierPTYA Note About UglyPTYIf your interested in the PyQt6/XTerm.js version of this application take a look here:https://github.com/scottpeterman/UglyPTYFeaturesFully functional SSH terminal built with PyQt6Credentials manager for easy loginPortable session files in YAML (Compatible with UglyPTY)Terminal history and screen ratio control via pyteTerminal screen render via QPaintModular design for easy embedding into other PyQt6 projectsPure Python - Free of Web technology (no xterm.js)ArchitecturePython 3.xPyQt6ParamikopyteSQLAlchemyPyYamlScreenshotsHere are some snapshots of Uglier in action:InstallationClone the repository:gitclonehttps://github.com/scottpeterman/UglierPTYNavigate into the project directory:cdUglierPTYInstall the required Python packages:pipinstall-rrequirements.txtUsageThe primary entry point for this POC is theuglierpty.pyscript. To launch the application:If you cloned the repopythonrun_test.pyIf you installed via PIPpython-muglierpty
orpythonw-muglierptySSH Terminal Flow<title>SSH Terminal Flow</title>SSH Terminal Flow+--------------------+       +-------------------+       +-------------------+       +------------+       +------------------+
| SSHTerminalWidget  |       |    SSHLib Class   |       |  Communication    |       |    pyte    |       | Remote SSH Host  |
|                    |       |                   |       |                   |       |            |       |                  |
|  keyPressEvent()   |------>|     write(data)   |------>|   sendDataToSSH() |------>|            |------>|   Shell Process  |
|                    |       |                   |       |                   |       |            |       |                  |
+--------------------+       +-------------------+       +-------------------+       +------------+       +------------------+
                ^                                       ^                          ^                           ^                     
                |                                       |                          |                           |                             
                |                                       |                          |                           |
                |                                       |                          |                           |
                |                                       |                          |                           |      
+--------------------+       +-------------------+       +-------------------+       +------------+       +------------------+
| SSHTerminalWidget  |       |    SSHLib Class   |       |  Communication    |       |    pyte    |       | Remote SSH Host  |
|                    |       |                   |       |                   |       |            |       |                  |
|    paintEvent()    |<------|      read()       |<------|  receiveDataFromSSH() |<------|   feed()   |<------|   Shell Process  |
|                    |       |                   |       |                   |       | stream.attach(screen) |       |                  |
+--------------------+       +-------------------+       +-------------------+       +------------+       +------------------+Step-by-Step Explanation:Keystroke in SSHTerminalWidget:ThekeyPressEvent()function captures the keystroke and sends it to theSSHLibclass viawrite(data).Sending to SSH Channel:Thewrite()method sends the data through an SSH channel, probably utilizingparamiko.SSHClient. This is done inCommunication.sendDataToSSH().SSH to Remote Host:The keystroke reaches the shell process running on the remote SSH host.Remote Host to pyte:Once the shell process echoes the output, it's read byCommunication.receiveDataFromSSH()and fed to pyte'sStreamobject viafeed()inSSHLib.read().pyte to GUI:TheStreamobject updates theScreenobject, which theSSHTerminalWidget.paintEvent()method uses to draw on the GUI, completing the round trip.