About the Project

The project is focussed on enhancing OpenSCAD GUI by adding some new features and widgets, suggested by the OpenSCAD Community.
The following enhancements were proposed for working on during the GSoC 2020 period.

  • Number Scroll via Mouse Wheel in the Text Editor
  • Enhanced Error Reporting & a new Error-Log Widget

The following PRs have been made during GSoC-

Work Done

1. Shortcuts-GUI

  • Improving the File-Based Approach for Shortcuts, on which I started working before the commencement of the Coding Period of GSoC.
  • A simple JSON file can now be used to override the default shortcuts for various actions in OpenSCAD.
{
// remove all shortcuts
"action1" : "",

// overwrite default shortcut
"action2" : "CTRL-X",
// overwrite default shortcut with multikey shortcut
"action3" : "CTRL-X, CTRL-Y",
// add shortcut leaving the default one active as default
"action4" : ["DEFAULT", "CTRL-X"],

// set multiple shortcuts
"action6" : ["CTRL-X", "CTRL-Y"],
}
  • Added a GUI for allowing users to set custom-shortcuts.
  • Users can set new shortcuts by selecting the action and pressing the key-sequence.
  • Added a search bar at the top of the widget, to search actions by name.
  • All the shortcuts can be reset to defaults using the ‘Reset’ button.
  • Import a file from GUI to the user-config path.

2. Number Scroll via Mouse Wheel in Text-Editor:

This feature will allow the user to scroll the numbers in the text-editor by scrolling the mouse wheel.

What has been done:

  • Numerical Values can be changed by mouse wheel scroll with a modifier.
  • The modifier can be selected from Editor Preferences.
  • The step size can be configured from Editor Preferences.
  • The feature can be disabled from Editor Preferences.
  • Delay Preview Until Done

3. Better Error Reporting & a new Error Log Widget

The work in this phase can be divided into two steps:

a. Introducing a new unified method to accept the messages for Errors, Warnings, Trace, etc from different parts of the application:

Added a new method LOG() to accept log-messages from different parts and sending them to the console and a new ErrorLog Widget simultaneously.

LOG(message_group, Location, Document Path, Message, Args.....)
LOG(message_group::Warning,inst->location(),ctx->documentPath(),"color() expects numbers between 0.0 and 1.0. Value of %1$.1f is out of range");

b. Making a new GUI Widget for logging all the Errors/Warnings kind of messages:

  • A new Dockable Error Log Widget where all the errors/warnings and other messages will be listed in the tabular form.
  • The row containing messages are selectable and jump the cursor/caret to the error/warning location inside the text-editor if the location exists.
  • An option to Hide/Unhide Error-Log in View menu.
  • A filter in the new widget to view messages belonging to a particular group.

c. Hyperlink the messages in the console, with their locations:

The messages in the console having an appropriate concerning location in the .scad files are now hyperlinked with their locations. Clicking them will take the caret to the location of concern, inside the text editor.

Testing

  • Testing for GUI Features is done manually, by abusing the GUI Systems and trying different interactions.
    Feedback from the mentors helped me a lot in bringing new bugs into the notice.
  • Testing of the new LOG() method introduced, is done through the already existing test-bed of OpenSCAD, which is ctests.

Challenges

  • The biggest challenge for me was to jump from working on one feature to another, because they were quite different in implementation, and it took time for me to understand my tasks, before making significant progress at the start of all the three features.
  • While introducing the new LOG() method for messages, most of the tests start failing due to certain differences in the expected output. So, handling those tests made me explore the entire source-code, and it was quite challenging.

GSoC 2020 | Blockchain | Senior Undergrad