TCL set_sys command handler exits with error

Issue #248 resolved
MARCO A QUEZADA created an issue

It does not matter if the command succeeds, the code directs the feedback to indicate that the request failed.

Comments (5)

  1. MARCO A QUEZADA reporter

    @jpcgt I'm no python expert but the original code seems to have used an early return statement to indicate success:

    https://bitbucket.org/jpcgt/flatcam/commits/261054f1cf11c65a9d3013721c1f5f1f4c1514a7#LFlatCAMApp.pyT3666

    The current version of the code simply runs through the end of the method where the error is printed:

    https://bitbucket.org/jpcgt/flatcam/commits/261054f1cf11c65a9d3013721c1f5f1f4c1514a7#LtclCommands/TclCommandSetSys.pyT72

    Should the fixed code look more like this:

                try:
                    value = tcl2py[value]
                    self.app.defaults[param] = value
                    self.app.propagate_defaults()
    
                except KeyError:
                    self.raise_tcl_error("No such system parameter \"{}\".".format(param))
                    pass
    

    Let me know, I can make the fix and commit the update.

  2. Juan Pablo Caram repo owner

    Wow, I can't believe this has been like this for so long. I thought it was a recent bug.

    The solution is simpler. Just need:

    else:
        self.raise_tcl_error("No such system parameter \"{}\".".format(param))
    

    at the end.

    The original try/except is alright. It is okay if it fails. It means, value does not get replaced.

  3. Log in to comment