thaolt / qscite

Automatically exported from code.google.com/p/qscite
GNU General Public License v2.0
0 stars 0 forks source link

Scriptability - how about QtScript? #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
QtScript, if anyone is unfamiliar with it, is an ECMAScript implementation
that's been in the last few releases of Qt.
It's probably our best choice for scripting because someone else already
did the hard part.

Original issue reported on code.google.com by bfrobin...@gmail.com on 6 Jan 2009 at 4:16

GoogleCodeExporter commented 8 years ago
Added the basics of this (r167).  Placed a "Script Console" item in the Edit 
menu.  
When you click you get a dialog with a text box and an execute button.  

The current document (MainWindow::getCurDoc()) can be accessed in the global 
variable 
"document" and the window (MainWindow) can be accessed in the global variable 
"window".

Results are shown in a label in the lower left corner.  If an error is returned 
the 
error message is displayed.  If a value is returned then that is what shows.  
If 
undefined or null is returned a message is displayed saying that execution was 
successful.

Couple ideas for further work here:

1. A library to store scripts in.
2. A QScintilla editor for the command textbox so that we can get JavaScript 
highlighting.

Original comment by didoro...@gmail.com on 8 Jan 2010 at 5:50

GoogleCodeExporter commented 8 years ago
I tried this, and the document object seems to work, but I couldn't get 
anything to 
work for the window object.  Also, we probably need to take the engine and make 
it 
part of the FileData struct in mainwindow.h.  That way, if we have pre-written 
scripts 
to run, we don't have to open up the script console dialog.  It should probably 
be a 
pointer, instantiating it automatically if a script is run or the script 
console is 
opened.

Original comment by jpsut...@gmail.com on 8 Jan 2010 at 1:46

GoogleCodeExporter commented 8 years ago
We probably need some sort of watch dog on the script engine so that if a 
script runs 
for longer than a certain amount of time we can give the option to stop it. If 
you 
create an infinite loop it locks up the program.

Original comment by didoro...@gmail.com on 9 Jan 2010 at 3:25

GoogleCodeExporter commented 8 years ago
Moved script engine to MainWindow to allow scripts to be run in the future 
without 
the script dialog being open.

Also changed the code editor in the Script Console to be a QsciScintilla 
instance 
that does JavaScript highlighting. (also applies all other preferences the user 
has 
set)

see r168

Now if only Jared would commit what he was working on yesterday...

Original comment by didoro...@gmail.com on 9 Jan 2010 at 6:01

GoogleCodeExporter commented 8 years ago
OK, OK.... see r169 for my (delayed) commits. :)

Original comment by jpsut...@gmail.com on 10 Jan 2010 at 6:10

GoogleCodeExporter commented 8 years ago
Added wrapper class for QSciteEditor.  Tried to use the sub class but got seg 
fault 
without any further info so decided a wrapper would be better.  Couple of 
functions 
are not accessible (b/c I was lazy and did not want to mess with the compiler 
errors).

Couple things need to be done here.  First we need to make all of the functions 
accept 
simple types (ie. QPoint needs to be (int, int)).  Second we need to get the 
other 
functions working.

Original comment by didoro...@gmail.com on 15 Jan 2010 at 5:40

GoogleCodeExporter commented 8 years ago
The basic idea of this one has been implemented.  We should have some ui added 
in for specifying a directory to store scripts in, etc.  But I think that could 
be a different feature request...

Original comment by jpsut...@gmail.com on 22 Oct 2010 at 1:08