Giter Site home page Giter Site logo

morsekob / pykob Goto Github PK

View Code? Open in Web Editor NEW
4.0 9.0 2.0 25.41 MB

Python implementation of a library for Morse and MorseKOB functionality

Home Page: https://sites.google.com/site/morsekob/morsekob40

License: MIT License

Python 95.40% Batchfile 0.72% Shell 0.20% Makefile 2.75% NSIS 0.93%
morse-code american-morse telegraphy morsekob cw international-morse

pykob's People

Contributors

aesilky avatar leskerr avatar pwdirks avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pykob's Issues

MKOB: Wire connection doesn't use station name specified

When connecting to a wire MKOB (python) uses "AC Les - Seattle, WA" even though a different station name was specified.

Steps to replicate:

  1. Enter a station name in the text box (not labeled, but defaults to "AC Les - Seattle, WA" when MKOB is started)
  2. Select a wire using the 'Wire No.' spinner (used '10' for the test)
  3. Connect
  4. On a different machine run MorseKOB 2.5 (the Windows application)
  5. Connect to the same wire (using a station name different from the one specified in 1. and not "AC Les - Seattle, WA"
  6. Monitor the upper-right text box (un-labeled 'stations connected' list)
  7. Notice that the station list (eventually) displays "AC Les - Seattle, WA" as one of the two stations rather than the station name specified in 1.

morse.py complains import from __future__ is no longer at beginning of file

$ python3 Clock.py
Traceback (most recent call last):
File "Clock.py", line 34, in
from pykob import config, kob, morse, log
File "/Users/Patrick/Documents/Projects/Morse/MorseKOB/pykob-4/pykob/morse.py", line 31
from future import print_function ###
^
SyntaxError: from future imports must occur at the beginning of the file

Clock.py --help isn't clear

Using Clock.py --help info wasn't clear.

Eds-Macbook:PyKOB esilky$ python3 ./clock.py --help
2020-05-11 01:01:47 Starting Clock
usage: clock.py [-h] [-p portname] [-a sound] [-s speed] [-b time] [-e time]
                [-i minutes] [-t]

optional arguments:
  -h, --help            show this help message and exit
  -p portname, --port portname
                        The name of the serial port to use
  -a sound, --sound sound
                        'ON' or 'OFF' to indicate whether morse audio should
                        be generated
  -s speed, --speed speed
                        The morse send speed in WPM
  -b time, --begin time
                        Beginning of time announcements
  -e time, --end time   End of time announcements
  -i minutes, --interval minutes
                        The time announcement interval in minutes
  -t, --text            Whether to print text locally as it's sent to the
                        sounder
Eds-Macbook:PyKOB esilky$ python3 ./clock.py --begin time now
2020-05-11 01:08:55 Starting Clock
usage: clock.py [-h] [-p portname] [-a sound] [-s speed] [-b time] [-e time]
                [-i minutes] [-t]
clock.py: error: argument -b/--begin: invalid int value: 'time'
Eds-Macbook:PyKOB esilky$ 

Given the help I tried python3 clock.py --begin time now
I also tried python3 clock.py --begin now
Neither worked.

I think the help needs to be more specific of the syntax.

Config module should track configuration of additional configuration options

There are more configuration settings than the current PORT, SOUND, and WPM options. We might also enable configuration of

STATION - local station call
WIRE - default wire to connect to
CWPM - received speed? (although we should probably auto-detect speed instead)
LOCAL - local copy of generated traffic (using settings of SOUND and PORT)
REMOTE - remote copy of generated traffic (using setting of WIRE)

MKOB: Reader window jitters when full

When the reader window is full, new text should cause the window to scroll up smoothly. Instead, it jitters up and down slightly with each new character.

This problem was frustrating enough that it caused me to give up on the whole MKOB project in despair.

MKOB: Connected station list doesn't show connected stations

When connected to a wire the 'Connected Stations" list (un-labled upper right text box) doesn't list any stations.

Steps to reproduce:

  1. In MKOB, connect to a wire (10 was used in the test)
  2. On a different machine run MorseKOB 2.5 (Windows app)
  3. Connect to the same wire with a different station name
  4. In MKOB monitor the connected station list
  5. The connected stations don't display

This excerpt from the MorseKOB 2.5 tutorial describes the expected behavior. It facilitates round table discussions with multiple operators, such as the nets that take place regularly on wire 11.

Within 10 seconds after connecting, in the text box in the upper right part of the KOB window you’ll see a list of the IDs for everyone connected to the same wire that you’re on. Whenever someone transmits, their ID is moved to the bottom of the list, so the station at the top of the list is the one that has waited the longest since their last transmission. About 60 seconds after a user disconnects from the wire, their ID is removed from the list.

Save and restore settings

Save and restore the main config values between MorseKOB sessions. Specifically, these settings are the station ID, code speed (WPM), and wire number.

MKOB: Add optional 'auto-correct' for decoded text

Slight differences in manually sent code (especially American Morse) can cause 'typos' to occur in the decoded output. For example, a transmitted line of 'THE QUICK BROWN FOX' might be decoded to 'TSE QUICK 8ROWN FEEX' with just three very small decoding errors.

Rather than trying to fine tune the decoding - which currently works very well as-is, and in trying to 'adjust' might do more harm than good - adding an option to enable 'auto-correct' might work better.

Auto-correct has been available in word processing, email, and messaging applications for many years. Recently they have improved significantly. Adding an auto-correct option that processes the decoded text (as text) might work better than trying to adjust the decoding algorithm.

MKOB (GUI) Installer for - Win, Mac, Linux

Create an End-User friendly installer for MKOB-4.0 (PyKob).

This should be easy/intuitive to run and should install the application so it is ready to run.

The initial focus should be on Mac and Linux (particularly the Raspberry Pi) to provide non-Windows users the ability to use the application (MKOB-2.5 is Windows only).

Les needs to learn GitHub

When I have questions about GitHub, should I post them to this 'issues' thread? In particular, I don't know if I should @mention you guys when I post an issue, and/or follow up with a comment. As an experiment, I'll mention @AESilky here and see what happens. Patrick, did you get a notification of this issue?

By the way, I'm using GitHub Desktop to post this issue.

Config storage is inconsistent about treating 'Sound' as string vs. boolean

The existing config.py code is somewhat inconsistent about the 'SOUND' option - it's stored in the config file as a string ('ON' or 'OFF') but it's retrieved and used as a boolean. I believe it always came out 'True' as a result. Pull request #29 changes the config.py code to at least consistently store only the strings 'ON' and 'OFF' and have the Clock.py code re-interpret it as True or False respectively when creating the KOB.

We should either have all calling code configured similarly or to change the config option to save and restore a boolean. The current usage makes it awkward to set the default option for the "--sound" override.

Another option would be to define two complementary options (e.g. "-a" for audio on and "-q" for "quiet"?) argsparse can nicely handle the mutual exclusivity between those options.

The main question is to settle the content of the config file, and then make everything consistent.

Extract Configure.py CLI options processing into a library class

It would be convenient to allow individual PyKOB commands/utilities to allow command line options to override the global configuration settings (configured using Configure.py, stored in the two .INI files, read by the 'config.py' module, and made available to the commands).

For example: the user might have used Configure.py (via configure.cmd or configure.sh) to set 'SPEED' (WPM) to '20', but for the Time.py program they would like to temporarily speed it up to 25 WPM. Being able to use the --speed 25 option on the Time.py launch to set the speed to 25 just for this instance rather than changing the user's saved preferences would be useful.

Issue 'Default command-line option parsing to override configured defaults #13' should depend on this issue, rather than duplicating the options processing code in each application.

MKOB: Sender doesn't send code

When connected to a wire, using the (un-labeled) lower left text box to enter text to send doesn't send code.

Steps to reproduce:

  1. Run MKOB
  2. Connect to a wire (10 was used for the test)
  3. On a different machine run MorseKOB 2.5 (Windows app)
  4. Connect to the same wire using a different station name
  5. In MKOB open the circuit
  6. Turn 'Code Sender' 'On'
  7. Enter text in the (un-labelled) lower left text box
  8. Monitor MorseKOB 2.5 (from step 3.)
  9. Note that no code is received

Create wiki page about Morse timing

Document the timing of Morse code, addressing especially the differences between International Morse and American Morse as well as how Farnsworth spacing is calculated for both codes.

MKOB:Windows - Provide 'application install and launcher'

Provide an easy way to install the components needed to run PyKOB and run it.

This should check/install Python, the needed libraries, the application and provide a launch application so users don't need to use a command like python3 mkob.py to run the application.

MKOB:MAC: Console window remains open after GUI is closed

When running MKOB.pyw from a command/terminal on Mac, the terminal window remains open (I think it should go away right away. The fact that it remains open is (probably) a separate issue.

This issue is that when the GUI is closed, the command/terminal remains open. It seems like it should close, or at least go back to a prompt.

Use the 'flags' field to distinguish ID packets

Currently, the pykob.internet module looks for a zero-length code sequence to indicate that a data packet is an ID packet and not a code packet. It would be better to use the 'flags' field in the data packet to make this determination.

Sample - add command line option to save the app parameters

Add a --save option to save the user specified application options (the values for --full, --di) to be used when the app is next run.

Might consider --Save to save all options (app and common) - but that should be a separate issue.
Also --default to remove the user values that have been saved (so they will pick up the current programmed defaults) - but that should be a separate issue.

Setup - Update setup.py files

Someone more knowledgeable than myself needs to overhaul the setup files pykob/setup.py and mkob/setup.py. All details of these files need to be revisited (version no., etc.) but in particular I should not be listed as the sole author. Also, I don't know how these setup files relate to the broader issue #44 of providing installation capabilities for different platforms.

MKOB:Mac - Provide 'application launcher'

Provide an easy way to install the components needed to run PyKOB and run it.

This should check/install Python, the needed libraries, the application and provide a launch application so users don't need to use a command like python3 mkob.py to run the application.

MKOB: Received code stops short of that sent

The received code window stops two characters short of what is sent on the wire.

For example, when receiving code on a wire where another station sends "ABCDEFG", the received code window shows "ABCDE" (missing the "FG").

Image from MKOB-2.5 (sending) and MKOB-4.0.3 (receiving):
6-19-2020 10-46-08 PM

Create `shortcuts` for MorseKOB applicationsI

It would be nice to have Windows, Mac and Linux shortcuts for the typically used applications (sample.py, clock.py, etc.) so the user doesn't need the enter python3 <app.py> (py <app.py>).

Write logging files into a `log/` directory

To make it easier to find any/all of the logging output and to make it easier to ignore any generated logging files in Git (or other VCS), create a log/ directory and configure all logging to go into it.

Update .gitignore to ignore log/.

MKOB:Linux - Provide 'application launcher'

Provide an easy way to install the components needed to run PyKOB and run it.

This should check/install Python, the needed libraries, the application and provide a launch application so users don't need to use a command like python3 mkob.py to run the application.

MKOB: UI doesn't display labels/buttons well

Running MKOB (python) on Mac doesn't display the label text and the buttons and text-box outlines do not display acceptably.

Information from test:

  1. Mac: MacBook Pro (Retina), Catalina 10.15.4
  2. Warnings/Errors listed during start:
DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
2020-05-26 23:42:24.352 Python[851:26597] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.352 Python[851:26597] CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
2020-05-26 23:42:24.449 Python[851:26597] CoreText note: Client requested name ".SF NS Mono", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.457 Python[851:26597] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.457 Python[851:26597] CoreText note: Client requested name ".SF NS Mono", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.457 Python[851:26597] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.457 Python[851:26597] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.458 Python[851:26597] CoreText note: Client requested name ".SF NS Mono", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
2020-05-26 23:42:24.458 Python[851:26597] CoreText note: Client requested name ".SFNSMono-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
  1. Image of GUI on Mac:

MKOB on Mac - 20200526

MKOB - GUI on Mac is not as clear as on Win

When running on a Mac the GUI has a lot of boxes, buttons, etc. that don't display (or are very faint) when compared the the GUI on Windows (I haven't checked yet on Linux).

Audio produces multiple ALSA error messages on Linux.

When I run Sample.py, I do hear the simulated sounder through the speakers, but the program produces the following warning messages:

les@Whimsy:~/PyKOB$ python3 Sample.py
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
HI
~ The quick brown fox +
les@Whimsy:~/PyKOB$

If I try listening to an active wire using the MKOB client, the 'ALSA underrun' message appears over and over again.

MKOB: Implement break behavior

When MKOB is connected to a wire and a remote operator opens his key ("breaks" the circuit), the local loop should remain open. That way, when the local operator's sounder stops following his key, he knows that the remote operator wants him to stop sending and close his key.

Past experience tells me this is surprisingly tricky to implement, but worth the effort.

MorseKOB 2.5 allows the local operator to regain control of the wire by toggling the circuit closer checkbox (or, equivalently, by pressing the Escape key twice). This has proved to be a useful feature, despite its departure from realism.

[Feature] Add support for 'cut numbers' in generated Morse

"Cut Numbers" are letters used in place of common numbers. See https://wb8ylo.wordpress.com/2014/12/04/cw-shorthand-cut-numbers/ for a table of abbreviations for otherwise 5-symbol number representations and their "cut number" variants:

Number Normal Code Cut Number Result
1 di dah dah dah dah di dah A
2 di di dah dah dah di di dah U
3 di di di dah dah di di di dah V
4 di di di di dah di di di di dah 4
5 di di di di dit dit E
6 dah di di di dit dah di di di dit 6
7 dah dah di di dit dah dah dit G
8 dah dah dah di dit dah di dit D
9 dah dah dah dah dit dah dit N
0 dah dah dah dah dah dah T

It would be cool if either the core Morse encoding engine or specific applications like Clock.py could add optional support for using "cut numbers" to represent the numeric content in the message, perhaps in various levels (e.g. only use 'N' for '9', or also use 'T' for '0', or use A,U,V,E,G,and D as well?)

Clock.py doesn't guarantee 2-digit minutes in its time format

When Clock.py makes its initial announcement, it doesn't make sure the minutes have a leading '0' for the first 10 minutes. It will announce "The time is 16:7", for instance, instead.

The format should use a leading zero to make sure the 'minutes' field is always exactly 2 digits.

MKOB - Provide 'application launcher'

There should be a platform friendly/specific 'application launcher' that can be installed and allows a user to launch the application via an icon/shortcut (rather than running pythonX MKOB.py) In a platform GUI. The app/launch icon should be a "Morse-type image". The icon should be shown in the 'start/active' bar and as a desktop item (if the user selects to create it) to launch the app or select it when it is running.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.