mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-24 23:46:41 +00:00
Don't allow 'run' when editing UI extension files
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
@@ -514,6 +514,8 @@ void PythonShell::editorTab_Changed(int index)
|
||||
EditorWrapper *editor = curEditor();
|
||||
|
||||
ui->saveScript->setEnabled(editor && editor->filename() != QString());
|
||||
|
||||
enableButtons(ui->newScript->isEnabled());
|
||||
}
|
||||
|
||||
void PythonShell::openFileModified(const QString &path)
|
||||
@@ -1398,6 +1400,15 @@ void PythonShell::on_projectExplorer_itemActivated(RDTreeWidgetItem *item, int c
|
||||
if(filename.isEmpty())
|
||||
return;
|
||||
|
||||
bool isExt = false;
|
||||
RDTreeWidgetItem *parent = item;
|
||||
while(parent)
|
||||
{
|
||||
if(parent == m_UIExtensions)
|
||||
isExt = true;
|
||||
parent = parent->parent();
|
||||
}
|
||||
|
||||
for(EditorWrapper *edit : m_Editors)
|
||||
{
|
||||
if(edit->filename() == filename)
|
||||
@@ -1428,6 +1439,11 @@ void PythonShell::on_projectExplorer_itemActivated(RDTreeWidgetItem *item, int c
|
||||
|
||||
LoadScriptFromFilename(filename);
|
||||
|
||||
if(isExt)
|
||||
m_Editors.back()->setUIExtension(true);
|
||||
|
||||
editorTab_Changed(-1);
|
||||
|
||||
QString unsavedFile = interactiveContext->GetTempFilename(lit("script.py"));
|
||||
if(filename == unsavedFile)
|
||||
{
|
||||
@@ -1843,6 +1859,19 @@ void PythonShell::enableButtons(bool enable)
|
||||
ui->abortRun->setEnabled(!enable);
|
||||
ui->debugScript->setEnabled(enable);
|
||||
|
||||
EditorWrapper *editor = curEditor();
|
||||
|
||||
ui->runScript->setToolTip(QString());
|
||||
|
||||
if(editor)
|
||||
{
|
||||
if(editor->isUIExtension())
|
||||
{
|
||||
ui->runScript->setEnabled(false);
|
||||
ui->runScript->setToolTip(tr("UI Extension files can't be run"));
|
||||
}
|
||||
}
|
||||
|
||||
if(enable && !m_Ctx.Config().Python_DebugEnabled)
|
||||
{
|
||||
ui->debugScript->setEnabled(false);
|
||||
|
||||
@@ -61,6 +61,8 @@ class EditorWrapper : public QFrame
|
||||
QString m_Filename;
|
||||
bool m_Modified = false;
|
||||
|
||||
bool m_UIExt = false;
|
||||
|
||||
void updateTitle();
|
||||
|
||||
public:
|
||||
@@ -77,6 +79,9 @@ public:
|
||||
bool isModified() { return m_Modified; }
|
||||
void markModified(bool modified);
|
||||
|
||||
bool isUIExtension() { return m_UIExt; }
|
||||
void setUIExtension(bool uiext) { m_UIExt = uiext; }
|
||||
|
||||
public slots:
|
||||
bool checkAllowClose();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user