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 _ = require("lodash")
var gui = plugin.newGui(plugin.__dirname);
function gen() {
......@@ -70,7 +70,9 @@ r = gui.showForm({
}
},
getter: function (obj, self) {
return obj.allDataMap();
print((Object.keys(obj)));
return obj.selectedRowDataMaps();
// return obj.allDataMap();
}
}
]
......@@ -87,6 +89,22 @@ r = gui.showForm({
"result": "test",
"standard": "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);
function gen() {
this.PAUSE = function () {
console.log("pause");
}
}
gui.setLang("zhcn"); // zhcn, zhtw, en
var 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' }
];
var item_list = [
{ name: "male", icon: "male", text: "男", text_zhcn: "男", text_zhtw: "男" },
{ name: "female", icon: "female", text: "女", text_zhcn: "女", text_zhtw: "女" },
];
r = gui.showForm({
title: "注册账号",
size: [600, 400],
ui: [{
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: 'username',
type: 'LineEdit',
pack: { label: "用户名" },
property: { enabled: true }
},
{
name: 'password',
type: 'LineEdit',
pack: { label: "密码" },
property: { echo_mode: "password" }
},
{
name: 'sex',
type: 'ComboBox',
property: {
enabled: true, 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: '性别' }
},
{
name: 'table',
type: 'TableView',
property: {},
pack: { label: '性别' },
initCallback: function (obj, self) {
obj.setHeaderItem(
[
{},
{ 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.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) {
}
},
title: "BUG#10475",
size: '600x400',
items: {
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: [
{
stock: "help",
sensitive: true,
command: function (data) {
console.log(data);
type: "FormGridLayout",
property: { columns: 1, label_alignment: 'Top | Right', margin: 10, spacing: 20 },
pack: { stretch: 0 },
child: [
{
name: 'username',
type: 'LineEdit',
pack: { label: "用户名" },
property: { enabled: true }
},
{
name: 'password',
type: 'LineEdit',
pack: { label: "密码" },
property: { echo_mode: "password" }
},
{
name: 'sex',
type: 'ComboBox',
property: {
enabled: true, item_list:item_list
},
pack: { label: '性别' }
},
{
name: 'table',
type: 'TableView',
property: {},
pack: { label: '性别' },
initCallback: function (obj, self) {
obj.setHeaderItem(headers);
obj.setDataKeyList(["id", "analysis_item", "analysis_result", "result", "standard", "remark"]);
obj.setPrimaryKey("id");
}
}
]
}
],
hook: function (data) { },
gen: new gen()
]
}
}
});
console.log(r);
\ No newline at end of file
print(JSON.stringify(r, null, ' '));
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 {
var smdInfo;
try {
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) {
console.log("smdInfo:error:"+msg)
console.log("smdInfo:error:"+msg);
}
// bga
console.log("===================================> 7 bga info")
console.log("===================================> 7 bga info");
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数据
save_info.forEach(function(item){
if(JSON.stringify(item)!= "{}" && item){
......@@ -847,21 +847,21 @@ try {
layer: key,
layerinfohash: val
})
})
});
}
})
console.log("================================> 9 copper_percent signal drill")
});
console.log("================================> 9 copper_percent signal drill");
// 分析layer info
var stepList = [pcs_step];
var oChecklistName = "mychecklist";
var signalLayers = analysis_obj.matrixInfo.mSignals.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];
copper_distribution_steplist.forEach(function(step){
if(step){
GEN.openStep({ job: job, name: step })
GEN.openStep({ job: job, name: step });
// 铜面积 分step
var copper_percent_tmp = signalLayers.map(function(v){
var tmp = {layer:v}
......@@ -882,9 +882,9 @@ try {
array_copper_distribution: item.copper_percent
}
}
save_layerinfo(save_info2)
save_layerinfo(save_info2);
})
GEN.closeStep()
GEN.closeStep();
}
})
// var info = {
......@@ -1051,10 +1051,10 @@ try {
drl_pad_top: item.drl_pad_top,
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"})}
......
......@@ -743,7 +743,7 @@ function autoUn(path, dirname, dir) {
fs.mkdir(dirname);
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 {
process.exec('/opt/rar/unrar', ['x' , path, dirname, "-o+"])
}
......
......@@ -113,10 +113,10 @@ try {
if (/yes/ig.test(par.auto_save)) {
GEN.checkInout({ job: job, mode: "out" });
GEN.saveJob({ job: job });
GEN.checkInout({ job: job, mode: "in" });
}
GEN.checkInout({ job: job, mode: "in" });
// 结尾返回 固定写法
// 结尾返回 固定写法
var Return = "Done"
if (mode === "aimdfm") {
IKM.crud("updateRow", {
......@@ -132,7 +132,7 @@ try {
resultData.push(tmperr);
Return = { status: Status, result_data: resultData };
}
return Return
_Return_Label_ = Return
} catch (e) {
if(GEN.STATUS.length > 0) {
IKM.msg(GEN.STATUS.join("\n"));
......@@ -140,5 +140,47 @@ try {
IKM.msg(e);
Status = 'error';
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