mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[code] Scripts can be automatically imported when the console is opened.
Editing, renaming, deleting or changing the auto-importation of a script triggers the reloading of the console (the history is cleared, Python restarted and the scripts re-imported). Change-Id: If8b933cc077ecd36cab09214b5e7a181aa3ae030
This commit is contained in:
@@ -108,6 +108,20 @@ bool ScriptStore::renameScriptAtIndex(int index, const char * newName) {
|
||||
return m_accordion.replaceBufferAtIndex(accordionIndex, newName);
|
||||
}
|
||||
|
||||
void ScriptStore::switchAutoImportAtIndex(int index) {
|
||||
assert(index >= 0 && index < numberOfScripts());
|
||||
Script script = scriptAtIndex(index);
|
||||
bool autoImportation = script.autoImport();
|
||||
int accordionIndex = accordionIndexOfMarkersOfScriptAtIndex(index);
|
||||
if (autoImportation) {
|
||||
const char autoImportationString[2] = {Script::NoAutoImportationMarker, 0};
|
||||
m_accordion.replaceBufferAtIndex(accordionIndex, autoImportationString);
|
||||
return;
|
||||
}
|
||||
const char autoImportationString[2] = {Script::AutoImportationMarker, 0};
|
||||
m_accordion.replaceBufferAtIndex(accordionIndex, autoImportationString);
|
||||
}
|
||||
|
||||
void ScriptStore::deleteScriptAtIndex(int index) {
|
||||
assert (index >= 0 && index < numberOfScripts());
|
||||
int accordionIndex = accordionIndexOfContentOfScriptAtIndex(index);
|
||||
@@ -179,7 +193,7 @@ bool ScriptStore::copyFactorialScriptOnFreeSpace() {
|
||||
}
|
||||
|
||||
bool ScriptStore::copyEmptyScriptOnFreeSpace() {
|
||||
const char script[] = "\0";
|
||||
const char script[] = " ";
|
||||
return m_accordion.appendBuffer(script);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user