Kexi/Plugins/Scripts/Script Editor
Introduction
The Kexi scripting editor is a tool for developing script code and is located in kexi/plugins/scripting/*. Internaly KexiScriptEditor inherits KexiEditor located in kexi/widgets/kexieditor.*, a wrapper around KTextEditor.
(References to Kross are outdated)
Ideas
To name just some ideas a script editor could be aware of;
- create skeletons for new classes/functions
- debugging, breakpoints
- Source-formatter
- word completion
- create documentation out of the code (use kexi-reporter?)
- Some of the goodies KDevelop provides could be maybe (re-)used
Error Handling
Kross provides stdin and stdout events which are catched and displayed at the textview. That way scripting code is able to print some visibled feedback. In python or in the Kross scripting framework thrown exceptions are catched and displayed as stderr-message. Execution got aborted and a signal emitted which indicates the linenumber in the scripting code where the exception got thrown.
Flattening the user-level API
jstaniek, dec 2005 status: proposal note: this could be moved to other document...
Flattening the user-level API means simplicity for average use case. Of course, there still could be the original KexiDB API exposed. Look at the KexiDB connectivity example above, then at the following flattened version:
# no import directive here: everything is imported by default connection = Connection("SQLite3", "/home/foo/myproject.kexi") if not connection.connect(): # Joe user wil luse message boxes and return here rather, no exceptions messagebox("Failed to connect") return # no conn.useDatabase(...) is required here: # SQLite driver uses the db at the connect time
# - default value used value here # - unlike in KexiDB the statement here # - is parsed against KEXISQL grammar print connection.querySingleString("SELECT name FROM table1")