Reloading of Script before execution

Discussion forum for contributors and developers who are using the QCAD version 3 ECMAScript development platform or the C++ plugin interface or who are otherwise looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Reloading of Script before execution

Postby hungerburg » Mon Sep 26, 2011 3:09 pm

Andrew, how do you do it, that a script gets reloaded from file on each execution?

The first custom script, the one that is called from the menu or button, will be reloaded each time, if the "beginEvent" hook ends with a "delete Foo" statement, Foo being the name of the class itself.

But classes instantiated inside of this class will not be reloaded the next time the first one is instantiated, and if I delete them, they will be missing then.

There must be a special trick that you apply and that I dont understand. Would you explain?

Peter
User avatar
hungerburg
Senior Member
 
Posts: 125
Joined: Fri May 28, 2010 7:35 pm

Postby andrew » Mon Sep 26, 2011 3:59 pm

We've introduced the command line option -always-load-scripts for this:

./qcad -always-load-scripts

See also output of:

./qcad -help

Deleting classes is no longer required with this switch.
User avatar
andrew
Site Admin
 
Posts: 2559
Joined: Fri Mar 30, 2007 6:07 am

QCAD3 rocks

Postby hungerburg » Tue Sep 27, 2011 9:57 am

Ahh, this is good news for people like me, that follow a very iterative approach to development - Thank You.

I tried now calling a script from commandline with the name specified for such occasions in the "beginEvent", but get this Warning: RGuiAction::getByScriptFile: no action found: "MyScript".

Using the path relative to the qcad3 root "scripts/..." works though. Using the -exec argument after a filename will even first load the file and then perform the action on it in one go. Great!
User avatar
hungerburg
Senior Member
 
Posts: 125
Joined: Fri May 28, 2010 7:35 pm

Re: QCAD3 rocks

Postby andrew » Wed Sep 28, 2011 12:21 pm

hungerburg wrote:I tried now calling a script from commandline with the name specified for such occasions in the "beginEvent", but get this Warning: RGuiAction::getByScriptFile: no action found: "MyScript".


The -exec switch expects an absolute or relative path to a script that contains a class with the same name as the file name and has a beginEvent function.

If I understand you correctly, you tried to pass -exec a class name. That is an interesting thought. Feature request:

http://www.ribbonsoft.com/bugtracker/in ... ask_id=277
User avatar
andrew
Site Admin
 
Posts: 2559
Joined: Fri Mar 30, 2007 6:07 am


Return to QCAD 3 Developers and Contributors

Who is online

Users browsing this forum: No registered users and 1 guest