-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split expression and python scripting
Fixes #732
- Loading branch information
Showing
33 changed files
with
1,738 additions
and
1,603 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
Bonsai.Scripting.Expressions.Design/Bonsai.Scripting.Expressions.Design.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Title>Bonsai - Expression Scripting Design Library</Title> | ||
<Description>Bonsai Design Library containing editor classes for expression scripting in Bonsai.</Description> | ||
<PackageTags>Bonsai Rx Scripting Expressions Design</PackageTags> | ||
<TargetFramework>net5.0-windows10.0.19041</TargetFramework> | ||
<Version>3.0.0</Version> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="unofficial.ScintillaNET" Version="3.8.7" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Bonsai.Scripting.Expressions\Bonsai.Scripting.Expressions.csproj" /> | ||
</ItemGroup> | ||
</Project> |
66 changes: 33 additions & 33 deletions
66
Bonsai.Scripting/ExpressionScriptEditor.cs → ...ressions.Design/ExpressionScriptEditor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
using System; | ||
using System.Drawing.Design; | ||
using System.ComponentModel; | ||
using System.Windows.Forms.Design; | ||
using System.Windows.Forms; | ||
|
||
namespace Bonsai.Scripting | ||
{ | ||
public class ExpressionScriptEditor : UITypeEditor | ||
{ | ||
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) | ||
{ | ||
return UITypeEditorEditStyle.Modal; | ||
} | ||
|
||
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) | ||
{ | ||
var editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); | ||
if (editorService != null) | ||
{ | ||
var script = value as string; | ||
var editorDialog = new ExpressionScriptEditorDialog(); | ||
editorDialog.Script = script; | ||
if (editorService.ShowDialog(editorDialog) == DialogResult.OK) | ||
{ | ||
return editorDialog.Script; | ||
} | ||
} | ||
|
||
return base.EditValue(context, provider, value); | ||
} | ||
} | ||
} | ||
using System; | ||
using System.Drawing.Design; | ||
using System.ComponentModel; | ||
using System.Windows.Forms.Design; | ||
using System.Windows.Forms; | ||
|
||
namespace Bonsai.Scripting.Expressions.Design | ||
{ | ||
public class ExpressionScriptEditor : UITypeEditor | ||
{ | ||
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) | ||
{ | ||
return UITypeEditorEditStyle.Modal; | ||
} | ||
|
||
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) | ||
{ | ||
var editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); | ||
if (editorService != null) | ||
{ | ||
var script = value as string; | ||
var editorDialog = new ExpressionScriptEditorDialog(); | ||
editorDialog.Script = script; | ||
if (editorService.ShowDialog(editorDialog) == DialogResult.OK) | ||
{ | ||
return editorDialog.Script; | ||
} | ||
} | ||
|
||
return base.EditValue(context, provider, value); | ||
} | ||
} | ||
} |
190 changes: 95 additions & 95 deletions
190
.../ExpressionScriptEditorDialog.Designer.cs → .../ExpressionScriptEditorDialog.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.