Explorar o código

“提交项目”

lisihan hai 4 meses
pai
achega
a8a0195814
Modificáronse 83 ficheiros con 3562 adicións e 0 borrados
  1. 150 0
      _entry.js
  2. 172 0
      _entry_preview.js
  3. 92 0
      js/_model.js
  4. 56 0
      js/mainfrm_pane.js
  5. 11 0
      kul/kul.entry.xml
  6. 3081 0
      kul/mainfrm.kul
  7. BIN=BIN
      picture/1.1.png
  8. BIN=BIN
      picture/1.2.png
  9. BIN=BIN
      picture/1.3.png
  10. BIN=BIN
      picture/1.4.1.png
  11. BIN=BIN
      picture/1.4.2.png
  12. BIN=BIN
      picture/1.4.3.png
  13. BIN=BIN
      picture/1.4.4.png
  14. BIN=BIN
      picture/1.4.5.png
  15. BIN=BIN
      picture/1.4.6.png
  16. BIN=BIN
      picture/1.4.7.png
  17. BIN=BIN
      picture/1.4.8.png
  18. BIN=BIN
      picture/1.4.9.1.png
  19. BIN=BIN
      picture/1.4.9.png
  20. BIN=BIN
      picture/1.6.1.png
  21. BIN=BIN
      picture/1.6.2.png
  22. BIN=BIN
      picture/1.6.3.png
  23. BIN=BIN
      picture/1.6.4.png
  24. BIN=BIN
      picture/1.6.5.png
  25. BIN=BIN
      picture/1.7.1.png
  26. BIN=BIN
      picture/1.7.2.png
  27. BIN=BIN
      picture/1.7.3.png
  28. BIN=BIN
      picture/1.8.1.png
  29. BIN=BIN
      picture/1.8.2.png
  30. BIN=BIN
      picture/1.8.3.png
  31. BIN=BIN
      picture/1.9.1.png
  32. BIN=BIN
      picture/1.9.2.png
  33. BIN=BIN
      picture/1ba38d5320c164799c12aadccbf0947.png
  34. BIN=BIN
      picture/3479e334848bc53e4f256239ef86dab.png
  35. BIN=BIN
      picture/727abac99348b58b9770c7cf686013d.png
  36. BIN=BIN
      picture/83008658b69a59c15b0ae7b01af576d.png
  37. BIN=BIN
      picture/9452e6006f6ee7b1206bc88a32bcc80.png
  38. BIN=BIN
      picture/9a80057e7397cde5fec5702523c8b26.png
  39. BIN=BIN
      picture/A.png
  40. BIN=BIN
      picture/a23b885d56a7213aca980de80445761.png
  41. BIN=BIN
      picture/b6904cdd1f207afaf729c3453e7fea0.png
  42. BIN=BIN
      picture/bb83f731438431730d385aa678371c8.png
  43. BIN=BIN
      picture/c80d30818ed011920c76e1cb61a8445.png
  44. BIN=BIN
      picture/c8145f1b00316f0e5abe5d19580f3d9.png
  45. BIN=BIN
      picture/e41a21bc91c726564eada314ce9ede1.png
  46. BIN=BIN
      picture/ec54a814dfb28c06265f5585f0b805f.png
  47. BIN=BIN
      picture/fba1036689ff66eda28d9ddcfe9d22b.png
  48. BIN=BIN
      picture/long1.png
  49. BIN=BIN
      picture/下标.png
  50. BIN=BIN
      picture/修剪.png
  51. BIN=BIN
      picture/偏移.png
  52. BIN=BIN
      picture/分解.png
  53. BIN=BIN
      picture/创建.png
  54. BIN=BIN
      picture/删除.png
  55. BIN=BIN
      picture/匹配图层.png
  56. BIN=BIN
      picture/图层特性.png
  57. BIN=BIN
      picture/圆.png
  58. BIN=BIN
      picture/圆弧.png
  59. BIN=BIN
      picture/圆角.png
  60. BIN=BIN
      picture/基点.png
  61. BIN=BIN
      picture/复制.png
  62. BIN=BIN
      picture/多段线.png
  63. BIN=BIN
      picture/引线.png
  64. BIN=BIN
      picture/拉伸.png
  65. BIN=BIN
      picture/插入.png
  66. BIN=BIN
      picture/文字.png
  67. BIN=BIN
      picture/旋转.png
  68. BIN=BIN
      picture/标注.png
  69. BIN=BIN
      picture/标注1.png
  70. BIN=BIN
      picture/测量.png
  71. BIN=BIN
      picture/特性匹配.png
  72. BIN=BIN
      picture/直线.png
  73. BIN=BIN
      picture/移动.png
  74. BIN=BIN
      picture/粘贴.png
  75. BIN=BIN
      picture/线性、.png
  76. BIN=BIN
      picture/组.png
  77. BIN=BIN
      picture/编辑.png
  78. BIN=BIN
      picture/编辑属性.png
  79. BIN=BIN
      picture/缩放.png
  80. BIN=BIN
      picture/置为当前.png
  81. BIN=BIN
      picture/表格.png
  82. BIN=BIN
      picture/镜像.png
  83. BIN=BIN
      picture/阵列.png

+ 150 - 0
_entry.js

@@ -0,0 +1,150 @@
+var is_embedded = false;
+if(process.argv.length == 3 && process.argv[2] == 'embedded')
+{
+    is_embedded = true;
+}
+
+var fs = require('fs');
+var vm = require('vm');
+
+initRuntimeEnv();
+
+var dirHome = process.env['COMX_SDK'];
+var dirUnit = __dirname + '/';
+
+if(process.platform == 'win32')
+{
+    require('bindings')('js_ext_comx_qtshell-native-win.node');
+    require('bindings')('js_ext_comx_resource-native-win.node');
+    require('bindings')('js_ext_comx_mutex-native-win.node');
+}
+
+if(process.platform == 'linux')
+{
+    require('bindings')('js_ext_comx_qt-native-linux.node');
+    require('bindings')('js_ext_comx_resource-native-linux.node');
+    require('bindings')('js_ext_comx_mutex-native-linux.node');
+}
+
+var require_ = require('require-from-string');
+var __ = (_)=>{
+    (new vm.Script(_)).runInNewContext({
+	'require' : require,
+	'process' : process,
+	'comx' : comx,
+	'exports' :exports,
+	'comx_startup' : ()=>{
+	    comx.resource.qt.loadUnit(dirUnit, exports, function(){
+                if(is_embedded)
+                    unit.form._entry.ShowEmbedded();
+		else if(process.argv.length >= 3)
+		    unit.form[process.argv[2]].Show();
+		else
+		    unit.form._entry.Show();
+	    }, (form)=>{
+		//readyForm
+	    });
+	}
+    });
+};
+
+var tmpl = fs.readFileSync(dirHome+'template/4e7b90182d3b4e11a7ca74d8fc8c545f');
+comx.resource.Initialize(require_, __, tmpl);
+
+if(!comx.resource.hasResource)
+{
+    if(process.argv.length == 4)
+    {
+	var tmpl = fs.readFileSync(dirHome+'template/008f111453704f82b9616e9bf92655f0');
+	comx.resource.LoadKernelRemote(parseInt(process.argv[3]), false, tmpl);
+    }
+    else
+    {
+	var tmpl = fs.readFileSync(dirHome+'template/ad72fee60eea4a89844aa934b9bc099b');
+	comx.resource.LoadKernelRemote(getWSAddress(), false, tmpl);
+    }
+}
+else
+{
+    comx.resource.qt.loadUnit(dirUnit, exports, function(){
+        if(is_embedded)
+            unit.form._entry.ShowEmbedded();
+	else if(process.argv.length >= 3)
+	    unit.form[process.argv[2]].Show();
+	else
+	    unit.form._entry.Show();
+    }, (form)=>{
+	//readyForm
+    });
+}
+
+process.on('uncaughtException', (e)=>{
+    console.error('process error is:', e.message);
+});
+
+/////////////////////////////////////////////////////////////////////////////
+// Init Runtime Env
+
+function initRuntimeEnv()
+{
+    process.env.COMX_SDK = getHomeDir();
+
+    var depsDir = getDepsDir();
+
+    if(depsDir)
+    {
+	process.chdir(depsDir);
+    }
+}
+
+function getParentDir(dirName)
+{
+    var idx = dirName.lastIndexOf('/');
+    if(idx == -1)
+    {
+	idx = dirName.lastIndexOf('\\');
+    }
+
+    return dirName.substr(0, idx);
+}
+
+function getHomeDir()
+{
+    if(fs.existsSync(__dirname + '/07D976FB68304742A31191AA0503DE79'))
+    {
+	return __dirname + '/';
+    }
+    else
+    {
+    return getParentDir(getParentDir(__dirname)) + '/';
+    }
+}
+
+function getDepsDir()
+{
+    if(process.platform == 'win32')
+    {
+	return getHomeDir() + 'deps\\windows\\bin\\';
+    }
+
+    if(process.platform == 'linux')
+    {
+	return getHomeDir() + 'deps/linux/bin/';
+    }
+
+    return false;
+}
+
+function getWSAddress()
+{
+    var fpath = getHomeDir() + '/cache/ws.cache';
+
+    if(!fs.existsSync(fpath))
+    {
+	return "ws://localhost:3000";
+    }
+    else
+    {
+	return '' + fs.readFileSync(fpath);
+    }
+}

+ 172 - 0
_entry_preview.js

@@ -0,0 +1,172 @@
+var fs = require('fs');
+var vm = require('vm');
+
+initRuntimeEnv();
+
+var dirHome = process.env['COMX_SDK'];
+var dirUnit = __dirname + '/';
+
+if(process.platform == 'win32')
+{
+    require('bindings')('js_ext_comx_qtshell-native-win.node');
+    require('bindings')('js_ext_comx_resource-native-win.node');
+    require('bindings')('js_ext_comx_mutex-native-win.node');
+}
+
+if(process.platform == 'linux')
+{
+    require('bindings')('js_ext_comx_qt-native-linux.node');
+    require('bindings')('js_ext_comx_resource-native-linux.node');
+    require('bindings')('js_ext_comx_mutex-native-linux.node');
+}
+
+var require_ = require('require-from-string');
+var __ = (_)=>{
+    (new vm.Script(_)).runInNewContext({
+	'require' : require,
+	'process' : process,
+	'comx' : comx,
+	'exports' :exports,
+	'comx_startup' : ()=>{
+	    comx.resource.qt.loadUnit(dirUnit, exports, function(){
+		if(process.argv.length >= 4)
+                {
+                    var is_hide = !process.argv[3];
+                    if(is_hide)
+                    {
+                        unit.form[process.argv[2]].ShowEmbedded();
+                    }
+                    else
+		        unit.form[process.argv[2]].ShowPreview();
+                }
+		else
+                {
+                    var is_hide = !process.argv[2];
+                    if(is_hide)
+                    {
+                        unit.form._entry.ShowEmbedded();
+                    }
+                    else
+		        unit.form._entry.ShowPreview();
+                }
+	    }, (form)=>{
+		//readyForm
+	    });
+	}
+    });
+};
+
+var tmpl = fs.readFileSync(dirHome+'template/4e7b90182d3b4e11a7ca74d8fc8c545f');
+comx.resource.Initialize(require_, __, tmpl);
+
+if(!comx.resource.hasResource)
+{
+    if(process.argv.length == 4)
+    {
+	var tmpl = fs.readFileSync(dirHome+'template/008f111453704f82b9616e9bf92655f0');
+	comx.resource.LoadKernelRemote(parseInt(process.argv[3]), false, tmpl);
+    }
+    else
+    {
+	var tmpl = fs.readFileSync(dirHome+'template/ad72fee60eea4a89844aa934b9bc099b');
+	comx.resource.LoadKernelRemote(getWSAddress(), false, tmpl);
+    }
+}
+else
+{
+    comx.resource.qt.loadUnit(dirUnit, exports, function(){
+	if(process.argv.length >= 4)
+        {
+            var is_hide = !process.argv[3];
+            if(is_hide)
+            {
+                unit.form[process.argv[2]].ShowEmbedded();
+            }
+            else
+	        unit.form[process.argv[2]].ShowPreview();
+        }
+	else
+        {
+            var is_hide = !process.argv[2];
+            if(is_hide)
+            {
+                unit.form._entry.ShowEmbedded();
+            }
+            else
+	        unit.form._entry.ShowPreview();
+        }
+    }, (form)=>{
+	//readyForm
+    });
+}
+
+process.on('uncaughtException', (e)=>{
+    console.error('process error is:', e.message);
+});
+
+/////////////////////////////////////////////////////////////////////////////
+// Init Runtime Env
+
+function initRuntimeEnv()
+{
+    process.env.COMX_SDK = getHomeDir();
+
+    var depsDir = getDepsDir();
+
+    if(depsDir)
+    {
+	process.chdir(depsDir);
+    }
+}
+
+function getParentDir(dirName)
+{
+    var idx = dirName.lastIndexOf('/');
+    if(idx == -1)
+    {
+	idx = dirName.lastIndexOf('\\');
+    }
+
+    return dirName.substr(0, idx);
+}
+
+function getHomeDir()
+{
+    if(fs.existsSync(__dirname + '/07D976FB68304742A31191AA0503DE79'))
+    {
+	return __dirname + '/';
+    }
+    else
+    {
+    return getParentDir(getParentDir(__dirname)) + '/';
+    }
+}
+
+function getDepsDir()
+{
+    if(process.platform == 'win32')
+    {
+	return getHomeDir() + 'deps\\windows\\bin\\';
+    }
+
+    if(process.platform == 'linux')
+    {
+	return getHomeDir() + 'deps/linux/bin/';
+    }
+
+    return false;
+}
+
+function getWSAddress()
+{
+    var fpath = getHomeDir() + '/cache/ws.cache';
+
+    if(!fs.existsSync(fpath))
+    {
+	return "ws://localhost:3000";
+    }
+    else
+    {
+	return '' + fs.readFileSync(fpath);
+    }
+}

+ 92 - 0
js/_model.js

@@ -0,0 +1,92 @@
+var fs   = require('fs');
+var path = require('path');
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//Initialize codes.
+AutoLoadPlugins();
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//You can load the plugins in global field, if the next line codes are uncommented.
+//AutoLoadGlobalPlugins();
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//Sample codes.
+exports.Test = function()
+{
+    console.log("Hi, I'm a model test funciton");
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//Put you codes here
+
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// AutoLoadPlugins Function Implement Start.
+
+function AutoLoadPlugins()
+{
+    var plugin_dir = (__dirname + '/../addon/');
+    if(!fs.existsSync(plugin_dir))
+    {
+        return;
+    }
+    
+    var files = fs.readdirSync(plugin_dir);
+    files.forEach(function(filename){
+        var filedir = path.join(plugin_dir, filename);
+        var stats = fs.statSync(filedir);
+        if(!stats.isDirectory())
+        {
+            if(filedir.indexOf('-linux.node') !== -1 && require('os').platform() === 'linux')
+            {
+                require(filedir);
+            }
+            
+            if(filedir.indexOf('-win.node') !== -1 && require('os').platform() === 'win32')
+            {
+                require(filedir);
+            }
+        }
+    });
+}
+
+function AutoLoadGlobalPlugins() {
+        var plugin_dir = (process.env['COMX_SDK'] + 'addon/');
+        if (!fs.existsSync(plugin_dir)) {
+                return;
+        }
+
+        var files = fs.readdirSync(plugin_dir);
+        files.forEach(function(filename) {
+                var filedir = path.join(plugin_dir, filename);
+                var stats = fs.statSync(filedir);
+                if (!stats.isDirectory()) {
+                        if (filedir.indexOf('-linux.node') !== -1 && require('os').platform() === 'linux') {
+                                require(filedir);
+                        }
+
+                        if (filedir.indexOf('-win.node') !== -1 && require('os').platform() === 'win32') {
+                                require(filedir);
+                        }
+                }
+        });
+}
+
+//AutoLoadPlugins Function Implement End.
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// ide_info Function Implement Start.
+
+exports.ide_info = (msg) => {
+        if (process.send) {
+                process.send({
+                        type: 'debug',
+                        info: msg
+                });
+        }
+}
+
+//ide_info Function Implement End.
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

+ 56 - 0
js/mainfrm_pane.js

@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////
+// System Pre-define Functions
+// 95099372-ef3e-11ea-9c81-bf848405c62e
+
+//Callback of data preparation stage before UI is fully loaded.
+function OnInitializeData(reload, preview) 
+{
+
+}
+
+//Callback after UI is fully loaded and displayed.
+function OnReady(reload, preview)
+{
+}
+
+function OnCloseForm()
+{
+    
+}
+
+function OnException(err)
+{
+        //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Callback Functions.
+// 641a254c-ef3e-11ea-bc8a-379bb908bdd7
+
+//The message corresponding callback executed by the main form
+// when calling pui.fireEvent(type,para) in the Docker subform.
+function OnChildDockerMessage(type, para){
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Utils Functions.
+// 6c165ad6-ef3e-11ea-987c-b761a131c2fe
+
+function onDragFile(filepath)
+{
+}
+
+/*Usage of BLOCK_EVENT
+        BLOCK_EVENT(()=>{
+                ui.[name].[var] = ...;
+        });
+*/
+
+function BLOCK_EVENT(cb)
+{
+        ui.block_event = true;
+        
+        cb();
+        
+        ui.block_event = false;
+}

+ 11 - 0
kul/kul.entry.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<kul_pkg type="entry" name="homework" xmlns="http://www.kingmesh.com">
+  <pkgid name="mainfrm">
+    <location>mainfrm.kul</location>
+    <value>nil</value>
+  </pkgid>
+  <formid name="mainfrm_pane">
+    <location>mainfrm.kul</location>
+    <value>nil</value>
+  </formid>
+</kul_pkg>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 3081 - 0
kul/mainfrm.kul


BIN=BIN
picture/1.1.png


BIN=BIN
picture/1.2.png


BIN=BIN
picture/1.3.png


BIN=BIN
picture/1.4.1.png


BIN=BIN
picture/1.4.2.png


BIN=BIN
picture/1.4.3.png


BIN=BIN
picture/1.4.4.png


BIN=BIN
picture/1.4.5.png


BIN=BIN
picture/1.4.6.png


BIN=BIN
picture/1.4.7.png


BIN=BIN
picture/1.4.8.png


BIN=BIN
picture/1.4.9.1.png


BIN=BIN
picture/1.4.9.png


BIN=BIN
picture/1.6.1.png


BIN=BIN
picture/1.6.2.png


BIN=BIN
picture/1.6.3.png


BIN=BIN
picture/1.6.4.png


BIN=BIN
picture/1.6.5.png


BIN=BIN
picture/1.7.1.png


BIN=BIN
picture/1.7.2.png


BIN=BIN
picture/1.7.3.png


BIN=BIN
picture/1.8.1.png


BIN=BIN
picture/1.8.2.png


BIN=BIN
picture/1.8.3.png


BIN=BIN
picture/1.9.1.png


BIN=BIN
picture/1.9.2.png


BIN=BIN
picture/1ba38d5320c164799c12aadccbf0947.png


BIN=BIN
picture/3479e334848bc53e4f256239ef86dab.png


BIN=BIN
picture/727abac99348b58b9770c7cf686013d.png


BIN=BIN
picture/83008658b69a59c15b0ae7b01af576d.png


BIN=BIN
picture/9452e6006f6ee7b1206bc88a32bcc80.png


BIN=BIN
picture/9a80057e7397cde5fec5702523c8b26.png


BIN=BIN
picture/A.png


BIN=BIN
picture/a23b885d56a7213aca980de80445761.png


BIN=BIN
picture/b6904cdd1f207afaf729c3453e7fea0.png


BIN=BIN
picture/bb83f731438431730d385aa678371c8.png


BIN=BIN
picture/c80d30818ed011920c76e1cb61a8445.png


BIN=BIN
picture/c8145f1b00316f0e5abe5d19580f3d9.png


BIN=BIN
picture/e41a21bc91c726564eada314ce9ede1.png


BIN=BIN
picture/ec54a814dfb28c06265f5585f0b805f.png


BIN=BIN
picture/fba1036689ff66eda28d9ddcfe9d22b.png


BIN=BIN
picture/long1.png


BIN=BIN
picture/下标.png


BIN=BIN
picture/修剪.png


BIN=BIN
picture/偏移.png


BIN=BIN
picture/分解.png


BIN=BIN
picture/创建.png


BIN=BIN
picture/删除.png


BIN=BIN
picture/匹配图层.png


BIN=BIN
picture/图层特性.png


BIN=BIN
picture/圆.png


BIN=BIN
picture/圆弧.png


BIN=BIN
picture/圆角.png


BIN=BIN
picture/基点.png


BIN=BIN
picture/复制.png


BIN=BIN
picture/多段线.png


BIN=BIN
picture/引线.png


BIN=BIN
picture/拉伸.png


BIN=BIN
picture/插入.png


BIN=BIN
picture/文字.png


BIN=BIN
picture/旋转.png


BIN=BIN
picture/标注.png


BIN=BIN
picture/标注1.png


BIN=BIN
picture/测量.png


BIN=BIN
picture/特性匹配.png


BIN=BIN
picture/直线.png


BIN=BIN
picture/移动.png


BIN=BIN
picture/粘贴.png


BIN=BIN
picture/线性、.png


BIN=BIN
picture/组.png


BIN=BIN
picture/编辑.png


BIN=BIN
picture/编辑属性.png


BIN=BIN
picture/缩放.png


BIN=BIN
picture/置为当前.png


BIN=BIN
picture/表格.png


BIN=BIN
picture/镜像.png


BIN=BIN
picture/阵列.png