Use titles instead of filenames for script created new editors

This commit is contained in:
baldurk
2026-08-26 11:37:46 +01:00
parent 69a9c09ecd
commit a95d4d0461
2 changed files with 11 additions and 3 deletions
+10 -2
View File
@@ -796,7 +796,7 @@ EditorWrapper *PythonShell::curEditor()
return NULL;
}
void PythonShell::makeEditor(rdcstr filename, rdcstr text)
EditorWrapper *PythonShell::makeEditor(rdcstr filename, rdcstr text)
{
EditorWrapper *editor = new EditorWrapper(this);
editor->setObjectName(lit("scriptEditor"));
@@ -1005,6 +1005,8 @@ void PythonShell::makeEditor(rdcstr filename, rdcstr text)
sc->setText(text.c_str());
sc->emptyUndoBuffer();
editor->markModified(false);
return editor;
}
void PythonShell::updateEditorCloseButton()
@@ -1241,7 +1243,13 @@ bool PythonShell::LoadScriptFromFilename(rdcstr filename)
void PythonShell::CreateNewScriptEditor(rdcstr name, rdcstr text)
{
makeEditor(name, text);
EditorWrapper *ed = makeEditor("", text);
QFileInfo info(name);
if(info.isAbsolute() && (info.exists() || info.absoluteDir().exists()))
ed->setFilename(name);
else
ed->setTitle(name);
ui->saveScript->setEnabled(false);
updateNonDebugWarning();