mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-23 14:15:42 +00:00
Add option to launch/wait for debugger on python contexts
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include <QRegularExpression>
|
||||
#include "Code/Interface/QRDInterface.h"
|
||||
#include "Code/Resources.h"
|
||||
#include "Code/pyrenderdoc/PythonContext.h"
|
||||
#include "Widgets/Extended/RDHeaderView.h"
|
||||
#include "Windows/MainWindow.h"
|
||||
#include "ui_ExtensionManager.h"
|
||||
@@ -54,6 +55,7 @@ ExtensionManager::ExtensionManager(ICaptureContext &ctx)
|
||||
ui->author->setText(lit("---"));
|
||||
ui->URL->setText(lit("---"));
|
||||
ui->reload->setEnabled(false);
|
||||
ui->debug->setEnabled(false);
|
||||
ui->alwaysLoad->setEnabled(false);
|
||||
|
||||
QObject::connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
@@ -128,6 +130,38 @@ void ExtensionManager::on_reload_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void ExtensionManager::on_debug_clicked()
|
||||
{
|
||||
if(m_Extensions.empty())
|
||||
return;
|
||||
|
||||
RDTreeWidgetItem *item = ui->extensions->currentItem();
|
||||
if(!item)
|
||||
return;
|
||||
|
||||
int idx = ui->extensions->indexOfTopLevelItem(item);
|
||||
|
||||
if(idx >= 0 && idx < m_Extensions.count())
|
||||
{
|
||||
const ExtensionMetadata &e = m_Extensions[idx];
|
||||
if(!e.name.isEmpty())
|
||||
{
|
||||
PythonContext::PrepareDebuggerWait();
|
||||
|
||||
LambdaThread *thread = new LambdaThread([this]() {
|
||||
PythonContext::WaitForDebugger();
|
||||
|
||||
GUIInvoke::call(this, [this]() { on_reload_clicked(); });
|
||||
});
|
||||
|
||||
thread->selfDelete(true);
|
||||
thread->start();
|
||||
|
||||
PythonContext::LaunchDebugger(this, m_Ctx.Config(), QFileInfo(e.filePath).absoluteFilePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExtensionManager::on_openLocation_clicked()
|
||||
{
|
||||
if(m_Extensions.empty())
|
||||
@@ -239,6 +273,7 @@ void ExtensionManager::update_currentItem(RDTreeWidgetItem *item)
|
||||
|
||||
bool loaded = item->checkState(2) == Qt::Checked;
|
||||
ui->reload->setEnabled(true);
|
||||
ui->debug->setEnabled(true);
|
||||
ui->reload->setText(loaded ? tr("Reload") : tr("Load"));
|
||||
ui->alwaysLoad->setEnabled(loaded);
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ public:
|
||||
private slots:
|
||||
// automatic slots
|
||||
void on_reload_clicked();
|
||||
void on_debug_clicked();
|
||||
void on_openLocation_clicked();
|
||||
void on_alwaysLoad_toggled(bool checked);
|
||||
void on_extensions_currentItemChanged(RDTreeWidgetItem *item, RDTreeWidgetItem *);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>556</width>
|
||||
<height>544</height>
|
||||
<height>572</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@@ -191,10 +191,23 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QHBoxLayout" name="extensionButtonsLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="openLocation">
|
||||
<property name="text">
|
||||
@@ -209,6 +222,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="debug">
|
||||
<property name="text">
|
||||
<string>Debug</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="alwaysLoad">
|
||||
<property name="text">
|
||||
|
||||
@@ -308,6 +308,7 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent)
|
||||
ui->EventBrowser_ColorEventRow->setChecked(m_Ctx.Config().EventBrowser_ColorEventRow);
|
||||
|
||||
ui->Python_DebugEnabled->setChecked(m_Ctx.Config().Python_DebugEnabled);
|
||||
ui->Python_LaunchVSCode->setChecked(m_Ctx.Config().Python_LaunchVSCode);
|
||||
|
||||
ui->Python_DebugPyDir->setText(m_Ctx.Config().Python_DebugPyDir);
|
||||
|
||||
@@ -878,6 +879,13 @@ void SettingsDialog::on_Python_DebugEnabled_toggled(bool checked)
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_Python_LaunchVSCode_toggled(bool checked)
|
||||
{
|
||||
m_Ctx.Config().Python_LaunchVSCode = ui->Python_LaunchVSCode->isChecked();
|
||||
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
// texture viewer
|
||||
void SettingsDialog::on_TextureViewer_PerTexSettings_toggled(bool checked)
|
||||
{
|
||||
|
||||
@@ -86,6 +86,7 @@ private slots:
|
||||
void on_Python_DebugPyDirBrowse_clicked();
|
||||
void on_Python_DebugPyDir_textEdited(const QString &dir);
|
||||
void on_Python_DebugEnabled_toggled(bool checked);
|
||||
void on_Python_LaunchVSCode_toggled(bool checked);
|
||||
|
||||
// texture viewer
|
||||
void on_TextureViewer_PerTexSettings_toggled(bool checked);
|
||||
|
||||
@@ -751,7 +751,26 @@ After interop is enabled you will need to reload any capture.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="Python_LaunchVSCodeLabel">
|
||||
<property name="text">
|
||||
<string>Launch VS Code for debugging</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="Python_LaunchVSCode">
|
||||
<property name="toolTip">
|
||||
<string>When debugging a python script or UI extension, launch new instance of VS Code.
|
||||
|
||||
If disabled, debugging will do nothing and wait for a debugger connection.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
||||
Reference in New Issue
Block a user