File tree Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -880,18 +880,6 @@ Blockly.Blocks['niryo_one_conveyor_stop'] = {
880
880
* Generators
881
881
*/
882
882
883
- const connexion = `
884
- from pyniryo import *
885
-
886
- class niryo_connect():
887
- def __init__(self, ip):
888
- self.n = NiryoRobot(ip)
889
- def __enter__(self):
890
- return self.n
891
- def __exit__(self):
892
- self.n.close_connection()
893
- ` ;
894
-
895
883
Blockly . Python [ 'niryo_one_connect' ] = function ( block ) {
896
884
var ip_0 = block . getFieldValue ( 'ip_0' ) ;
897
885
var ip_1 = block . getFieldValue ( 'ip_1' ) ;
@@ -901,10 +889,22 @@ Blockly.Python['niryo_one_connect'] = function (block) {
901
889
let branch = Blockly . Python . statementToCode ( block , 'DO' ) ;
902
890
var ip = ip_0 + '.' + ip_1 + '.' + ip_2 + '.' + ip_3 ;
903
891
904
- var code = connexion + '\nwith niryo_connect("' + ip + '") as n:\n' + branch ;
892
+ var code = '\nwith niryo_connect("' + ip + '") as n:\n' + branch ;
905
893
return code ;
906
894
} ;
907
895
896
+ Blockly . Blocks [ 'niryo_one_connect' ] . toplevel_init = `
897
+ from pyniryo import *
898
+
899
+ class niryo_connect():
900
+ def __init__(self, ip):
901
+ self.n = NiryoRobot(ip)
902
+ def __enter__(self):
903
+ return self.n
904
+ def __exit__(self):
905
+ self.n.close_connection()
906
+ ` ;
907
+
908
908
Blockly . Python [ 'niryo_one_move_joints' ] = function ( block ) {
909
909
var number_joints_1 = block . getFieldValue ( 'JOINTS_1' ) ;
910
910
var number_joints_2 = block . getFieldValue ( 'JOINTS_2' ) ;
Original file line number Diff line number Diff line change 179
179
resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.3.1.tgz#b50a781709c81e10701004214340f25475a171a0"
180
180
integrity sha512-zMM9Ds+SawiUkakS7y94Ymqx+S0ORzpG3frZirN3l+UlXUmSUR7hF4wxCVqW+ei94JzV5kt0uXBcoOEAuiydrw==
181
181
182
- " @jupyterlab/application@^3.3 " , "@jupyterlab/application@^3. 4":
182
+ " @jupyterlab/application@^3.4 " :
183
183
version "3.4.3"
184
184
resolved "https://registry.yarnpkg.com/@jupyterlab/application/-/application-3.4.3.tgz#acaecafbce1be71776ceee11203b9fb0a02e27d8"
185
185
integrity sha512-JZy/4yB23N9o0gJFL8L219N7cWhUgulBECa+esN8K/i3TVoG0m/obacLBJrmwdgmQKAgyJ2Vfo1tyhW3UHvlFw==
You can’t perform that action at this time.
0 commit comments