Quellcode durchsuchen

“提交项目”

lisihan vor 4 Monaten
Ursprung
Commit
a8a0195814
83 geänderte Dateien mit 3562 neuen und 0 gelöschten Zeilen
  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
      picture/1.1.png
  8. BIN
      picture/1.2.png
  9. BIN
      picture/1.3.png
  10. BIN
      picture/1.4.1.png
  11. BIN
      picture/1.4.2.png
  12. BIN
      picture/1.4.3.png
  13. BIN
      picture/1.4.4.png
  14. BIN
      picture/1.4.5.png
  15. BIN
      picture/1.4.6.png
  16. BIN
      picture/1.4.7.png
  17. BIN
      picture/1.4.8.png
  18. BIN
      picture/1.4.9.1.png
  19. BIN
      picture/1.4.9.png
  20. BIN
      picture/1.6.1.png
  21. BIN
      picture/1.6.2.png
  22. BIN
      picture/1.6.3.png
  23. BIN
      picture/1.6.4.png
  24. BIN
      picture/1.6.5.png
  25. BIN
      picture/1.7.1.png
  26. BIN
      picture/1.7.2.png
  27. BIN
      picture/1.7.3.png
  28. BIN
      picture/1.8.1.png
  29. BIN
      picture/1.8.2.png
  30. BIN
      picture/1.8.3.png
  31. BIN
      picture/1.9.1.png
  32. BIN
      picture/1.9.2.png
  33. BIN
      picture/1ba38d5320c164799c12aadccbf0947.png
  34. BIN
      picture/3479e334848bc53e4f256239ef86dab.png
  35. BIN
      picture/727abac99348b58b9770c7cf686013d.png
  36. BIN
      picture/83008658b69a59c15b0ae7b01af576d.png
  37. BIN
      picture/9452e6006f6ee7b1206bc88a32bcc80.png
  38. BIN
      picture/9a80057e7397cde5fec5702523c8b26.png
  39. BIN
      picture/A.png
  40. BIN
      picture/a23b885d56a7213aca980de80445761.png
  41. BIN
      picture/b6904cdd1f207afaf729c3453e7fea0.png
  42. BIN
      picture/bb83f731438431730d385aa678371c8.png
  43. BIN
      picture/c80d30818ed011920c76e1cb61a8445.png
  44. BIN
      picture/c8145f1b00316f0e5abe5d19580f3d9.png
  45. BIN
      picture/e41a21bc91c726564eada314ce9ede1.png
  46. BIN
      picture/ec54a814dfb28c06265f5585f0b805f.png
  47. BIN
      picture/fba1036689ff66eda28d9ddcfe9d22b.png
  48. BIN
      picture/long1.png
  49. BIN
      picture/下标.png
  50. BIN
      picture/修剪.png
  51. BIN
      picture/偏移.png
  52. BIN
      picture/分解.png
  53. BIN
      picture/创建.png
  54. BIN
      picture/删除.png
  55. BIN
      picture/匹配图层.png
  56. BIN
      picture/图层特性.png
  57. BIN
      picture/圆.png
  58. BIN
      picture/圆弧.png
  59. BIN
      picture/圆角.png
  60. BIN
      picture/基点.png
  61. BIN
      picture/复制.png
  62. BIN
      picture/多段线.png
  63. BIN
      picture/引线.png
  64. BIN
      picture/拉伸.png
  65. BIN
      picture/插入.png
  66. BIN
      picture/文字.png
  67. BIN
      picture/旋转.png
  68. BIN
      picture/标注.png
  69. BIN
      picture/标注1.png
  70. BIN
      picture/测量.png
  71. BIN
      picture/特性匹配.png
  72. BIN
      picture/直线.png
  73. BIN
      picture/移动.png
  74. BIN
      picture/粘贴.png
  75. BIN
      picture/线性、.png
  76. BIN
      picture/组.png
  77. BIN
      picture/编辑.png
  78. BIN
      picture/编辑属性.png
  79. BIN
      picture/缩放.png
  80. BIN
      picture/置为当前.png
  81. BIN
      picture/表格.png
  82. BIN
      picture/镜像.png
  83. 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>

Datei-Diff unterdrückt, da er zu groß ist
+ 3081 - 0
kul/mainfrm.kul


BIN
picture/1.1.png


BIN
picture/1.2.png


BIN
picture/1.3.png


BIN
picture/1.4.1.png


BIN
picture/1.4.2.png


BIN
picture/1.4.3.png


BIN
picture/1.4.4.png


BIN
picture/1.4.5.png


BIN
picture/1.4.6.png


BIN
picture/1.4.7.png


BIN
picture/1.4.8.png


BIN
picture/1.4.9.1.png


BIN
picture/1.4.9.png


BIN
picture/1.6.1.png


BIN
picture/1.6.2.png


BIN
picture/1.6.3.png


BIN
picture/1.6.4.png


BIN
picture/1.6.5.png


BIN
picture/1.7.1.png


BIN
picture/1.7.2.png


BIN
picture/1.7.3.png


BIN
picture/1.8.1.png


BIN
picture/1.8.2.png


BIN
picture/1.8.3.png


BIN
picture/1.9.1.png


BIN
picture/1.9.2.png


BIN
picture/1ba38d5320c164799c12aadccbf0947.png


BIN
picture/3479e334848bc53e4f256239ef86dab.png


BIN
picture/727abac99348b58b9770c7cf686013d.png


BIN
picture/83008658b69a59c15b0ae7b01af576d.png


BIN
picture/9452e6006f6ee7b1206bc88a32bcc80.png


BIN
picture/9a80057e7397cde5fec5702523c8b26.png


BIN
picture/A.png


BIN
picture/a23b885d56a7213aca980de80445761.png


BIN
picture/b6904cdd1f207afaf729c3453e7fea0.png


BIN
picture/bb83f731438431730d385aa678371c8.png


BIN
picture/c80d30818ed011920c76e1cb61a8445.png


BIN
picture/c8145f1b00316f0e5abe5d19580f3d9.png


BIN
picture/e41a21bc91c726564eada314ce9ede1.png


BIN
picture/ec54a814dfb28c06265f5585f0b805f.png


BIN
picture/fba1036689ff66eda28d9ddcfe9d22b.png


BIN
picture/long1.png


BIN
picture/下标.png


BIN
picture/修剪.png


BIN
picture/偏移.png


BIN
picture/分解.png


BIN
picture/创建.png


BIN
picture/删除.png


BIN
picture/匹配图层.png


BIN
picture/图层特性.png


BIN
picture/圆.png


BIN
picture/圆弧.png


BIN
picture/圆角.png


BIN
picture/基点.png


BIN
picture/复制.png


BIN
picture/多段线.png


BIN
picture/引线.png


BIN
picture/拉伸.png


BIN
picture/插入.png


BIN
picture/文字.png


BIN
picture/旋转.png


BIN
picture/标注.png


BIN
picture/标注1.png


BIN
picture/测量.png


BIN
picture/特性匹配.png


BIN
picture/直线.png


BIN
picture/移动.png


BIN
picture/粘贴.png


BIN
picture/线性、.png


BIN
picture/组.png


BIN
picture/编辑.png


BIN
picture/编辑属性.png


BIN
picture/缩放.png


BIN
picture/置为当前.png


BIN
picture/表格.png


BIN
picture/镜像.png


BIN
picture/阵列.png