Skip to content

Commit

Permalink
Split expression and python scripting
Browse files Browse the repository at this point in the history
Fixes #732
  • Loading branch information
glopesdev committed Oct 24, 2021
1 parent 7826bfb commit e26d4ae
Show file tree
Hide file tree
Showing 33 changed files with 1,738 additions and 1,603 deletions.
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>
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);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e26d4ae

Please sign in to comment.