Commit b75a5031 authored by Scott Sun's avatar Scott Sun

Merge branch 'master' of http://gitlab.topibd.net/scott.sun/scott

parents b15c9eb9 56f01551
This diff is collapsed.
This diff is collapsed.
var plugin = require('topsin.gengui'); var plugin = require('topsin.gengui');
var _ = require("lodash")
var gui = plugin.newGui(plugin.__dirname); var gui = plugin.newGui(plugin.__dirname);
function gen() { function gen() {
...@@ -70,7 +70,9 @@ r = gui.showForm({ ...@@ -70,7 +70,9 @@ r = gui.showForm({
} }
}, },
getter: function (obj, self) { getter: function (obj, self) {
return obj.allDataMap(); print((Object.keys(obj)));
return obj.selectedRowDataMaps();
// return obj.allDataMap();
} }
} }
] ]
...@@ -87,6 +89,22 @@ r = gui.showForm({ ...@@ -87,6 +89,22 @@ r = gui.showForm({
"result": "test", "result": "test",
"standard": "test", "standard": "test",
"remark": "test" "remark": "test"
},
{
"id": 2,
"analysis_item": "test2",
"analysis_result": "test2",
"result": "test2",
"standard": "test2",
"remark": "test2"
},
{
"id": 3,
"analysis_item": "test3",
"analysis_result": "test3",
"result": "test3",
"standard": "test3",
"remark": "test3"
} }
] ]
}, },
......
ar plugin = require('topsin.gengui'); var plugin = require('topsin.gengui');
var gui = plugin.newGui(plugin.__dirname); var gui = plugin.newGui(plugin.__dirname);
function gen() { var headers = [
this.PAUSE = function () { {},
console.log("pause"); { name: 'analysis_item', display: 'Analysis Item', resizeMode: 'ResizeToContents', displayRole: '$analysis_item' },
} { name: 'analysis_result', display: 'Analysis Result', resizeMode: 'ResizeToContents', displayRole: '$analysis_result' },
} { name: 'result', display: 'Result', resizeMode: 'ResizeToContents', displayRole: '$result' },
{ name: 'standard', display: 'Standard', resizeMode: 'ResizeToContents', displayRole: '$standard' },
gui.setLang("zhcn"); // zhcn, zhtw, en { name: 'remark', display: 'Remark', resizeMode: 'ResizeToContents', displayRole: '$remark', editRole: '$remark', flagsRole: 'ItemIsEditable|ItemIsEnabled|ItemIsSelectable' }
];
var item_list = [
{ name: "male", icon: "male", text: "男", text_zhcn: "男", text_zhtw: "男" },
{ name: "female", icon: "female", text: "女", text_zhcn: "女", text_zhtw: "女" },
];
r = gui.showForm({ r = gui.showForm({
title: "注册账号", title: "BUG#10475",
size: [600, 400], size: '600x400',
ui: [{ items: {
type: 'ScrollArea', type: 'ScrollArea',
property: { widget_resizable: true, frame_shape: 'NoFrame', align: 'Top' }, property: { widget_resizable: true, frame_shape: 'NoFrame', align: 'Top' },
child: { child: {
...@@ -42,11 +45,7 @@ r = gui.showForm({ ...@@ -42,11 +45,7 @@ r = gui.showForm({
name: 'sex', name: 'sex',
type: 'ComboBox', type: 'ComboBox',
property: { property: {
enabled: true, item_list: [ enabled: true, item_list:item_list
{ name: "male", icon: "male", text: "男", text_zhcn: "男", text_zhtw: "男" },
{ name: "female", icon: "female", text: "女", text_zhcn: "女", text_zhtw: "女" },
{ name: "hideyoshi", icon: "circle-thin", text: "Hideyoshi", text_zhcn: "秀吉", text_tw: "秀吉" }
]
}, },
pack: { label: '性别' } pack: { label: '性别' }
}, },
...@@ -56,63 +55,16 @@ r = gui.showForm({ ...@@ -56,63 +55,16 @@ r = gui.showForm({
property: {}, property: {},
pack: { label: '性别' }, pack: { label: '性别' },
initCallback: function (obj, self) { initCallback: function (obj, self) {
obj.setHeaderItem( obj.setHeaderItem(headers);
[
{},
{ name: 'analysis_item', display: 'Analysis Item', resizeMode: 'ResizeToContents', displayRole: '$analysis_item' },
{ name: 'analysis_result', display: 'Analysis Result', resizeMode: 'ResizeToContents', displayRole: '$analysis_result' },
{ name: 'result', display: 'Result', resizeMode: 'ResizeToContents', displayRole: '$result' },
{ name: 'standard', display: 'Standard', resizeMode: 'ResizeToContents', displayRole: '$standard' },
{ name: 'remark', display: 'Remark', resizeMode: 'ResizeToContents', displayRole: '$remark', editRole: '$remark', flagsRole: 'ItemIsEditable|ItemIsEnabled|ItemIsSelectable' }
]
);
obj.setDataKeyList(["id", "analysis_item", "analysis_result", "result", "standard", "remark"]); obj.setDataKeyList(["id", "analysis_item", "analysis_result", "result", "standard", "remark"]);
obj.setPrimaryKey("id"); obj.setPrimaryKey("id");
},
setter: function (obj, value, self) {
if (value != null) {
obj.loadData(value);
} else {
obj.clearData();
}
} }
} }
] ]
} }
] ]
} }
}],
data: {
username: "elder",
password: "nαive!",
sex: "male"
},
includehide: false,
buttons: [
{
stock: "ok",
sensitive: true,
command: function (data) {
}
},
{
stock: "cancel",
sensitive: true,
command: function (ddata) {
}
},
{
stock: "help",
sensitive: true,
command: function (data) {
console.log(data);
}
} }
],
hook: function (data) { },
gen: new gen()
}); });
console.log(r); print(JSON.stringify(r, null, ' '));
\ No newline at end of file
var plugin = require('topsin.gengui');
var gui = plugin.newGui(plugin.__dirname);
var data = [{
name: "123",
text: 123
}]
gui._extra = [{name:13, text:23}]
var r = gui.showForm({
title: "注册账号",
size: [600, 400],
ui: function (self) {
return [{
type: 'ScrollArea',
property: {
widget_resizable: true,
frame_shape: 'NoFrame',
align: 'Top'
},
child: {
type: 'VBoxLayout',
property: {
margin: 2,
spacing: 20,
align: 'Top'
},
pack: {
stretch: 0
},
child: [{
type: "FormGridLayout",
property: {
columns: 1,
label_alignment: 'Top | Right',
margin: 10,
spacing: 20
},
pack: {
stretch: 0
},
child: [{
name: 'test',
type: 'ComboBox',
pack: {
label: "用户名"
},
property: {
enabled: true,
item_list: self._extra
}
}]
}]
}
}]
} ,
data: {},
includehide: false,
buttons: [{
stock: "ok",
sensitive: true,
command: function (data) {
}
},
{
stock: "cancel",
sensitive: true,
command: function (data) {
}
},
{
stock: "help",
sensitive: true,
command: function (data) {
console.log(data);
}
}
],
});
console.log(r);
\ No newline at end of file
...@@ -827,16 +827,16 @@ try { ...@@ -827,16 +827,16 @@ try {
var smdInfo; var smdInfo;
try { try {
if(!analysis_obj.matrixInfo.mOuters[0].solderL){throw "no mask"} if(!analysis_obj.matrixInfo.mOuters[0].solderL){throw "no mask"}
smdInfo = smdAnalysis({job:job,steplist:[pcs_step],layers:analysis_obj.matrixInfo.mOuters,attr:".smd"}) smdInfo = smdAnalysis({job:job,steplist:[pcs_step],layers:analysis_obj.matrixInfo.mOuters,attr:".smd"});
} catch (msg) { } catch (msg) {
console.log("smdInfo:error:"+msg) console.log("smdInfo:error:"+msg);
} }
// bga // bga
console.log("===================================> 7 bga info") console.log("===================================> 7 bga info");
var bgaInfo; var bgaInfo;
bgaInfo = bgaAnalysis({job:job,steplist:[pcs_step],layers:analysis_obj.matrixInfo.mOuters,attr:".bga"}) bgaInfo = bgaAnalysis({job:job,steplist:[pcs_step],layers:analysis_obj.matrixInfo.mOuters,attr:".bga"});
// 保存 // 保存
console.log("============== =====================> 8 save bga smd info") console.log("============== =====================> 8 save bga smd info");
var save_info = [smdInfo, analysis_obj.jobInfo.laser_info,bgaInfo]; // 保存 smd 和 bga数据 var save_info = [smdInfo, analysis_obj.jobInfo.laser_info,bgaInfo]; // 保存 smd 和 bga数据
save_info.forEach(function(item){ save_info.forEach(function(item){
if(JSON.stringify(item)!= "{}" && item){ if(JSON.stringify(item)!= "{}" && item){
...@@ -847,21 +847,21 @@ try { ...@@ -847,21 +847,21 @@ try {
layer: key, layer: key,
layerinfohash: val layerinfohash: val
}) })
}) });
} }
}) });
console.log("================================> 9 copper_percent signal drill") console.log("================================> 9 copper_percent signal drill");
// 分析layer info // 分析layer info
var stepList = [pcs_step]; var stepList = [pcs_step];
var oChecklistName = "mychecklist"; var oChecklistName = "mychecklist";
var signalLayers = analysis_obj.matrixInfo.mSignals.map(function(v){return v.name}); var signalLayers = analysis_obj.matrixInfo.mSignals.map(function(v){return v.name});
var drillLayers = analysis_obj.matrixInfo.mDrills.map(function(v){return v.name}); var drillLayers = analysis_obj.matrixInfo.mDrills.map(function(v){return v.name});
console.log("=============================> 13 save copperArea copper_distribution") console.log("=============================> 13 save copperArea copper_distribution");
var copper_distribution_steplist= [pcs_step, array_step]; var copper_distribution_steplist= [pcs_step, array_step];
copper_distribution_steplist.forEach(function(step){ copper_distribution_steplist.forEach(function(step){
if(step){ if(step){
GEN.openStep({ job: job, name: step }) GEN.openStep({ job: job, name: step });
// 铜面积 分step // 铜面积 分step
var copper_percent_tmp = signalLayers.map(function(v){ var copper_percent_tmp = signalLayers.map(function(v){
var tmp = {layer:v} var tmp = {layer:v}
...@@ -882,9 +882,9 @@ try { ...@@ -882,9 +882,9 @@ try {
array_copper_distribution: item.copper_percent array_copper_distribution: item.copper_percent
} }
} }
save_layerinfo(save_info2) save_layerinfo(save_info2);
}) })
GEN.closeStep() GEN.closeStep();
} }
}) })
// var info = { // var info = {
...@@ -1051,10 +1051,10 @@ try { ...@@ -1051,10 +1051,10 @@ try {
drl_pad_top: item.drl_pad_top, drl_pad_top: item.drl_pad_top,
drl_pad_bot: item.drl_pad_bot, drl_pad_bot: item.drl_pad_bot,
} }
}) });
}) });
console.log("==================================> chk signals analysis") console.log("==================================> chk signals analysis");
// 删除线路层的外形线 // 删除线路层的外形线
if(GEN.isLayerExists({job:job, layer:"out_rout"})){GEN.deleteLayer({job:job, layer:"out_rout"})} if(GEN.isLayerExists({job:job, layer:"out_rout"})){GEN.deleteLayer({job:job, layer:"out_rout"})}
......
...@@ -743,7 +743,7 @@ function autoUn(path, dirname, dir) { ...@@ -743,7 +743,7 @@ function autoUn(path, dirname, dir) {
fs.mkdir(dirname); fs.mkdir(dirname);
if(pwd){ if(pwd){
process.exec('/opt/rar/unrar', ['x' , path, dirname, "-o+","-p"+pwd]) process.exec('/opt/rar/unrar', ['x' , path, dirname, "-o+","-p"+pwd]);
} else { } else {
process.exec('/opt/rar/unrar', ['x' , path, dirname, "-o+"]) process.exec('/opt/rar/unrar', ['x' , path, dirname, "-o+"])
} }
......
...@@ -113,8 +113,8 @@ try { ...@@ -113,8 +113,8 @@ try {
if (/yes/ig.test(par.auto_save)) { if (/yes/ig.test(par.auto_save)) {
GEN.checkInout({ job: job, mode: "out" }); GEN.checkInout({ job: job, mode: "out" });
GEN.saveJob({ job: job }); GEN.saveJob({ job: job });
}
GEN.checkInout({ job: job, mode: "in" }); GEN.checkInout({ job: job, mode: "in" });
}
// 结尾返回 固定写法 // 结尾返回 固定写法
var Return = "Done" var Return = "Done"
...@@ -132,7 +132,7 @@ try { ...@@ -132,7 +132,7 @@ try {
resultData.push(tmperr); resultData.push(tmperr);
Return = { status: Status, result_data: resultData }; Return = { status: Status, result_data: resultData };
} }
return Return _Return_Label_ = Return
} catch (e) { } catch (e) {
if(GEN.STATUS.length > 0) { if(GEN.STATUS.length > 0) {
IKM.msg(GEN.STATUS.join("\n")); IKM.msg(GEN.STATUS.join("\n"));
...@@ -140,5 +140,47 @@ try { ...@@ -140,5 +140,47 @@ try {
IKM.msg(e); IKM.msg(e);
Status = 'error'; Status = 'error';
resultData.push({ type: "error", title: "脚本执行出错!", detail: [{ desc: _.toString(e) }] }); resultData.push({ type: "error", title: "脚本执行出错!", detail: [{ desc: _.toString(e) }] });
return (mode === "aimdfm") ? { status: Status, result_data: resultData } : "Error"; _Return_Label_ = (mode === "aimdfm") ? { status: Status, result_data: resultData } : "Error";
}
<<<<<<< HEAD
=======
/**
* 获取层别
* @param {Object} 过滤选项
* @returns {Array}
*/
function getLayer(props) {
if (!props) {
props = {};
}
var matrix = GEN.getMatrix({ job: job });
return Object.keys(matrix).reduce(function (a, b) {
var info = matrix[b];
var ret = true;
for (var _key in props) {
if (info[_key]) {
if (/object string|object number/ig.test({}.toString.call(props[_key]))) {
if (props[_key] != info[_key]) {
ret = false;
}
}
if (/object RegExp/ig.test({}.toString.call(props[_key]))) {
if (!props[_key].test(info[_key])) {
ret = false;
}
}
if (/object function/ig.test({}.toString.call(props[_key]))) {
if (!props[_key](info[_key])) {
ret = false;
}
}
}
}
if (ret) {
a.push(props.res == "info" ? info : b);
}
return a;
}, []);
} }
>>>>>>> 56f0155198c943a1cde2a6cd9d5b958e8b6f736c
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment