diff --git a/renderdocui/Windows/Dialogs/PythonShell.Designer.cs b/renderdocui/Windows/Dialogs/PythonShell.Designer.cs index 58316ef83..9a194504f 100644 --- a/renderdocui/Windows/Dialogs/PythonShell.Designer.cs +++ b/renderdocui/Windows/Dialogs/PythonShell.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.Windows.Forms.ToolStripContainer toolStripContainer1; System.Windows.Forms.ToolStrip toolStrip1; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PythonShell)); @@ -50,6 +51,7 @@ this.saveDialog = new System.Windows.Forms.SaveFileDialog(); this.openDialog = new System.Windows.Forms.OpenFileDialog(); this.newScript = new System.Windows.Forms.ToolStripButton(); + this.linenumTimer = new System.Windows.Forms.Timer(this.components); toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); toolStrip1 = new System.Windows.Forms.ToolStrip(); toolStripContainer1.ContentPanel.SuspendLayout(); @@ -301,6 +303,11 @@ this.newScript.Text = "New"; this.newScript.Click += new System.EventHandler(this.newScript_Click); // + // linenumTimer + // + this.linenumTimer.Interval = 500; + this.linenumTimer.Tick += new System.EventHandler(this.linenumTimer_Tick); + // // PythonShell // this.AllowDrop = true; @@ -356,6 +363,7 @@ private System.Windows.Forms.SaveFileDialog saveDialog; private System.Windows.Forms.OpenFileDialog openDialog; private System.Windows.Forms.ToolStripButton newScript; + private System.Windows.Forms.Timer linenumTimer; } diff --git a/renderdocui/Windows/Dialogs/PythonShell.cs b/renderdocui/Windows/Dialogs/PythonShell.cs index ecdfa15d0..8db9a5aec 100644 --- a/renderdocui/Windows/Dialogs/PythonShell.cs +++ b/renderdocui/Windows/Dialogs/PythonShell.cs @@ -287,9 +287,9 @@ namespace renderdocui.Windows.Dialogs { if (result == "exception") { - System.Diagnostics.Trace.WriteLine("On line " + frame.f_lineno.ToString()); - linenum = (int)frame.f_lineno - 1; + System.Diagnostics.Trace.WriteLine("On line " + frame.f_lineno.ToString()); } + linenum = (int)frame.f_lineno - 1; stdoutwriter.Flush(); stdout.Seek(0, SeekOrigin.Begin); @@ -339,6 +339,9 @@ namespace renderdocui.Windows.Dialogs EnableButtons(false); + linenumTimer.Enabled = true; + linenumTimer.Start(); + Thread th = Helpers.NewThread(new ThreadStart(() => { pythonengine.SetTrace(PythonTrace); @@ -346,6 +349,7 @@ namespace renderdocui.Windows.Dialogs // ignore output, the trace handler above will print output string output = Execute(pythonengine, scriptscope, script); + linenumTimer.Stop(); pythonengine.SetTrace(null); this.BeginInvoke(new Action(() => @@ -439,5 +443,10 @@ namespace renderdocui.Windows.Dialogs scriptEditor.Text = scriptEditor.Text.Replace("\n", Environment.NewLine); } + + private void linenumTimer_Tick(object sender, EventArgs e) + { + SetLineNumber(linenum); + } } } diff --git a/renderdocui/Windows/Dialogs/PythonShell.resx b/renderdocui/Windows/Dialogs/PythonShell.resx index f58f6b829..398af4c95 100644 --- a/renderdocui/Windows/Dialogs/PythonShell.resx +++ b/renderdocui/Windows/Dialogs/PythonShell.resx @@ -166,4 +166,7 @@ 318, 16 + + 433, 16 + \ No newline at end of file