Skip to content

Commit 54f1b3e

Browse files
authored
Merge branch 'main' into release
2 parents 0a0966b + d648b1d commit 54f1b3e

File tree

12 files changed

+114
-163
lines changed

12 files changed

+114
-163
lines changed

visualpython/css/component/multiSelector.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,4 @@
8080
left: calc(100% - 25px);
8181
bottom: 23px;
8282
cursor: pointer;
83-
}
84-
.vp-cs-del-item {
85-
position: relative;
86-
float: right;
87-
top: 4px;
88-
cursor: pointer;
8983
}

visualpython/css/m_ml/modelInfo.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.vp-model-select-box {
2-
grid-column-gap: 5px;
3-
align-items: start;
4-
}
51
.vp-ins-select-title {
62
font-weight: bold;
73
color: var(--vp-font-highlight);

visualpython/html/component/dataSelector.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div class="vp-inner-popup-close" title="Close data selector"></div>
99
</div>
1010
<div class="vp-inner-popup-body vp-scrollbar">
11-
<div class="vp-grid-col-p50 mb5">
11+
<div class="vp-grid-col-p50">
1212
<label class="vp-bold">Type</label>
1313
<label class="vp-bold">Data</label>
1414
</div>
@@ -22,7 +22,7 @@
2222
</div>
2323
<div class="vp-ds-option-box">
2424
<label class="vp-bold">Option Page</label>
25-
<div class="vp-ds-option-inner-box mt5">
25+
<div class="vp-ds-option-inner-box">
2626

2727
</div>
2828
</div>

visualpython/html/m_apps/file.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
</td>
7575
</tr>
7676
<tr>
77-
<td><label for="vp_sampleReturn">Allocate to</label></td>
77+
<td><label for="vp_sampleReturn" class="vp-orange-text">Allocate to</label></td>
7878
<td><input type="text" class="vp-input input-single" id="vp_sampleReturn" placeholder="" value="" title=""></td>
7979
</tr>
8080
</tbody>

visualpython/js/MainFrame.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,10 @@ define([
478478
let parentBlock = null;
479479
let prevBlock = null;
480480
loadStateList.forEach(obj => {
481-
let { file, blockType, menuId, menuState, menuConfig, argIdx, position, afterAction } = obj;
481+
let { blockType, menuId, menuState, menuConfig, argIdx, position, afterAction } = obj;
482482
// get OptionComponent Object
483483
// LAB: relative path needed
484-
let OptionComponent = require('./' + file);
484+
let OptionComponent = require('./' + menuConfig.file);
485485
if (OptionComponent) {
486486
let taskState = menuState.taskState;
487487
let blockState = menuState.blockState;

visualpython/js/com/com_Config.js

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ define([
216216
vp_config_version: '1.0.0',
217217
vp_signature: 'VisualPython',
218218
vp_position: {},
219-
vp_section_display: false,
219+
// CHROME: default to display vp
220+
vp_section_display: true,
220221
vp_note_display: false,
221222
vp_menu_width: Config.MENU_MIN_WIDTH,
222223
vp_note_width: Config.BOARD_MIN_WIDTH
@@ -492,15 +493,15 @@ define([
492493
that._checkMounted().then(function() {
493494
that._readFromColab(configKey).then(function(result) {
494495
let data = result;
495-
if (data == undefined || (data instanceof Object && Object.keys(data).length === 0)) {
496+
if (data == undefined || data == {}) {
496497
resolve(data);
497498
return;
498499
}
499500
if (dataKey == '') {
500501
resolve(data);
501502
return;
502503
}
503-
if (data instanceof Object && Object.keys(data).length > 0) {
504+
if (Object.keys(data).length > 0) {
504505
resolve(data[dataKey]);
505506
return;
506507
}
@@ -516,15 +517,15 @@ define([
516517
// LAB: use local .visualpython files
517518
that._readFromLab(configKey).then(function(result) {
518519
let data = result;
519-
if (data == undefined || (data instanceof Object && Object.keys(data).length === 0)) {
520+
if (data == undefined || data == {}) {
520521
resolve(data);
521522
return;
522523
}
523524
if (dataKey == '') {
524525
resolve(data);
525526
return;
526527
}
527-
if (data instanceof Object && Object.keys(data).length > 0) {
528+
if (Object.keys(data).length > 0) {
528529
resolve(data[dataKey]);
529530
return;
530531
}
@@ -786,40 +787,6 @@ define([
786787
return Config.version;
787788
}
788789

789-
checkVersionTimestamp = function() {
790-
let that = this;
791-
// check version timestamp
792-
let nowDate = new Date();
793-
this.getData('version_timestamp', 'vpcfg').then(function(data) {
794-
let doCheckVersion = false;
795-
vpLog.display(VP_LOG_TYPE.DEVELOP, 'Checking its version timestamp... : ' + data);
796-
if (data == undefined || (data instanceof Object && Object.keys(data).length === 0)) {
797-
// no timestamp, check version
798-
doCheckVersion = true;
799-
} else if (data != '') {
800-
let lastCheck = new Date(parseInt(data));
801-
let diffCheck_now = new Date(nowDate.getFullYear(), nowDate.getMonth() + 1, nowDate.getDate());
802-
let diffCheck_last = new Date(lastCheck.getFullYear(), lastCheck.getMonth() + 1, lastCheck.getDate());
803-
804-
let diff = Math.abs(diffCheck_now.getTime() - diffCheck_last.getTime());
805-
diff = Math.ceil(diff / (1000 * 3600 * 24));
806-
807-
if (diff >= 1) {
808-
// if More than 1 day passed, check version
809-
doCheckVersion = true;
810-
}
811-
}
812-
813-
// check version and update version_timestamp
814-
if (doCheckVersion == true) {
815-
that.checkVpVersion(true);
816-
}
817-
818-
}).catch(function(err) {
819-
vpLog.display(VP_LOG_TYPE.ERROR, err);
820-
})
821-
}
822-
823790
checkVpVersion(background=false) {
824791
let that = this;
825792
let nowVersion = this.getVpInstalledVersion();
@@ -859,8 +826,6 @@ define([
859826
switch (clickedBtnIdx) {
860827
case 0:
861828
// cancel
862-
// update version_timestamp
863-
that.setData({ 'version_timestamp': new Date().getTime() }, 'vpcfg');
864829
break;
865830
case 1:
866831
// update

visualpython/js/com/com_generatorV2.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,14 @@ define([
137137
package.options && package.options.forEach(function(o, i) {
138138
var obj = JSON.parse(JSON.stringify(o));
139139
let newTag = vp_createTag(pageThis, obj, state);
140-
if (obj.required === true || obj.output === true) {
140+
if (obj.required) {
141141
tblInput.append(newTag);
142142
} else {
143143
tblOption.append(newTag);
144144
}
145145
});
146146

147147
// TODO: userOption
148-
if (package.code.includes('${etc}')) {
149-
150-
}
151148

152149
bindAutoComponentEvent(pageThis);
153150
}
@@ -169,7 +166,7 @@ define([
169166
let value = state[name];
170167

171168
var requiredFontStyle = required == true? 'vp-orange-text' : '';
172-
var lblTag = $(`<label class="vp-bold">${label}</label>`).attr({
169+
var lblTag = $(`<label>${label}</label>`).attr({
173170
'for': name,
174171
'class': requiredFontStyle,
175172
'title': '(' + name + ')'

visualpython/js/com/component/MultiSelector.js

Lines changed: 56 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,62 @@ define([
380380
that.bindDraggable();
381381
});
382382

383+
// item indexing
384+
$(this.wrapSelector('.' + APP_SELECT_ITEM)).on('click', function(event) {
385+
var dataIdx = $(this).attr('data-idx');
386+
var idx = $(this).index();
387+
var added = $(this).hasClass('added'); // right side added item?
388+
var selector = '';
389+
390+
// remove selection for select box on the other side
391+
if (added) {
392+
// remove selection for left side
393+
$(that.wrapSelector('.' + APP_SELECT_ITEM + ':not(.added)')).removeClass('selected');
394+
// set selector
395+
selector = '.added';
396+
} else {
397+
// remove selection for right(added) side
398+
$(that.wrapSelector('.' + APP_SELECT_ITEM + '.added')).removeClass('selected');
399+
// set selector
400+
selector = ':not(.added)';
401+
}
402+
403+
if (vpEvent.keyManager.keyCheck.ctrlKey) {
404+
// multi-select
405+
that.pointer = { start: idx, end: -1 };
406+
$(this).toggleClass('selected');
407+
} else if (vpEvent.keyManager.keyCheck.shiftKey) {
408+
// slicing
409+
var startIdx = that.pointer.start;
410+
411+
if (startIdx == -1) {
412+
// no selection
413+
that.pointer = { start: idx, end: -1 };
414+
} else if (startIdx > idx) {
415+
// add selection from idx to startIdx
416+
var tags = $(that.wrapSelector('.' + APP_SELECT_ITEM + selector));
417+
for (var i = idx; i <= startIdx; i++) {
418+
$(tags[i]).addClass('selected');
419+
}
420+
that.pointer = { start: startIdx, end: idx };
421+
} else if (startIdx <= idx) {
422+
// add selection from startIdx to idx
423+
var tags = $(that.wrapSelector('.' + APP_SELECT_ITEM + selector));
424+
for (var i = startIdx; i <= idx; i++) {
425+
$(tags[i]).addClass('selected');
426+
}
427+
that.pointer = { start: startIdx, end: idx };
428+
}
429+
} else {
430+
// single-select
431+
that.pointer = { start: idx, end: -1 };
432+
// un-select others
433+
$(that.wrapSelector('.' + APP_SELECT_ITEM + selector)).removeClass('selected');
434+
// select this
435+
$(this).addClass('selected');
436+
}
437+
});
438+
383439
// item indexing - add all
384440
$(this.wrapSelector('.' + APP_SELECT_ADD_ALL_BTN)).on('click', function(event) {
385441
$(that.wrapSelector('.' + APP_SELECT_BOX + '.left .' + APP_SELECT_ITEM)).appendTo(
@@ -454,75 +510,6 @@ define([
454510
that._addNewItem(newItemName);
455511
}
456512
});
457-
458-
this._bindItemClickEvent();
459-
}
460-
461-
_bindItemClickEvent() {
462-
let that = this;
463-
// item indexing
464-
$(this.wrapSelector('.' + APP_SELECT_ITEM)).off('click');
465-
$(this.wrapSelector('.' + APP_SELECT_ITEM)).on('click', function(event) {
466-
var dataIdx = $(this).attr('data-idx');
467-
var idx = $(this).index();
468-
var added = $(this).hasClass('added'); // right side added item?
469-
var selector = '';
470-
471-
// remove selection for select box on the other side
472-
if (added) {
473-
// remove selection for left side
474-
$(that.wrapSelector('.' + APP_SELECT_ITEM + ':not(.added)')).removeClass('selected');
475-
// set selector
476-
selector = '.added';
477-
} else {
478-
// remove selection for right(added) side
479-
$(that.wrapSelector('.' + APP_SELECT_ITEM + '.added')).removeClass('selected');
480-
// set selector
481-
selector = ':not(.added)';
482-
}
483-
484-
if (vpEvent.keyManager.keyCheck.ctrlKey) {
485-
// multi-select
486-
that.pointer = { start: idx, end: -1 };
487-
$(this).toggleClass('selected');
488-
} else if (vpEvent.keyManager.keyCheck.shiftKey) {
489-
// slicing
490-
var startIdx = that.pointer.start;
491-
492-
if (startIdx == -1) {
493-
// no selection
494-
that.pointer = { start: idx, end: -1 };
495-
} else if (startIdx > idx) {
496-
// add selection from idx to startIdx
497-
var tags = $(that.wrapSelector('.' + APP_SELECT_ITEM + selector));
498-
for (var i = idx; i <= startIdx; i++) {
499-
$(tags[i]).addClass('selected');
500-
}
501-
that.pointer = { start: startIdx, end: idx };
502-
} else if (startIdx <= idx) {
503-
// add selection from startIdx to idx
504-
var tags = $(that.wrapSelector('.' + APP_SELECT_ITEM + selector));
505-
for (var i = startIdx; i <= idx; i++) {
506-
$(tags[i]).addClass('selected');
507-
}
508-
that.pointer = { start: startIdx, end: idx };
509-
}
510-
} else {
511-
// single-select
512-
that.pointer = { start: idx, end: -1 };
513-
// un-select others
514-
$(that.wrapSelector('.' + APP_SELECT_ITEM + selector)).removeClass('selected');
515-
// select this
516-
$(this).addClass('selected');
517-
}
518-
});
519-
520-
// item deleting (manually added item only)
521-
$(this.wrapSelector('.vp-cs-del-item')).off('click');
522-
$(this.wrapSelector('.vp-cs-del-item')).on('click', function(event) {
523-
$(this).closest('.' + APP_SELECT_ITEM).remove();
524-
that.pointer = { start: -1, end: -1 };
525-
});
526513
}
527514

528515
_addNewItem(newItemName) {
@@ -564,7 +551,6 @@ define([
564551
let newItemIndex = this.dataList.length;
565552
var targetTag = $(`<div class="${APP_SELECT_ITEM} ${APP_DRAGGABLE} added selected" data-idx="${newItemIndex}" data-name="${newItemName}" data-type="object" data-code="'${newItemName}'" title="${newItemName}: Added manually">
566553
<span>${newItemName}</span>
567-
<div class="vp-cs-del-item vp-icon-close-small" title="Delete this manually added item"></div>
568554
</div>`);
569555
$(targetTag).appendTo(
570556
$(this.wrapSelector('.' + APP_SELECT_BOX + '.right'))
@@ -574,8 +560,6 @@ define([
574560
$(this.wrapSelector('.' + APP_SELECT_ITEM)).removeClass('selected');
575561
// clear item input
576562
$(this.wrapSelector('.vp-cs-add-item-name')).val('');
577-
// bind click event
578-
this._bindItemClickEvent();
579563
// bind draggable
580564
this.bindDraggable();
581565
}

visualpython/js/com/component/PopupComponent.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ define([
9696
this.name = name;
9797
this.path = path;
9898
this.category = category;
99-
10099

101100
this.config = {
102101
sizeLevel: 0, // 0: 400x400 / 1: 500x500 / 2: 600x500 / 3: 750x500

0 commit comments

Comments
 (0)