This repository was archived by the owner on Feb 4, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +16
-14
lines changed
test/java/org/scijava/jupyter/sandbox Expand file tree Collapse file tree 6 files changed +16
-14
lines changed Original file line number Diff line number Diff line change 34
34
import org .scijava .jupyter .utils .JupyterUtil ;
35
35
import org .scijava .jupyter .utils .ProcessUtil ;
36
36
import org .scijava .jupyter .utils .SystemUtil ;
37
+ import org .scijava .log .LogLevel ;
37
38
import org .scijava .log .LogService ;
38
39
import org .scijava .plugin .Menu ;
39
40
import org .scijava .plugin .Parameter ;
@@ -157,7 +158,7 @@ public static void main(String... args) {
157
158
Context context = new Context ();
158
159
159
160
LogService log = context .service (LogService .class );
160
- log .setLevel (LogService .INFO );
161
+ log .setLevel (LogLevel .INFO );
161
162
162
163
JupyterService jupyter = context .service (JupyterService .class );
163
164
jupyter .installKernel (args );
Original file line number Diff line number Diff line change 34
34
import org .scijava .jupyter .kernel .evaluator .ScijavaEvaluator ;
35
35
import org .scijava .jupyter .kernel .handler .ScijavaKernelInfoHandler ;
36
36
import org .scijava .jupyter .service .JupyterService ;
37
+ import org .scijava .log .LogLevel ;
37
38
import org .scijava .log .LogService ;
38
39
import org .scijava .plugin .Parameter ;
39
40
import org .scijava .plugin .PluginInfo ;
@@ -84,19 +85,19 @@ public KernelHandler<Message> getKernelInfoHandler(Kernel kernel) {
84
85
private void setLogLevel (String logLevel ) {
85
86
switch (logLevel ) {
86
87
case "debug" :
87
- this .log .setLevel (LogService .DEBUG );
88
+ this .log .setLevel (LogLevel .DEBUG );
88
89
break ;
89
90
case "error" :
90
- this .log .setLevel (LogService .ERROR );
91
+ this .log .setLevel (LogLevel .ERROR );
91
92
break ;
92
93
case "info" :
93
- this .log .setLevel (LogService .INFO );
94
+ this .log .setLevel (LogLevel .INFO );
94
95
break ;
95
96
case "none" :
96
- this .log .setLevel (LogService .NONE );
97
+ this .log .setLevel (LogLevel .NONE );
97
98
break ;
98
99
default :
99
- this .log .setLevel (LogService .INFO );
100
+ this .log .setLevel (LogLevel .INFO );
100
101
break ;
101
102
}
102
103
}
Original file line number Diff line number Diff line change @@ -88,13 +88,13 @@ public void run() {
88
88
89
89
final Reader input = new StringReader (this .code );
90
90
final ScriptInfo info = new ScriptInfo (context , "dummy.py" , input );
91
+ info .setLanguage (scriptLanguage );
91
92
this .seo .setOutputHandler ();
92
93
93
94
try {
94
95
// create the ScriptModule instance
95
96
final ScriptModule module = info .createModule ();
96
97
context .inject (module );
97
- module .setLanguage (scriptLanguage );
98
98
99
99
// HACK: Inject our cached script engine instance, rather
100
100
// than letting the ScriptModule instance create its own.
Original file line number Diff line number Diff line change 25
25
import org .scijava .notebook .converter .output .PlainNotebookOutput ;
26
26
import org .scijava .plugin .Plugin ;
27
27
28
- @ Plugin (type = Converter .class , priority = Priority .VERY_HIGH_PRIORITY )
28
+ @ Plugin (type = Converter .class , priority = Priority .VERY_HIGH )
29
29
public class StringToPlainNotebookConverter
30
30
extends NotebookOutputConverter <String , PlainNotebookOutput > {
31
31
Original file line number Diff line number Diff line change 28
28
import javax .script .ScriptException ;
29
29
30
30
import net .imagej .ImageJ ;
31
- import net .imagej .Main ;
32
31
33
32
import org .scijava .module .ModuleItem ;
34
33
import org .scijava .module .process .ModulePreprocessor ;
45
44
public class TestAnnotations {
46
45
47
46
public static void main (final String [] args ) throws ScriptException {
48
- ImageJ ij = Main .launch (args );
47
+ ImageJ ij = new ImageJ ();
48
+ ij .launch (args );
49
49
50
50
String code = "#@LogService log\n #@ImageJ ij\n print('log')\n print('jjjj')" ;
51
51
final Reader input = new StringReader (code );
@@ -57,12 +57,12 @@ public static void main(final String[] args) throws ScriptException {
57
57
List <? extends PostprocessorPlugin > post = ij .plugin ().createInstancesOfType (PostprocessorPlugin .class );
58
58
59
59
ScriptLanguage scriptLanguage = ij .script ().getLanguageByName ("jython" );
60
+ info .setLanguage (scriptLanguage );
60
61
ScriptEngine scriptEngine = scriptLanguage .getScriptEngine ();
61
62
62
63
ScriptModule module ;
63
64
module = new ScriptModule (info );
64
65
ij .context ().inject (module );
65
- module .setLanguage (scriptLanguage );
66
66
67
67
for (final ModulePreprocessor p : pre ) {
68
68
p .process (module );
Original file line number Diff line number Diff line change 28
28
import javax .script .ScriptException ;
29
29
30
30
import net .imagej .ImageJ ;
31
- import net .imagej .Main ;
32
31
33
32
import org .scijava .module .ModuleItem ;
34
33
import org .scijava .module .process .PreprocessorPlugin ;
43
42
public class TestGroovy {
44
43
45
44
public static void main (String [] args ) throws ScriptException {
46
- ImageJ ij = Main .launch (args );
45
+ ImageJ ij = new ImageJ ();
46
+ ij .launch (args );
47
47
48
48
String code = "" ;
49
49
//code += "@Grab('org.springframework:spring-orm:3.2.5.RELEASE')\n";
@@ -57,12 +57,12 @@ public static void main(String[] args) throws ScriptException {
57
57
List <? extends PreprocessorPlugin > pre = ij .plugin ().createInstancesOfType (PreprocessorPlugin .class );
58
58
59
59
ScriptLanguage scriptLanguage = ij .script ().getLanguageByName ("groovy" );
60
+ info .setLanguage (scriptLanguage );
60
61
ScriptEngine scriptEngine = scriptLanguage .getScriptEngine ();
61
62
62
63
ScriptModule module ;
63
64
module = new ScriptModule (info );
64
65
ij .context ().inject (module );
65
- module .setLanguage (scriptLanguage );
66
66
67
67
pre .forEach ((p ) -> {
68
68
p .process (module );
You can’t perform that action at this time.
0 commit comments