From 29894e4db39e5705f697ce1ee2ae959e9c2d1cb9 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 10 Oct 2014 21:30:40 +0100 Subject: [PATCH] Add Interactive/script running python shell window --- renderdocui/Properties/Resources.Designer.cs | 10 + renderdocui/Properties/Resources.resx | 43 +- renderdocui/Resources/folder_page.png | Bin 0 -> 688 bytes .../Windows/Dialogs/PythonShell.Designer.cs | 362 +++++++++++++++ renderdocui/Windows/Dialogs/PythonShell.cs | 438 ++++++++++++++++++ renderdocui/Windows/Dialogs/PythonShell.resx | 169 +++++++ renderdocui/Windows/MainWindow.Designer.cs | 44 +- renderdocui/Windows/MainWindow.cs | 9 + renderdocui/renderdocui.csproj | 10 + 9 files changed, 1048 insertions(+), 37 deletions(-) create mode 100644 renderdocui/Resources/folder_page.png create mode 100644 renderdocui/Windows/Dialogs/PythonShell.Designer.cs create mode 100644 renderdocui/Windows/Dialogs/PythonShell.cs create mode 100644 renderdocui/Windows/Dialogs/PythonShell.resx diff --git a/renderdocui/Properties/Resources.Designer.cs b/renderdocui/Properties/Resources.Designer.cs index d52db3ba4..c244eac1f 100644 --- a/renderdocui/Properties/Resources.Designer.cs +++ b/renderdocui/Properties/Resources.Designer.cs @@ -260,6 +260,16 @@ namespace renderdocui.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap folder_page { + get { + object obj = ResourceManager.GetObject("folder_page", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/renderdocui/Properties/Resources.resx b/renderdocui/Properties/Resources.resx index 4903122b5..1a0a9e501 100644 --- a/renderdocui/Properties/Resources.resx +++ b/renderdocui/Properties/Resources.resx @@ -130,15 +130,18 @@ ..\Resources\stepnext.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\arrow_undo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\accept.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\timeline_marker.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\runback.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\page_white_link.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\page_white_database.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -163,18 +166,12 @@ ..\Resources\128.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\disconnect.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\red_x_16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\wrench.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\wand.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -184,9 +181,15 @@ ..\Resources\stepprev.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\runfwd.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\tick.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\asterisk_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -202,8 +205,8 @@ ..\Resources\time.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\runcursor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\disconnect.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -229,8 +232,8 @@ ..\Resources\save.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\runfwd.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\wrench.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\topologies\topo_tristrip.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -238,8 +241,8 @@ ..\Resources\topologies\topo_linelist_adj.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\accept.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\runcursor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\page_white_edit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -262,12 +265,12 @@ ..\resources\cog.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\page_white_link.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\topologies\topo_linestrip_adj.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\arrow_undo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\resources\rightarrow_green_16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -277,7 +280,7 @@ ..\Resources\chart_curve.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\asterisk_orange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\folder_page.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/renderdocui/Resources/folder_page.png b/renderdocui/Resources/folder_page.png new file mode 100644 index 0000000000000000000000000000000000000000..1ef6e11438f3226f88bdc457f55d677d1f2f8409 GIT binary patch literal 688 zcmV;h0#E&kP)CVGc zN?Hxg{(SJp>2>GN9JetoZ(aZH;Ije%0FdZ{S!LRVX%}YG;=d8L^N!mJkCd*SBx($jgG)S}+Le)f;q=GIn30YFNh3ZW|nh}2rL)`=3ju9K*d z<&~Gte>sT=5|RjR+}A(|O&3gS5t&*G5h0Um$c5IgEgxJl_8nzY#B+YU^|Fhvzo-^U z6fNn3(lBMcl9{Silx)4RpURdFw}1BZ?>}8S&h8fk5`hjKW@sP$LJL*otPOMf+jp$? zcC^*PiL>vkTOZln=wuc^%A^$j`TU&aa3ETVYE{(r=bgN835`stIePGw{uwD`7K9Y) z=4)VDHnkl3YL%JeLce6>Uubzae&kQ4( + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.ToolStripContainer toolStripContainer1; + System.Windows.Forms.ToolStrip toolStrip1; + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PythonShell)); + this.scriptTable = new System.Windows.Forms.TableLayoutPanel(); + this.scriptSplit = new System.Windows.Forms.SplitContainer(); + this.scriptOutput = new System.Windows.Forms.TextBox(); + this.toolStrip2 = new System.Windows.Forms.ToolStrip(); + this.openButton = new System.Windows.Forms.ToolStripButton(); + this.saveAs = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.runButton = new System.Windows.Forms.ToolStripButton(); + this.shellTable = new System.Windows.Forms.TableLayoutPanel(); + this.interactiveInput = new System.Windows.Forms.TextBox(); + this.interactiveOutput = new System.Windows.Forms.TextBox(); + this.executeCmd = new System.Windows.Forms.Button(); + this.clearCmd = new System.Windows.Forms.Button(); + this.shellMode = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.scriptMode = new System.Windows.Forms.ToolStripButton(); + this.saveDialog = new System.Windows.Forms.SaveFileDialog(); + this.openDialog = new System.Windows.Forms.OpenFileDialog(); + this.newScript = new System.Windows.Forms.ToolStripButton(); + toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); + toolStrip1 = new System.Windows.Forms.ToolStrip(); + toolStripContainer1.ContentPanel.SuspendLayout(); + toolStripContainer1.TopToolStripPanel.SuspendLayout(); + toolStripContainer1.SuspendLayout(); + this.scriptTable.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.scriptSplit)).BeginInit(); + this.scriptSplit.Panel2.SuspendLayout(); + this.scriptSplit.SuspendLayout(); + this.toolStrip2.SuspendLayout(); + this.shellTable.SuspendLayout(); + toolStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // toolStripContainer1 + // + // + // toolStripContainer1.ContentPanel + // + toolStripContainer1.ContentPanel.Controls.Add(this.scriptTable); + toolStripContainer1.ContentPanel.Controls.Add(this.shellTable); + toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(658, 425); + toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + toolStripContainer1.Location = new System.Drawing.Point(0, 0); + toolStripContainer1.Name = "toolStripContainer1"; + toolStripContainer1.Size = new System.Drawing.Size(658, 450); + toolStripContainer1.TabIndex = 0; + toolStripContainer1.Text = "toolStripContainer1"; + // + // toolStripContainer1.TopToolStripPanel + // + toolStripContainer1.TopToolStripPanel.Controls.Add(toolStrip1); + // + // scriptTable + // + this.scriptTable.ColumnCount = 1; + this.scriptTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.scriptTable.Controls.Add(this.scriptSplit, 0, 1); + this.scriptTable.Controls.Add(this.toolStrip2, 0, 0); + this.scriptTable.Location = new System.Drawing.Point(340, 40); + this.scriptTable.Name = "scriptTable"; + this.scriptTable.RowCount = 2; + this.scriptTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.scriptTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.scriptTable.Size = new System.Drawing.Size(306, 373); + this.scriptTable.TabIndex = 2; + // + // scriptSplit + // + this.scriptSplit.Dock = System.Windows.Forms.DockStyle.Fill; + this.scriptSplit.Location = new System.Drawing.Point(3, 28); + this.scriptSplit.Name = "scriptSplit"; + // + // scriptSplit.Panel2 + // + this.scriptSplit.Panel2.Controls.Add(this.scriptOutput); + this.scriptSplit.Size = new System.Drawing.Size(300, 342); + this.scriptSplit.SplitterDistance = 193; + this.scriptSplit.TabIndex = 1; + // + // scriptOutput + // + this.scriptOutput.BackColor = System.Drawing.SystemColors.Window; + this.scriptOutput.Dock = System.Windows.Forms.DockStyle.Fill; + this.scriptOutput.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.scriptOutput.Location = new System.Drawing.Point(0, 0); + this.scriptOutput.Multiline = true; + this.scriptOutput.Name = "scriptOutput"; + this.scriptOutput.ReadOnly = true; + this.scriptOutput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.scriptOutput.Size = new System.Drawing.Size(103, 342); + this.scriptOutput.TabIndex = 2; + // + // toolStrip2 + // + this.toolStrip2.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.newScript, + this.openButton, + this.saveAs, + this.toolStripSeparator2, + this.runButton}); + this.toolStrip2.Location = new System.Drawing.Point(0, 0); + this.toolStrip2.Name = "toolStrip2"; + this.toolStrip2.Size = new System.Drawing.Size(306, 25); + this.toolStrip2.TabIndex = 2; + this.toolStrip2.Text = "toolStrip2"; + // + // openButton + // + this.openButton.Image = global::renderdocui.Properties.Resources.folder_page; + this.openButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.openButton.Name = "openButton"; + this.openButton.Size = new System.Drawing.Size(53, 22); + this.openButton.Text = "Open"; + this.openButton.Click += new System.EventHandler(this.openButton_Click); + // + // saveAs + // + this.saveAs.Image = global::renderdocui.Properties.Resources.save; + this.saveAs.ImageTransparentColor = System.Drawing.Color.Magenta; + this.saveAs.Name = "saveAs"; + this.saveAs.Size = new System.Drawing.Size(66, 22); + this.saveAs.Text = "Save As"; + this.saveAs.Click += new System.EventHandler(this.saveAs_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25); + // + // runButton + // + this.runButton.Image = global::renderdocui.Properties.Resources.runfwd; + this.runButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.runButton.Name = "runButton"; + this.runButton.Size = new System.Drawing.Size(46, 22); + this.runButton.Text = "Run"; + this.runButton.Click += new System.EventHandler(this.runButton_Click); + // + // shellTable + // + this.shellTable.ColumnCount = 3; + this.shellTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.shellTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.shellTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.shellTable.Controls.Add(this.interactiveInput, 0, 0); + this.shellTable.Controls.Add(this.interactiveOutput, 0, 2); + this.shellTable.Controls.Add(this.executeCmd, 1, 0); + this.shellTable.Controls.Add(this.clearCmd, 2, 0); + this.shellTable.Location = new System.Drawing.Point(25, 40); + this.shellTable.Name = "shellTable"; + this.shellTable.RowCount = 3; + this.shellTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.shellTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.shellTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.shellTable.Size = new System.Drawing.Size(293, 373); + this.shellTable.TabIndex = 0; + // + // interactiveInput + // + this.interactiveInput.AcceptsTab = true; + this.interactiveInput.Dock = System.Windows.Forms.DockStyle.Top; + this.interactiveInput.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.interactiveInput.Location = new System.Drawing.Point(3, 3); + this.interactiveInput.MinimumSize = new System.Drawing.Size(4, 20); + this.interactiveInput.Multiline = true; + this.interactiveInput.Name = "interactiveInput"; + this.interactiveInput.Size = new System.Drawing.Size(175, 20); + this.interactiveInput.TabIndex = 0; + this.interactiveInput.WordWrap = false; + this.interactiveInput.TextChanged += new System.EventHandler(this.interactiveInput_TextChanged); + this.interactiveInput.KeyDown += new System.Windows.Forms.KeyEventHandler(this.interactiveInput_KeyDown); + this.interactiveInput.Layout += new System.Windows.Forms.LayoutEventHandler(this.interactiveInput_Layout); + // + // interactiveOutput + // + this.interactiveOutput.BackColor = System.Drawing.SystemColors.Window; + this.shellTable.SetColumnSpan(this.interactiveOutput, 3); + this.interactiveOutput.Dock = System.Windows.Forms.DockStyle.Fill; + this.interactiveOutput.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.interactiveOutput.Location = new System.Drawing.Point(3, 32); + this.interactiveOutput.Multiline = true; + this.interactiveOutput.Name = "interactiveOutput"; + this.interactiveOutput.ReadOnly = true; + this.interactiveOutput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.interactiveOutput.Size = new System.Drawing.Size(287, 338); + this.interactiveOutput.TabIndex = 1; + // + // executeCmd + // + this.executeCmd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.executeCmd.Location = new System.Drawing.Point(184, 3); + this.executeCmd.Name = "executeCmd"; + this.executeCmd.Size = new System.Drawing.Size(60, 23); + this.executeCmd.TabIndex = 2; + this.executeCmd.Text = "Execute"; + this.executeCmd.UseVisualStyleBackColor = true; + this.executeCmd.Click += new System.EventHandler(this.executeCmd_Click); + // + // clearCmd + // + this.clearCmd.Location = new System.Drawing.Point(250, 3); + this.clearCmd.Name = "clearCmd"; + this.clearCmd.Size = new System.Drawing.Size(40, 23); + this.clearCmd.TabIndex = 3; + this.clearCmd.Text = "Clear"; + this.clearCmd.UseVisualStyleBackColor = true; + this.clearCmd.Click += new System.EventHandler(this.clearCmd_Click); + // + // toolStrip1 + // + toolStrip1.Dock = System.Windows.Forms.DockStyle.None; + toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.shellMode, + this.toolStripSeparator1, + this.scriptMode}); + toolStrip1.Location = new System.Drawing.Point(3, 0); + toolStrip1.Name = "toolStrip1"; + toolStrip1.Size = new System.Drawing.Size(161, 25); + toolStrip1.TabIndex = 0; + // + // shellMode + // + this.shellMode.Checked = true; + this.shellMode.CheckState = System.Windows.Forms.CheckState.Checked; + this.shellMode.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.shellMode.Image = ((System.Drawing.Image)(resources.GetObject("shellMode.Image"))); + this.shellMode.ImageTransparentColor = System.Drawing.Color.Magenta; + this.shellMode.Name = "shellMode"; + this.shellMode.Size = new System.Drawing.Size(88, 22); + this.shellMode.Text = "Interactive shell"; + this.shellMode.Click += new System.EventHandler(this.mode_Changed); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + // + // scriptMode + // + this.scriptMode.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.scriptMode.Image = ((System.Drawing.Image)(resources.GetObject("scriptMode.Image"))); + this.scriptMode.ImageTransparentColor = System.Drawing.Color.Magenta; + this.scriptMode.Name = "scriptMode"; + this.scriptMode.Size = new System.Drawing.Size(64, 22); + this.scriptMode.Text = "Run scripts"; + this.scriptMode.Click += new System.EventHandler(this.mode_Changed); + // + // saveDialog + // + this.saveDialog.DefaultExt = "py"; + this.saveDialog.Filter = "Python Scripts (*.py)|*.py"; + this.saveDialog.Title = "Save script as .py"; + // + // openDialog + // + this.openDialog.DefaultExt = "py"; + this.openDialog.Filter = "Python Scripts (*.py)|*.py"; + this.openDialog.Title = "Open .py script"; + // + // newScript + // + this.newScript.Image = global::renderdocui.Properties.Resources.page_white_edit; + this.newScript.ImageTransparentColor = System.Drawing.Color.Magenta; + this.newScript.Name = "newScript"; + this.newScript.Size = new System.Drawing.Size(48, 22); + this.newScript.Text = "New"; + this.newScript.Click += new System.EventHandler(this.newScript_Click); + // + // PythonShell + // + this.AllowDrop = true; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(658, 450); + this.Controls.Add(toolStripContainer1); + this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Name = "PythonShell"; + this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document; + this.Text = "PythonShell"; + this.DragDrop += new System.Windows.Forms.DragEventHandler(this.shell_DragDrop); + this.DragEnter += new System.Windows.Forms.DragEventHandler(this.shell_DragEnter); + toolStripContainer1.ContentPanel.ResumeLayout(false); + toolStripContainer1.TopToolStripPanel.ResumeLayout(false); + toolStripContainer1.TopToolStripPanel.PerformLayout(); + toolStripContainer1.ResumeLayout(false); + toolStripContainer1.PerformLayout(); + this.scriptTable.ResumeLayout(false); + this.scriptTable.PerformLayout(); + this.scriptSplit.Panel2.ResumeLayout(false); + this.scriptSplit.Panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.scriptSplit)).EndInit(); + this.scriptSplit.ResumeLayout(false); + this.toolStrip2.ResumeLayout(false); + this.toolStrip2.PerformLayout(); + this.shellTable.ResumeLayout(false); + this.shellTable.PerformLayout(); + toolStrip1.ResumeLayout(false); + toolStrip1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel shellTable; + private System.Windows.Forms.SplitContainer scriptSplit; + private System.Windows.Forms.TextBox interactiveInput; + private System.Windows.Forms.TextBox interactiveOutput; + private System.Windows.Forms.ToolStripButton shellMode; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripButton scriptMode; + private System.Windows.Forms.Button executeCmd; + private System.Windows.Forms.TextBox scriptOutput; + private System.Windows.Forms.Button clearCmd; + private System.Windows.Forms.TableLayoutPanel scriptTable; + private System.Windows.Forms.ToolStrip toolStrip2; + private System.Windows.Forms.ToolStripButton openButton; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripButton runButton; + private System.Windows.Forms.ToolStripButton saveAs; + private System.Windows.Forms.SaveFileDialog saveDialog; + private System.Windows.Forms.OpenFileDialog openDialog; + private System.Windows.Forms.ToolStripButton newScript; + + + } +} \ No newline at end of file diff --git a/renderdocui/Windows/Dialogs/PythonShell.cs b/renderdocui/Windows/Dialogs/PythonShell.cs new file mode 100644 index 000000000..811a136fb --- /dev/null +++ b/renderdocui/Windows/Dialogs/PythonShell.cs @@ -0,0 +1,438 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.IO; +using System.Text; +using System.Windows.Forms; +using WeifenLuo.WinFormsUI.Docking; +using renderdocui.Code; +using renderdoc; +using IronPython.Hosting; +using Microsoft.Scripting.Hosting; +using IronPython.Runtime.Exceptions; +using System.Threading; + +namespace renderdocui.Windows.Dialogs +{ + public partial class PythonShell : DockContent + { + Core m_Core = null; + + private ScriptEngine pythonengine = null; + private ScriptScope shellscope = null; + + ScintillaNET.Scintilla scriptEditor = null; + + public PythonShell(Core core) + { + InitializeComponent(); + + shellTable.Dock = DockStyle.Fill; + scriptTable.Dock = DockStyle.Fill; + + scriptEditor = new ScintillaNET.Scintilla(); + ((System.ComponentModel.ISupportInitialize)(scriptEditor)).BeginInit(); + + scriptEditor.Dock = System.Windows.Forms.DockStyle.Fill; + scriptEditor.Location = new System.Drawing.Point(3, 3); + scriptEditor.Name = "scripteditor"; + scriptEditor.Font = new Font("Consolas", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0); + + scriptEditor.Margins.Left = 4; + scriptEditor.Margins.Margin0.Width = 30; + scriptEditor.Margins.Margin1.Width = 0; + scriptEditor.Margins.Margin2.Width = 16; + + scriptEditor.Markers[0].BackColor = System.Drawing.Color.LightCoral; + + scriptEditor.ConfigurationManager.Language = "python"; + + ((System.ComponentModel.ISupportInitialize)(scriptEditor)).EndInit(); + + scriptEditor.KeyDown += new KeyEventHandler(scriptEditor_KeyDown); + + newScript.PerformClick(); + + scriptEditor.Scrolling.HorizontalWidth = 1; + + const uint SCI_SETSCROLLWIDTHTRACKING = 2516; + scriptEditor.NativeInterface.SendMessageDirect(SCI_SETSCROLLWIDTHTRACKING, true); + + scriptSplit.Panel1.Controls.Add(scriptEditor); + + m_Core = core; + + pythonengine = NewEngine(); + + mode_Changed(shellMode, null); + + clearCmd_Click(null, null); + } + + void scriptEditor_KeyDown(object sender, KeyEventArgs e) + { + if (e.Control) + { + if (e.KeyCode == Keys.O) + { + openButton.PerformClick(); + e.Handled = true; + e.SuppressKeyPress = true; + } + if (e.KeyCode == Keys.S) + { + saveAs.PerformClick(); + e.Handled = true; + e.SuppressKeyPress = true; + } + } + } + + private ScriptEngine NewEngine() + { + var engine = Python.CreateEngine(); + + List searches = new List(engine.GetSearchPaths()); + + searches.Add(Directory.GetCurrentDirectory()); + + engine.SetSearchPaths(searches); + + return engine; + } + + private ScriptScope NewScope(ScriptEngine engine) + { + var scope = engine.CreateScope(); + + scope.SetVariable("renderdoc", m_Core); + + return scope; + } + + private MemoryStream stdout = null; + private StreamWriter stdoutwriter = null; + private StreamReader stdoutreader = null; + + private string Execute(ScriptEngine engine, ScriptScope scope, string script) + { + stdout = new MemoryStream(); + stdoutwriter = new StreamWriter(stdout); + stdoutreader = new StreamReader(stdout); + + engine.Runtime.IO.SetOutput(stdout, stdoutwriter); + + try + { + dynamic ret = engine.CreateScriptSourceFromString(script).Execute(scope); + if (ret != null) + { + stdoutwriter.Write(ret.ToString() + Environment.NewLine); + stdoutwriter.Flush(); + } + } + catch (Exception ex) + { + // IronPython throws so many exceptions, we don't want to kill the application + // so we just swallow Exception to cover all the bases + string exstr = engine.GetService().FormatException(ex); + stdoutwriter.Write(exstr); + stdoutwriter.Write(Environment.NewLine); + stdoutwriter.Flush(); + } + + stdout.Seek(0, SeekOrigin.Begin); + + string output = stdoutreader.ReadToEnd(); + + stdoutreader.Dispose(); + + stdout = null; + stdoutreader = null; + stdoutwriter = null; + + return output; + } + + private void mode_Changed(object sender, EventArgs e) + { + if (sender == shellMode) + { + shellMode.Checked = true; + scriptMode.Checked = false; + scriptTable.Visible = false; + shellTable.Visible = true; + + Text = "Interactive Python Shell"; + + interactiveInput_TextChanged(null, null); + } + else if (sender == scriptMode) + { + scriptMode.Checked = true; + shellMode.Checked = false; + shellTable.Visible = false; + scriptTable.Visible = true; + + scriptOutput.Text = ""; + + Text = "Python Script Execute"; + } + } + + private List history = new List(); + int historyidx = -1; + string workingtext = ""; + + private void interactiveInput_KeyDown(object sender, KeyEventArgs e) + { + if (!e.Shift && e.KeyCode == Keys.Return) + { + executeCmd_Click(null, null); + e.Handled = true; + e.SuppressKeyPress = true; + } + + bool moved = false; + + if (e.KeyCode == Keys.Down && historyidx > -1) + { + historyidx--; + + moved = true; + } + if (e.KeyCode == Keys.Up && historyidx + 1 < history.Count) + { + if (historyidx == -1) + workingtext = interactiveInput.Text; + + historyidx++; + + moved = true; + } + + if (moved) + { + if (historyidx == -1) + interactiveInput.Text = workingtext; + else + interactiveInput.Text = history[historyidx]; + + interactiveInput.Select(interactiveInput.Text.Length, 0); + } + } + + private void interactiveInput_TextChanged(object sender, EventArgs e) + { + using (var g = interactiveInput.CreateGraphics()) + { + SizeF MessageSize = g.MeasureString(interactiveInput.Text + "a", interactiveInput.Font, + interactiveInput.Width, new StringFormat(0)); + + const int maxHeight = 100; + + if (MessageSize.Height <= maxHeight) + { + interactiveInput.Height = 20 + (int)MessageSize.Height; + interactiveInput.ScrollBars = ScrollBars.None; + } + else + { + interactiveInput.Height = 20 + maxHeight; + interactiveInput.ScrollBars = ScrollBars.Vertical; + } + } + } + + private void interactiveInput_Layout(object sender, LayoutEventArgs e) + { + interactiveInput_TextChanged(null, null); + } + + private void executeCmd_Click(object sender, EventArgs e) + { + var nl = Environment.NewLine; + interactiveOutput.AppendText(">> " + interactiveInput.Text.Trim().Replace(nl, nl + ">> ") + nl); + interactiveOutput.AppendText(Execute(pythonengine, shellscope, interactiveInput.Text)); + + history.Insert(0, interactiveInput.Text); + historyidx = -1; + workingtext = ""; + + interactiveInput.Text = ""; + } + + private void clearCmd_Click(object sender, EventArgs e) + { + interactiveOutput.Text = String.Format("RenderDoc Python console, powered by IronPython {0}{1}" + + "The 'renderdoc' object is the Core class instance.{1}", IronPython.CurrentVersion.AssemblyFileVersion, Environment.NewLine); + + shellscope = NewScope(pythonengine); + } + + private static PythonShell me = null; + + private static TracebackDelegate PythonTrace(TraceBackFrame frame, string result, object payload) + { + if(me != null) + me.TraceCallback(frame, result, payload); + return PythonTrace; + } + + private void TraceCallback(TraceBackFrame frame, string result, object payload) + { + System.Diagnostics.Trace.WriteLine("On line " + frame.f_lineno.ToString()); + + int lineNum = (int)frame.f_lineno - 1; + + BeginInvoke(new Action(() => { SetLineNumber(lineNum); })); + + stdoutwriter.Flush(); + stdout.Seek(0, SeekOrigin.Begin); + string output = stdoutreader.ReadToEnd(); + stdout.Seek(0, SeekOrigin.Begin); + stdout.SetLength(0); + + this.BeginInvoke(new Action(() => + { + scriptOutput.Text += output; + })); + } + + private void SetLineNumber(int lineNum) + { + for (int i = 0; i < me.scriptEditor.Lines.Count; i++) + { + me.scriptEditor.Lines[i].DeleteMarker(0); + } + + if (lineNum >= 0 && lineNum < me.scriptEditor.Lines.Count) + { + me.scriptEditor.Lines[lineNum].AddMarker(0); + } + } + + private void EnableButtons(bool enable) + { + shellMode.Enabled = scriptMode.Enabled = + newScript.Enabled = openButton.Enabled = saveAs.Enabled = + runButton.Enabled = enable; + } + + private void runButton_Click(object sender, EventArgs e) + { + var scriptscope = NewScope(pythonengine); + + me = this; + + var script = scriptEditor.Text; + + scriptOutput.Text = ""; + + EnableButtons(false); + + Thread th = Helpers.NewThread(new ThreadStart(() => + { + pythonengine.SetTrace(PythonTrace); + + // ignore output, the trace handler above will print output + string output = Execute(pythonengine, scriptscope, script); + + pythonengine.SetTrace(null); + + this.BeginInvoke(new Action(() => + { + scriptOutput.Text += output; + + SetLineNumber(-1); + + EnableButtons(true); + })); + })); + + th.Start(); + } + + private string ValidData(IDataObject d) + { + var fmts = new List(d.GetFormats()); + + if (fmts.Contains("FileName")) + { + var data = d.GetData("FileName") as Array; + + if (data != null && data.Length == 1 && data.GetValue(0) is string) + { + var filename = (string)data.GetValue(0); + + try + { + if (File.Exists(filename) && Path.GetExtension(filename).ToUpperInvariant() == ".PY") + return Path.GetFullPath(filename); + } + catch (ArgumentException) + { + // invalid path etc + } + } + } + + return ""; + } + + private void shell_DragEnter(object sender, DragEventArgs e) + { + if (ValidData(e.Data).Length > 0) + e.Effect = DragDropEffects.Copy; + else + e.Effect = DragDropEffects.None; + } + + private void shell_DragDrop(object sender, DragEventArgs e) + { + string fn = ValidData(e.Data); + if (fn.Length > 0) + { + scriptEditor.Text = File.ReadAllText(fn); + + mode_Changed(scriptMode, null); + } + } + + private void openButton_Click(object sender, EventArgs e) + { + DialogResult res = openDialog.ShowDialog(); + + if (res == DialogResult.OK) + { + scriptEditor.Text = File.ReadAllText(openDialog.FileName); + } + } + + private void saveAs_Click(object sender, EventArgs e) + { + DialogResult res = saveDialog.ShowDialog(); + + if (res == DialogResult.OK) + { + File.WriteAllText(saveDialog.FileName, scriptEditor.Text); + } + } + + private void newScript_Click(object sender, EventArgs e) + { + scriptEditor.Text = String.Format("# RenderDoc Python scripts, powered by IronPython {0}\n" + + "# The 'renderdoc' object is the Core class instance.\n\n", IronPython.CurrentVersion.AssemblyFileVersion); + + if (File.Exists("pythonlibs.dll")) + scriptEditor.Text += "import clr\nclr.AddReference(\"pythonlibs\")\n\n"; + else + scriptEditor.Text += "#import clr\n#clr.AddReference(\"pythonlibs\")\n\n"; + + scriptEditor.Text = scriptEditor.Text.Replace("\n", Environment.NewLine); + } + } +} diff --git a/renderdocui/Windows/Dialogs/PythonShell.resx b/renderdocui/Windows/Dialogs/PythonShell.resx new file mode 100644 index 000000000..f58f6b829 --- /dev/null +++ b/renderdocui/Windows/Dialogs/PythonShell.resx @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + + 116, 17 + + + False + + + 17, 17 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + 213, 16 + + + 318, 16 + + \ No newline at end of file diff --git a/renderdocui/Windows/MainWindow.Designer.cs b/renderdocui/Windows/MainWindow.Designer.cs index 07a4caca8..b3f5994c4 100644 --- a/renderdocui/Windows/MainWindow.Designer.cs +++ b/renderdocui/Windows/MainWindow.Designer.cs @@ -110,6 +110,7 @@ this.statusProgress = new System.Windows.Forms.ToolStripProgressBar(); this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel(); this.saveDialog = new System.Windows.Forms.SaveFileDialog(); + this.pythonShellToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.toolStripContainer1.BottomToolStripPanel.SuspendLayout(); this.toolStripContainer1.ContentPanel.SuspendLayout(); @@ -269,6 +270,7 @@ this.toolStripMenuItem1, this.saveLayoutToolStripMenuItem, this.toolStripSeparator1, + this.pythonShellToolStripMenuItem, this.eventViewerToolStripMenuItem, this.textureToolStripMenuItem, this.D3D11PipelineStateToolStripMenuItem, @@ -298,7 +300,7 @@ // layoutSaveDefault // this.layoutSaveDefault.Name = "layoutSaveDefault"; - this.layoutSaveDefault.Size = new System.Drawing.Size(145, 22); + this.layoutSaveDefault.Size = new System.Drawing.Size(152, 22); this.layoutSaveDefault.Tag = "0"; this.layoutSaveDefault.Text = "&Default Layout"; this.layoutSaveDefault.Click += new System.EventHandler(this.saveLayout_Click); @@ -306,12 +308,12 @@ // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(142, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6); // // layoutSave1 // this.layoutSave1.Name = "layoutSave1"; - this.layoutSave1.Size = new System.Drawing.Size(145, 22); + this.layoutSave1.Size = new System.Drawing.Size(152, 22); this.layoutSave1.Tag = "1"; this.layoutSave1.Text = "Layout &1"; this.layoutSave1.Click += new System.EventHandler(this.saveLayout_Click); @@ -319,7 +321,7 @@ // layoutSave2 // this.layoutSave2.Name = "layoutSave2"; - this.layoutSave2.Size = new System.Drawing.Size(145, 22); + this.layoutSave2.Size = new System.Drawing.Size(152, 22); this.layoutSave2.Tag = "2"; this.layoutSave2.Text = "Layout &2"; this.layoutSave2.Click += new System.EventHandler(this.saveLayout_Click); @@ -327,7 +329,7 @@ // layoutSave3 // this.layoutSave3.Name = "layoutSave3"; - this.layoutSave3.Size = new System.Drawing.Size(145, 22); + this.layoutSave3.Size = new System.Drawing.Size(152, 22); this.layoutSave3.Tag = "3"; this.layoutSave3.Text = "Layout &3"; this.layoutSave3.Click += new System.EventHandler(this.saveLayout_Click); @@ -335,7 +337,7 @@ // layoutSave4 // this.layoutSave4.Name = "layoutSave4"; - this.layoutSave4.Size = new System.Drawing.Size(145, 22); + this.layoutSave4.Size = new System.Drawing.Size(152, 22); this.layoutSave4.Tag = "4"; this.layoutSave4.Text = "Layout &4"; this.layoutSave4.Click += new System.EventHandler(this.saveLayout_Click); @@ -343,7 +345,7 @@ // layoutSave5 // this.layoutSave5.Name = "layoutSave5"; - this.layoutSave5.Size = new System.Drawing.Size(145, 22); + this.layoutSave5.Size = new System.Drawing.Size(152, 22); this.layoutSave5.Tag = "5"; this.layoutSave5.Text = "Layout &5"; this.layoutSave5.Click += new System.EventHandler(this.saveLayout_Click); @@ -351,7 +353,7 @@ // layoutSave6 // this.layoutSave6.Name = "layoutSave6"; - this.layoutSave6.Size = new System.Drawing.Size(145, 22); + this.layoutSave6.Size = new System.Drawing.Size(152, 22); this.layoutSave6.Tag = "6"; this.layoutSave6.Text = "Layout &6"; this.layoutSave6.Click += new System.EventHandler(this.saveLayout_Click); @@ -545,14 +547,14 @@ this.viewDocsToolStripMenuItem.Name = "viewDocsToolStripMenuItem"; this.viewDocsToolStripMenuItem.RightToLeft = System.Windows.Forms.RightToLeft.No; this.viewDocsToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F1; - this.viewDocsToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.viewDocsToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.viewDocsToolStripMenuItem.Text = "View &Documentation"; this.viewDocsToolStripMenuItem.Click += new System.EventHandler(this.viewDocsToolStripMenuItem_Click); // // viewLogFileToolStripMenuItem // this.viewLogFileToolStripMenuItem.Name = "viewLogFileToolStripMenuItem"; - this.viewLogFileToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.viewLogFileToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.viewLogFileToolStripMenuItem.Text = "View Diagnostic &Log File"; this.viewLogFileToolStripMenuItem.Click += new System.EventHandler(this.viewLogFileToolStripMenuItem_Click); // @@ -560,40 +562,40 @@ // this.sendErrorReportToolStripMenuItem.Name = "sendErrorReportToolStripMenuItem"; this.sendErrorReportToolStripMenuItem.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.sendErrorReportToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.sendErrorReportToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.sendErrorReportToolStripMenuItem.Text = "Send &Error Report"; this.sendErrorReportToolStripMenuItem.Click += new System.EventHandler(this.sendErrorReportToolStripMenuItem_Click); // // toolStripSeparator9 // this.toolStripSeparator9.Name = "toolStripSeparator9"; - this.toolStripSeparator9.Size = new System.Drawing.Size(187, 6); + this.toolStripSeparator9.Size = new System.Drawing.Size(189, 6); // // updateToolStripMenuItem // this.updateToolStripMenuItem.Enabled = false; this.updateToolStripMenuItem.Image = global::renderdocui.Properties.Resources.hourglass; this.updateToolStripMenuItem.Name = "updateToolStripMenuItem"; - this.updateToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.updateToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.updateToolStripMenuItem.Text = "No update available"; this.updateToolStripMenuItem.Click += new System.EventHandler(this.updateToolStripMenuItem_Click); // // toolStripSeparator8 // this.toolStripSeparator8.Name = "toolStripSeparator8"; - this.toolStripSeparator8.Size = new System.Drawing.Size(187, 6); + this.toolStripSeparator8.Size = new System.Drawing.Size(189, 6); // // sourceOnGithubToolStripMenuItem // this.sourceOnGithubToolStripMenuItem.Name = "sourceOnGithubToolStripMenuItem"; - this.sourceOnGithubToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.sourceOnGithubToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.sourceOnGithubToolStripMenuItem.Text = "Source on github"; this.sourceOnGithubToolStripMenuItem.Click += new System.EventHandler(this.sourceOnGithubToolStripMenuItem_Click); // // nightlybuildsToolStripMenuItem // this.nightlybuildsToolStripMenuItem.Name = "nightlybuildsToolStripMenuItem"; - this.nightlybuildsToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.nightlybuildsToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.nightlybuildsToolStripMenuItem.Text = "Build/Release downloads"; this.nightlybuildsToolStripMenuItem.Click += new System.EventHandler(this.nightlybuildsToolStripMenuItem_Click); // @@ -601,7 +603,7 @@ // this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; this.aboutToolStripMenuItem.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(192, 22); this.aboutToolStripMenuItem.Text = "&About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // @@ -725,6 +727,13 @@ this.saveDialog.Filter = "Log Files (*.rdc)|*.rdc"; this.saveDialog.Title = "Save Log As"; // + // pythonShellToolStripMenuItem + // + this.pythonShellToolStripMenuItem.Name = "pythonShellToolStripMenuItem"; + this.pythonShellToolStripMenuItem.Size = new System.Drawing.Size(155, 22); + this.pythonShellToolStripMenuItem.Text = "P&ython Shell"; + this.pythonShellToolStripMenuItem.Click += new System.EventHandler(this.pythonShellToolStripMenuItem_Click); + // // MainWindow // this.AllowDrop = true; @@ -826,6 +835,7 @@ private System.Windows.Forms.ToolStripMenuItem viewLogFileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem nightlybuildsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem sourceOnGithubToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem pythonShellToolStripMenuItem; } } \ No newline at end of file diff --git a/renderdocui/Windows/MainWindow.cs b/renderdocui/Windows/MainWindow.cs index 4da57844f..60e2a7706 100644 --- a/renderdocui/Windows/MainWindow.cs +++ b/renderdocui/Windows/MainWindow.cs @@ -404,6 +404,10 @@ namespace renderdocui.Windows return m_Core.GetDebugMessages(); else if (IsPersist(persistString, typeof(TimelineBar).ToString())) return m_Core.GetTimelineBar(); + else if (IsPersist(persistString, typeof(Dialogs.PythonShell).ToString())) + { + return new Dialogs.PythonShell(m_Core); + } else if (IsPersist(persistString, typeof(Dialogs.CaptureDialog).ToString())) { if (m_Core.CaptureDialog == null) @@ -1359,6 +1363,11 @@ namespace renderdocui.Windows t.Show(dockPanel); } + private void pythonShellToolStripMenuItem_Click(object sender, EventArgs e) + { + (new Dialogs.PythonShell(m_Core)).Show(dockPanel); + } + private void PipelineStateToolStripMenuItem_Click(object sender, EventArgs e) { m_Core.GetPipelineStateViewer().Show(dockPanel); diff --git a/renderdocui/renderdocui.csproj b/renderdocui/renderdocui.csproj index 661a4928d..41d3ec89b 100644 --- a/renderdocui/renderdocui.csproj +++ b/renderdocui/renderdocui.csproj @@ -224,6 +224,12 @@ ColumnSelector.cs + + Form + + + PythonShell.cs + Form @@ -353,6 +359,9 @@ ColumnSelector.cs + + PythonShell.cs + RemoteHostSelect.cs @@ -475,6 +484,7 @@ +