Add a project explorer to the python scripting window

* This displays the current UI extension files, some built-in examples, and
  recently opened loose files
This commit is contained in:
baldurk
2026-08-13 17:46:44 +01:00
parent b846705c0b
commit 459bfb2592
7 changed files with 477 additions and 13 deletions
+21 -1
View File
@@ -24,6 +24,7 @@
#pragma once
#include <QDir>
#include <QFrame>
#include "Code/Interface/QRDInterface.h"
#include "scintilla/include/qt/ScintillaEdit.h"
@@ -34,6 +35,8 @@ class RDToolTip;
class QTimer;
class QCompleter;
class QStringListModel;
class QFileSystemWatcher;
class RDTreeWidgetItem;
namespace Ui
{
@@ -107,6 +110,8 @@ private slots:
void on_abortRun_clicked();
void on_outputContext_currentIndexChanged(int idx);
void on_projectExplorer_itemActivated(RDTreeWidgetItem *item, int column);
bool checkAllowClose();
// manual slots
@@ -121,6 +126,10 @@ private slots:
void editorTab_Changed(int index);
void doSyntaxCheck();
void openFileModified(const QString &path);
void updateExtensionProjects();
void editorTab_Menu(const QPoint &pos);
private:
Ui::PythonShell *ui;
ICaptureContext &m_Ctx;
@@ -134,6 +143,10 @@ private:
bool m_ContextMenuVisible = false;
bool m_HelpPrinting = false;
RDTreeWidgetItem *m_UIExtensions, *m_Examples, *m_RecentFiles;
QFileSystemWatcher *m_Watcher = NULL;
QTimer *m_SyntaxCheckTimer;
QCompleter *m_InteractiveCompleter;
@@ -161,10 +174,17 @@ private:
QList<ScintillaEdit *> m_Scintillas;
void setupTabs();
ScintillaEdit *curEditor();
ScintillaEdit *makeEditor();
ScintillaEdit *makeEditor(rdcstr filename);
void updateEditorCloseButton();
void addRecentFile(rdcstr filename);
void updateRecentFiles(bool added);
void addExtensionDirItems(RDTreeWidgetItem *root, QDir dir);
bool eventFilter(QObject *watched, QEvent *event) override;
void updateScriptOutput(bool fullRefresh);