TazGraph Project v0.1.0
Loading...
Searching...
No Matches
PythonInterpreterPanel.h
1#pragma once
2
3#include "../../UIElement.h"
4
5#pragma GCC diagnostic push
6#pragma GCC diagnostic ignored "-Wattributes"
7
9 IScene* scene;
10 ImVec2* viewportPos;
11 ImVec2* viewportSize;
12};
13
15{
16private:
18 char _pythonBuffer[1024] = "";
19 char _updateBuffer[4096] = "";
20
21 py::object _stdout_buffer;
22
23 std::string _outputText;
24 std::string _updateOutputText;
25
26 enum console_state {
27 Collapsed,
28 Expanded
29 };
30
31 enum class ScriptType {
32 OneOff,
33 OnUpdate
34 };
35
36 ScriptType currentScriptType = ScriptType::OneOff;
37
38 console_state state = console_state::Collapsed;
39 console_state last_state = console_state::Collapsed;
40public:
41
42 float default_pythonConsoleHeight = 400.0f;
43
44 ImRect titleBarRect;
45
46 float intervalSec = 1.0f;
47 double lastExecTime = 0.0;
48 bool useInterval = false;
49 bool updatePaused = true;
50
51 bool inputActive = false;
52
53 bool firstLoop = true;
54
55 bool readyToClear = false;
56 bool readyToExecute = false;
57
58 ImGuiChildFlags flags = ImGuiWindowFlags_NoSavedSettings;
59
61 void update(float deltaTime) override;
62
63 void setConfig(const PythonInterpreterConfig& cfg) {
64
65
66 config = cfg;
67
68 }
69 void OnImGuiRender() override;
70
71 void setFlags();
72 void innerTable();
73 void clearOutput();
74 void runScript();
75 void runUpdateScript(float deltaTime);
76};
77
78#pragma GCC diagnostic pop
Definition IScene.h:25
Definition PythonInterpreterPanel.h:15
PythonInterpreterPanel()
!!!!! Python to run needs to be on the context of scene, not render thread
Definition PythonInterpreterPanel.cpp:6
void update(float deltaTime) override
Definition PythonInterpreterPanel.cpp:10
void runScript()
Definition PythonInterpreterPanel.cpp:253
Definition UIElement.h:16
Definition PythonInterpreterPanel.h:8