From 334a28fb6ab8198db1e750838201e2c720171edc Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Wed, 15 Apr 2020 05:42:38 +0300 Subject: [PATCH] - made sure that the Tcl commands descriptions listed on help command are aligned --- FlatCAMApp.py | 26 +++++++++++++++++++++++++- README.md | 4 ++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index dd8f0e61..6740bf68 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -11970,10 +11970,34 @@ class App(QtCore.QObject): displayed_text = [] try: + # find the maximum length of a command name + max_len = 0 + for cmd_name in commands: + curr_len = len(cmd_name) + if curr_len > max_len: + max_len = curr_len + for cmd_name in sorted(commands): cmd_description = commands[cmd_name]['description'] - cmd_line_txt = ' %s\t\t%s' % (str(cmd_name), cmd_description) + curr_len = len(cmd_name) + tabs = '\t' + + # make sure to add the right number of tabs (1 tab = 8 spaces) so all the commands + # descriptions are aligned + if curr_len == max_len: + cmd_line_txt = ' %s%s%s' % (str(cmd_name), tabs, cmd_description) + else: + max_tabs = math.ceil(max_len/8) + nr_tabs = 0 + + for x in range(max_tabs): + if curr_len <= (x*8): + nr_tabs += 1 + + # nr_tabs = 2 if curr_len <= 8 else 1 + cmd_line_txt = ' %s%s%s' % (str(cmd_name), nr_tabs*tabs, cmd_description) + displayed_text.append(cmd_line_txt) except Exception as err: log.debug("App.setup_shell.shelp() when run as 'help' --> %s" % str(err)) diff --git a/README.md b/README.md index 84ca08fc..f8d2641c 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ CAD program, and create G-Code for Isolation routing. ================================================= +15.04.2020 + +- made sure that the Tcl commands descriptions listed on help command are aligned + 14.04.2020 - lightened the hue of the color for 'success' messages printed in the Tcl Shell browser