Fixes for pull request #101

This commit is contained in:
valeriog
2014-10-28 20:27:33 +01:00
parent 71b10310cd
commit 91871a7a18
3 changed files with 22 additions and 2 deletions
+8
View File
@@ -28,6 +28,7 @@
/// </summary>
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;
}
+11 -2
View File
@@ -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);
}
}
}
@@ -166,4 +166,7 @@
<metadata name="openDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>318, 16</value>
</metadata>
<metadata name="linenumTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>433, 16</value>
</metadata>
</root>