From 7b38511c8c194fd7195db16dcedc66844e526058 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Thu, 13 Jul 2023 13:18:09 +0200 Subject: [PATCH] fixed typo in build.yaml, added build badge to readme.md, fixed build config for utilities project, some formatting --- .github/workflows/build.yml | 2 +- .gitignore | 6 + .../Migrations/Configuration.cs | 1 + .../Models/DatabaseContext.cs | 7 -- PythonInterface/Program.cs | 106 ------------------ README.md | 1 + Utilities/ArtefactPath.cs | 2 + Utilities/Utilities.csproj | 51 ++++++--- VisFroG.sln | 16 +-- 9 files changed, 55 insertions(+), 137 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3154786..4dc32f9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,4 +26,4 @@ jobs: - run: nuget restore VisFroG.sln - name: Build app for release - run: msbuild VisFroG.sln -t:rebuild -verbosity:diag -property:Configuration=Releas + run: msbuild VisFroG.sln -t:rebuild -verbosity:diag -property:Configuration=Release diff --git a/.gitignore b/.gitignore index 8a30d25..39ab0f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ + + +*.db + + +## ------------------------------------------------------------------------ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## diff --git a/EntityFrameworkDatabase/Migrations/Configuration.cs b/EntityFrameworkDatabase/Migrations/Configuration.cs index daec494..10b38b0 100644 --- a/EntityFrameworkDatabase/Migrations/Configuration.cs +++ b/EntityFrameworkDatabase/Migrations/Configuration.cs @@ -15,6 +15,7 @@ internal sealed class Configuration : DbMigrationsConfiguration But App.config can not be used by Grasshopper component /// // DataDirectory is defined in CTOR of Configuration @@ -33,11 +32,5 @@ public class DatabaseContext : DbContext public System.Data.Entity.DbSet Entites { get; set; } - - } - - - } - diff --git a/PythonInterface/Program.cs b/PythonInterface/Program.cs index edf0f60..7b8fa18 100644 --- a/PythonInterface/Program.cs +++ b/PythonInterface/Program.cs @@ -21,43 +21,6 @@ public class Script { public string ID { get; set; } - /* - - from bokeh.layouts import column - from bokeh.models import ColumnDataSource, CustomJS, Slider - from bokeh.plotting import Figure, output_file, show - - output_file(""js_on_change.html"") - - x = [x*0.005 for x in range(0, 200)] - y = x - - source = ColumnDataSource(data=dict(x=x, y=y)) - - plot = Figure(width=400, height=400) - plot.line('x', 'y', source=source, line_width=3, line_alpha=0.6) - - callback = CustomJS(args=dict(source=source), code="""""" - console.log('JS handler called ...'); - const data = source.data; - const f = cb_obj.value - const x = data['x'] - const y = data['y'] - for (let i = 0; i < x.length; i++) { - y[i] = Math.pow(x[i], f) - } - source.change.emit(); - """""") - - slider = Slider(start=0.1, end=4, value=1, step=.1, title=""power"") - slider.js_on_change('value', callback) - - layout = column(slider, plot) - - show(layout) - - */ - private string _source = @"# #----------------------------------------------------------------- @@ -154,12 +117,6 @@ public Script() var pathToVirtualEnv = @"C:\ProgramData\Anaconda3"; Console.WriteLine(pathToVirtualEnv); - //var path = Environment.GetEnvironmentVariable("PATH").TrimEnd(';'); - //path = string.IsNullOrEmpty(path) ? pathToVirtualEnv : path + ";" + pathToVirtualEnv; - //Environment.SetEnvironmentVariable("PATH", path, EnvironmentVariableTarget.Process); - //Environment.SetEnvironmentVariable("PATH", pathToVirtualEnv, EnvironmentVariableTarget.Process); - //Environment.SetEnvironmentVariable("PYTHONHOME", pathToVirtualEnv, EnvironmentVariableTarget.Process); - //Environment.SetEnvironmentVariable("PYTHONPATH", python_path, EnvironmentVariableTarget.Process); string python_path = $"{pathToVirtualEnv}\\Lib\\site-packages;{pathToVirtualEnv}\\Lib;{pathToVirtualEnv}\\DLLs"; PythonEngine.PythonHome = pathToVirtualEnv; @@ -174,69 +131,6 @@ public Script() PythonEngine.Initialize(); PythonEngine.BeginAllowThreads(); - - /* - Runtime.PythonDLL = @"C:\Users\\AppData\Local\Programs\Python\Python310\python310.dll"; - var pathToVirtualEnv = @"path\to\env"; - - // be sure not to overwrite your existing "PATH" environmental variable. - var path = Environment.GetEnvironmentVariable("PATH").TrimEnd(';'); - path = string.IsNullOrEmpty(path) ? pathToVirtualEnv : path + ";" + pathToVirtualEnv; - Environment.SetEnvironmentVariable("PATH", path, EnvironmentVariableTarget.Process); - Environment.SetEnvironmentVariable("PATH", pathToVirtualEnv, EnvironmentVariableTarget.Process); - // Environment.SetEnvironmentVariable("PYTHONHOME", pathToVirtualEnv, EnvironmentVariableTarget.Process); - Environment.SetEnvironmentVariable("PYTHONPATH", $"{pathToVirtualEnv}\\Lib\\site-packages;{pathToVirtualEnv}\\Lib", EnvironmentVariableTarget.Process); - - PythonEngine.Initialize(); - - PythonEngine.PythonHome = pathToVirtualEnv; - PythonEngine.PythonPath = Environment.GetEnvironmentVariable("PYTHONPATH", EnvironmentVariableTarget.Process); - - - - string pathToVirtualEnv = "/path/to/venv/"; - - Environment.SetEnvironmentVariable("PATH", pathToVirtualEnv, EnvironmentVariableTarget.Process); - Environment.SetEnvironmentVariable("PYTHONHOME", pathToVirtualEnv, EnvironmentVariableTarget.Process); - Environment.SetEnvironmentVariable("PYTHONPATH", $"{pathToVirtualEnv}\\Lib\\site-packages;{pathToVirtualEnv}\\Lib", EnvironmentVariableTarget.Process); - - - PythonEngine.PythonHome = pathToVirtualEnv; - PythonEngine.PythonPath = PythonEngine.PythonPath + ";" + Environment.GetEnvironmentVariable("PYTHONPATH", EnvironmentVariableTarget.Process); - */ - - - //var searchPaths = this._engine.GetSearchPaths(); - //foreach (var s in searchPaths) - // Console.WriteLine(s); - - //ICollection searchPaths = new List(); - - /* - // This will get the current WORKING directory (i.e. \bin\Debug) - string workingDirectory = Environment.CurrentDirectory; - // or: Directory.GetCurrentDirectory() gives the same result - // This will get the current PROJECT bin directory (ie ../bin/) - string projectDirectory = Directory.GetParent(workingDirectory).Parent.FullName; - // This will get the current PROJECT directory - string projectDirectory = Directory.GetParent(workingDirectory).Parent.Parent.FullName - */ - /* - string workingDirectory = Environment.CurrentDirectory; - string basedir = Directory.GetParent(workingDirectory).Parent.FullName; // AppDomain.CurrentDomain.BaseDirectory; - string libpath = Path.Combine(basedir, "lib"); - //searchPaths.Add(libpath); - //Console.WriteLine(libpath); - - - - //searchPaths.Add(@"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\Lib"); - //searchPaths.Add(@"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\Lib\site-packages"); - searchPaths.Add(@"C:\Program Files\Python34\Lib"); - searchPaths.Add(@"C:\Program Files\Python34\Lib\site-packages"); - this._engine.SetSearchPaths(searchPaths); - */ - } public void Execute() diff --git a/README.md b/README.md index fdfb02c..f4d51d2 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ +[![Build](https://github.com/IntCDC/VisFroG/actions/workflows/build.yml/badge.svg)](https://github.com/IntCDC/VisFroG/actions/workflows/build.yml) [![Github Repo Badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)](https://github.com/IntCDC/VisFroG) [![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) [![GitHub License](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.tik.uni-stuttgart.de/IntCDC-RDM-RSE/VisFroG/blob/main/LICENSE) diff --git a/Utilities/ArtefactPath.cs b/Utilities/ArtefactPath.cs index 99af1a2..5d49946 100644 --- a/Utilities/ArtefactPath.cs +++ b/Utilities/ArtefactPath.cs @@ -12,11 +12,13 @@ public class Artefacts static public string Path() { + // Returns the path of the VisFroG plugin, e.g. C:\Users\...\AppData\Roaming\Grasshopper\Libraries\VisFrog return System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); // System.AppContext.BaseDirectory; } static public string FileName(string body, string extension) { + // Append unified prefix const string prefix = "visfrog_"; return prefix + body + "." + extension; ; } diff --git a/Utilities/Utilities.csproj b/Utilities/Utilities.csproj index f305864..c2d1ab0 100644 --- a/Utilities/Utilities.csproj +++ b/Utilities/Utilities.csproj @@ -14,29 +14,50 @@ true false false - $(SolutionDir)bin + $(SolutionDir)bin - - AnyCPU + + + + true - full - false - bin\Debug\ + bin\x86\Debug\ DEBUG;TRACE + full + x86 + 7.3 prompt - 4 + true - - AnyCPU - pdbonly - true - bin\Release\ + + bin\x86\Release\ TRACE + true + pdbonly + x86 + 7.3 prompt - 4 + true - - + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + 7.3 + prompt + true + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + 7.3 + prompt + true diff --git a/VisFroG.sln b/VisFroG.sln index 8a13b68..5e68d6d 100644 --- a/VisFroG.sln +++ b/VisFroG.sln @@ -177,16 +177,16 @@ Global {AC9A69F3-1273-46CD-BDD2-14BC512C8413}.Release|x86.Build.0 = Release|x86 {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Debug|x64.ActiveCfg = Debug|Any CPU - {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Debug|x64.Build.0 = Debug|Any CPU - {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Debug|x86.ActiveCfg = Debug|Any CPU - {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Debug|x86.Build.0 = Debug|Any CPU + {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Debug|x64.ActiveCfg = Debug|x64 + {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Debug|x64.Build.0 = Debug|x64 + {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Debug|x86.ActiveCfg = Debug|x86 + {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Debug|x86.Build.0 = Debug|x86 {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Release|Any CPU.ActiveCfg = Release|Any CPU {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Release|Any CPU.Build.0 = Release|Any CPU - {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Release|x64.ActiveCfg = Release|Any CPU - {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Release|x64.Build.0 = Release|Any CPU - {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Release|x86.ActiveCfg = Release|Any CPU - {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Release|x86.Build.0 = Release|Any CPU + {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Release|x64.ActiveCfg = Release|x64 + {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Release|x64.Build.0 = Release|x64 + {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Release|x86.ActiveCfg = Release|x86 + {B4B4910D-4B22-4F93-91AD-4B3938335B01}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE