diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bfb98c3..3f331da4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ CHANGELOG for FlatCAM beta - on launching the Tcl Shell the Edit line will take focus immediately - in App.on_mouse_move_over_plot() method no longer will be done a setFocus() on every move, only when it is needed - added an extra check if old preferences files are detected, a check if the type of the values is the same with the type in the current preferences file. If the type is not the same then the current type is preferred. +- aligned the Tcl commands display when the Help Tcl command is run without parameters 22.04.2020 diff --git a/tclCommands/TclCommandHelp.py b/tclCommands/TclCommandHelp.py index d40ac267..d083f949 100644 --- a/tclCommands/TclCommandHelp.py +++ b/tclCommands/TclCommandHelp.py @@ -82,31 +82,28 @@ class TclCommandHelp(TclCommand): curr_len = len(cmd_name) if curr_len > max_len: max_len = curr_len - max_tabs = math.ceil(max_len / 8) + h_space = " " + cnt = 0 for cmd_name in sorted(self.app.tcl_commands_storage): cmd_description = "%s" % self.app.tcl_commands_storage[cmd_name]['description'] curr_len = len(cmd_name) - tabs = '\t' cmd_name_colored = "%s" % str(cmd_name) - # 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' % (cmd_name_colored, tabs, cmd_description) - else: - nr_tabs = 0 + nr_chars = max_len - curr_len - 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' % (cmd_name_colored, nr_tabs * tabs, cmd_description) + cmd_line_txt = '%s%s  %s' % (cmd_name_colored, nr_chars * h_space, cmd_description) displayed_text.append(cmd_line_txt) + + # group commands by 4 adding a line break after 4 commands + if cnt == 3: + cnt = 0 + displayed_text.append(' ') + else: + cnt += 1 except Exception as err: self.app.log.debug("App.setup_shell.shelp() when run as 'help' --> %s" % str(err)) displayed_text = ['> %s\n' % cmd for cmd in sorted(self.app.tcl_commands_storage)]