part_import_pane.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. ////////////////////////////////////////////////////////////////////////////
  2. // System Pre-define Functions
  3. // 95099372-ef3e-11ea-9c81-bf848405c62e
  4. //Callback of data preparation stage before UI is fully loaded.
  5. function OnInitializeData(reload, preview) {
  6. PUI(()=>{
  7. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  8. //The 'pui' variable is valid in all functions of this document.
  9. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  10. });
  11. OnPartImtBtnShow(0);
  12. OnPartImtBtnShow(1);
  13. OnPartImtBtnShow(2);
  14. OnPartImtBtnShow(3);
  15. OnPartImtBtnShow(4);
  16. OnPartImtBtnHide(5);
  17. ui.part_imt_2.index = 0;
  18. OnCurvesModelShow();
  19. }
  20. //Callback after UI is fully loaded and displayed.
  21. function OnReady(reload, preview) {
  22. PUI(()=>{
  23. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  24. //The 'pui' variable is valid in all functions of this document.
  25. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  26. });
  27. }
  28. function OnCloseForm() {
  29. }
  30. function OnException(err) {
  31. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  32. }
  33. //////////////////////////////////////////////////////////////////////////
  34. // Callback Functions.
  35. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  36. /*function OnOpenBtnImTool(){
  37. unit.form.side_pane.OnOpenBtnImTool();
  38. }*/
  39. function OnOpenImTool(){
  40. unit.form.side_pane.OnOpenToolFile();
  41. }
  42. function OnOpenImPart(){
  43. unit.form.side_pane.OnOpenPartFile();
  44. }
  45. function OnCurvesModelHide(){
  46. ui.curves_down_btn.visible = false;
  47. ui.curves_right_btn.visible = true;
  48. ui.curves_stk.visible = false;
  49. }
  50. function OnCurvesModelShow(){
  51. ui.curves_down_btn.visible = true;
  52. ui.curves_right_btn.visible = false;
  53. ui.curves_stk.visible = true;
  54. }
  55. function OnPartImtBtnHide(Idx){
  56. if(Idx === 0){
  57. ui.imt_btn_d0.visible = false;
  58. ui.imt_btn_r0.visible = true;
  59. ui.part_imt_0.visible = false;
  60. }
  61. if(Idx === 1){
  62. ui.imt_btn_d1.visible = false;
  63. ui.imt_btn_r1.visible = true;
  64. ui.part_imt_1.visible = false;
  65. }
  66. if(Idx === 2){
  67. ui.imt_btn_d2.visible = false;
  68. ui.imt_btn_r2.visible = true;
  69. ui.part_imt_2.visible = false;
  70. }
  71. if(Idx === 3){
  72. ui.imt_btn_d3.visible = false;
  73. ui.imt_btn_r3.visible = true;
  74. ui.part_imt_3.visible = false;
  75. }
  76. if(Idx === 4){
  77. ui.imt_btn_d4.visible = false;
  78. ui.imt_btn_r4.visible = true;
  79. ui.part_imt_4.visible = false;
  80. }
  81. if(Idx === 5){
  82. ui.imt_btn_d5.visible = false;
  83. ui.imt_btn_r5.visible = true;
  84. ui.part_imt_5.visible = false;
  85. }
  86. }
  87. function OnPartImtBtnShow(Idx){
  88. if(Idx === 0){
  89. ui.imt_btn_d0.visible = true;
  90. ui.imt_btn_r0.visible = false;
  91. ui.part_imt_0.visible = true;
  92. }
  93. if(Idx === 1){
  94. ui.imt_btn_d1.visible = true;
  95. ui.imt_btn_r1.visible = false;
  96. ui.part_imt_1.visible = true;
  97. }
  98. if(Idx === 2){
  99. ui.imt_btn_d2.visible = true;
  100. ui.imt_btn_r2.visible = false;
  101. ui.part_imt_2.visible = true;
  102. }
  103. if(Idx === 3){
  104. ui.imt_btn_d3.visible = true;
  105. ui.imt_btn_r3.visible = false;
  106. ui.part_imt_3.visible = true;
  107. }
  108. if(Idx === 4){
  109. ui.imt_btn_d4.visible = true;
  110. ui.imt_btn_r4.visible = false;
  111. ui.part_imt_4.visible = true;
  112. }
  113. if(Idx === 5){
  114. ui.imt_btn_d5.visible = true;
  115. ui.imt_btn_r5.visible = false;
  116. ui.part_imt_5.visible = true;
  117. }
  118. }
  119. //The message corresponding callback executed by the docker pane.
  120. // when calling [side_pane].fireEvent(type,para) in the main form.
  121. function OnParentDockerMessage(type, para) {
  122. }
  123. //////////////////////////////////////////////////////////////////////////
  124. // Utils Functions.
  125. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  126. function onDragFile(filepath) {
  127. }
  128. function PUI(cb) {
  129. if(pui){cb();}
  130. }
  131. /*Usage of BLOCK_EVENT
  132. BLOCK_EVENT(()=>{
  133. ui.[name].[var] = ...;
  134. });
  135. */
  136. function BLOCK_EVENT(cb) {
  137. ui.block_event = true;
  138. cb();
  139. ui.block_event = false;
  140. }
  141. //////////////////////////////////////////////////////////////////////////
  142. // template codes for cw callback js.
  143. function CW_DeclareVariable(name, setter, getter) {
  144. if(typeof(__DeclareVariable) === 'function') {
  145. __DeclareVariable(name, setter, getter);
  146. }
  147. }
  148. function CW_DeclareOuterVariable(name) {
  149. if(typeof(__DeclareOuterVariable) === 'function') {
  150. __DeclareOuterVariable(name);
  151. }
  152. }