Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7acfb89

Browse files
authored
Merge branch 'main' into release
2 parentsbfb5657 +5ca19ee commit7acfb89

File tree

11 files changed

+113
-92
lines changed

11 files changed

+113
-92
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
<divclass="vp-inner-popup-close"title="Close data selector"></div>
99
</div>
1010
<divclass="vp-inner-popup-body vp-scrollbar">
11-
<divclass="vp-grid-col-p50 mb5">
11+
<divclass="vp-grid-col-p50">
1212
<labelclass="vp-bold">Type</label>
1313
<labelclass="vp-bold">Data</label>
1414
</div>
@@ -22,7 +22,7 @@
2222
</div>
2323
<divclass="vp-ds-option-box">
2424
<labelclass="vp-bold">Option Page</label>
25-
<divclass="vp-ds-option-inner-box mt5">
25+
<divclass="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><labelfor="vp_sampleReturn">Allocate to</label></td>
77+
<td><labelfor="vp_sampleReturn"class="vp-orange-text">Allocate to</label></td>
7878
<td><inputtype="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
letparentBlock=null;
479479
letprevBlock=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-
letOptionComponent=require('./'+file);
484+
letOptionComponent=require('./'+menuConfig.file);
485485
if(OptionComponent){
486486
lettaskState=menuState.taskState;
487487
letblockState=menuState.blockState;

‎visualpython/js/com/com_Config.js‎

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ define([
228228
vp_config_version:'1.0.0',
229229
vp_signature:'VisualPython',
230230
vp_position:{},
231-
vp_section_display:false,
231+
// CHROME: default to display vp
232+
vp_section_display:true,
232233
vp_note_display:false,
233234
vp_menu_width:Config.MENU_MIN_WIDTH,
234235
vp_note_width:Config.BOARD_MIN_WIDTH
@@ -506,15 +507,15 @@ define([
506507
that._checkMounted().then(function(){
507508
that._readFromColab(configKey).then(function(result){
508509
letdata=result;
509-
if(data==undefined||(datainstanceofObject&&Object.keys(data).length===0)){
510+
if(data==undefined||data=={}){
510511
resolve(data);
511512
return;
512513
}
513514
if(dataKey==''){
514515
resolve(data);
515516
return;
516517
}
517-
if(datainstanceofObject&&Object.keys(data).length>0){
518+
if(Object.keys(data).length>0){
518519
resolve(data[dataKey]);
519520
return;
520521
}
@@ -530,15 +531,15 @@ define([
530531
// LAB: use local .visualpython files
531532
that._readFromLab(configKey).then(function(result){
532533
letdata=result;
533-
if(data==undefined||(datainstanceofObject&&Object.keys(data).length===0)){
534+
if(data==undefined||data=={}){
534535
resolve(data);
535536
return;
536537
}
537538
if(dataKey==''){
538539
resolve(data);
539540
return;
540541
}
541-
if(datainstanceofObject&&Object.keys(data).length>0){
542+
if(Object.keys(data).length>0){
542543
resolve(data[dataKey]);
543544
return;
544545
}
@@ -800,40 +801,6 @@ define([
800801
returnConfig.version;
801802
}
802803

803-
checkVersionTimestamp=function(){
804-
letthat=this;
805-
// check version timestamp
806-
letnowDate=newDate();
807-
this.getData('version_timestamp','vpcfg').then(function(data){
808-
letdoCheckVersion=false;
809-
vpLog.display(VP_LOG_TYPE.DEVELOP,'Checking its version timestamp... : '+data);
810-
if(data==undefined||(datainstanceofObject&&Object.keys(data).length===0)){
811-
// no timestamp, check version
812-
doCheckVersion=true;
813-
}elseif(data!=''){
814-
letlastCheck=newDate(parseInt(data));
815-
letdiffCheck_now=newDate(nowDate.getFullYear(),nowDate.getMonth()+1,nowDate.getDate());
816-
letdiffCheck_last=newDate(lastCheck.getFullYear(),lastCheck.getMonth()+1,lastCheck.getDate());
817-
818-
letdiff=Math.abs(diffCheck_now.getTime()-diffCheck_last.getTime());
819-
diff=Math.ceil(diff/(1000*3600*24));
820-
821-
if(diff>=1){
822-
// if More than 1 day passed, check version
823-
doCheckVersion=true;
824-
}
825-
}
826-
827-
// check version and update version_timestamp
828-
if(doCheckVersion==true){
829-
that.checkVpVersion(true);
830-
}
831-
832-
}).catch(function(err){
833-
vpLog.display(VP_LOG_TYPE.ERROR,err);
834-
})
835-
}
836-
837804
checkVpVersion(background=false){
838805
letthat=this;
839806
letnowVersion=this.getVpInstalledVersion();
@@ -873,8 +840,6 @@ define([
873840
switch(clickedBtnIdx){
874841
case0:
875842
// cancel
876-
// update version_timestamp
877-
that.setData({'version_timestamp':newDate().getTime()},'vpcfg');
878843
break;
879844
case1:
880845
// update

‎visualpython/js/com/com_generatorV2.js‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,14 @@ define([
137137
package.options&&package.options.forEach(function(o,i){
138138
varobj=JSON.parse(JSON.stringify(o));
139139
letnewTag=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
}

‎visualpython/js/com/component/MultiSelector.js‎

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,62 @@ define([
404404
that._bindItemClickEvent();
405405
});
406406

407+
// item indexing
408+
$(this.wrapSelector('.'+APP_SELECT_ITEM)).on('click',function(event){
409+
vardataIdx=$(this).attr('data-idx');
410+
varidx=$(this).index();
411+
varadded=$(this).hasClass('added');// right side added item?
412+
varselector='';
413+
414+
// remove selection for select box on the other side
415+
if(added){
416+
// remove selection for left side
417+
$(that.wrapSelector('.'+APP_SELECT_ITEM+':not(.added)')).removeClass('selected');
418+
// set selector
419+
selector='.added';
420+
}else{
421+
// remove selection for right(added) side
422+
$(that.wrapSelector('.'+APP_SELECT_ITEM+'.added')).removeClass('selected');
423+
// set selector
424+
selector=':not(.added)';
425+
}
426+
427+
if(vpEvent.keyManager.keyCheck.ctrlKey){
428+
// multi-select
429+
that.pointer={start:idx,end:-1};
430+
$(this).toggleClass('selected');
431+
}elseif(vpEvent.keyManager.keyCheck.shiftKey){
432+
// slicing
433+
varstartIdx=that.pointer.start;
434+
435+
if(startIdx==-1){
436+
// no selection
437+
that.pointer={start:idx,end:-1};
438+
}elseif(startIdx>idx){
439+
// add selection from idx to startIdx
440+
vartags=$(that.wrapSelector('.'+APP_SELECT_ITEM+selector));
441+
for(vari=idx;i<=startIdx;i++){
442+
$(tags[i]).addClass('selected');
443+
}
444+
that.pointer={start:startIdx,end:idx};
445+
}elseif(startIdx<=idx){
446+
// add selection from startIdx to idx
447+
vartags=$(that.wrapSelector('.'+APP_SELECT_ITEM+selector));
448+
for(vari=startIdx;i<=idx;i++){
449+
$(tags[i]).addClass('selected');
450+
}
451+
that.pointer={start:startIdx,end:idx};
452+
}
453+
}else{
454+
// single-select
455+
that.pointer={start:idx,end:-1};
456+
// un-select others
457+
$(that.wrapSelector('.'+APP_SELECT_ITEM+selector)).removeClass('selected');
458+
// select this
459+
$(this).addClass('selected');
460+
}
461+
});
462+
407463
// item indexing - add all
408464
$(this.wrapSelector('.'+APP_SELECT_ADD_ALL_BTN)).on('click',function(event){
409465
$(that.wrapSelector('.'+APP_SELECT_BOX+'.left .'+APP_SELECT_ITEM)).appendTo(
@@ -602,7 +658,6 @@ define([
602658
letnewItemIndex=this.dataList.length;
603659
vartargetTag=$(`<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">
604660
<span>${newItemName}</span>
605-
<div class="vp-cs-del-item vp-icon-close-small" title="Delete this manually added item"></div>
606661
</div>`);
607662
$(targetTag).appendTo(
608663
$(this.wrapSelector('.'+APP_SELECT_BOX+'.right'))
@@ -612,8 +667,6 @@ define([
612667
$(this.wrapSelector('.'+APP_SELECT_ITEM)).removeClass('selected');
613668
// clear item input
614669
$(this.wrapSelector('.vp-cs-add-item-name')).val('');
615-
// bind click event
616-
this._bindItemClickEvent();
617670
// bind draggable
618671
this.bindDraggable();
619672
}

‎visualpython/js/loadVisualpython.js‎

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,38 @@ define([
206206
}
207207
}
208208

209+
var_checkVersion=function(){
210+
// check version timestamp
211+
letnowDate=newDate();
212+
vpConfig.getData('version_timestamp','vpcfg').then(function(data){
213+
letdoCheckVersion=false;
214+
if(data==undefined){
215+
// no timestamp, check version
216+
doCheckVersion=true;
217+
}elseif(data!=''){
218+
letlastCheck=newDate(parseInt(data));
219+
letdiffCheck_now=newDate(nowDate.getFullYear(),nowDate.getMonth()+1,nowDate.getDate());
220+
letdiffCheck_last=newDate(lastCheck.getFullYear(),lastCheck.getMonth()+1,lastCheck.getDate());
221+
222+
letdiff=Math.abs(diffCheck_now.getTime()-diffCheck_last.getTime());
223+
diff=Math.ceil(diff/(1000*3600*24));
224+
225+
if(diff>=1){
226+
// if More than 1 day passed, check version
227+
doCheckVersion=true;
228+
}
229+
}
230+
231+
// check version and update version_timestamp
232+
if(doCheckVersion==true){
233+
vpConfig.checkVpVersion(true);
234+
}
235+
236+
}).catch(function(err){
237+
vpLog.display(VP_LOG_TYPE.ERROR,err);
238+
})
239+
}
240+
209241
//========================================================================
210242
// External call function
211243
//========================================================================
@@ -258,10 +290,9 @@ define([
258290
_addToolBarVpButton();
259291
}
260292
_loadVpResource(cfg);
261-
vpConfig.checkVersionTimestamp();
293+
_checkVersion();
262294

263-
if((cfg.vp_section_display&&vpFrame)
264-
||vpConfig.extensionType==='colab'){// CHROME: default to display vp
295+
if(cfg.vp_section_display&&vpFrame){
265296
vpFrame.openVp();
266297
}
267298

@@ -288,13 +319,11 @@ define([
288319
if(newValue.sessionContext.isReady){
289320
vpLog.display(VP_LOG_TYPE.LOG,'vp operations for kernel ready...');
290321
vpConfig.readKernelFunction();
291-
vpConfig.checkVersionTimestamp();
292322
}
293323
newValue.sessionContext._connectionStatusChanged.connect(function(s2,status){
294324
if(status==='connected'){
295325
vpLog.display(VP_LOG_TYPE.LOG,'vp operations for kernel ready...');
296326
vpConfig.readKernelFunction();
297-
vpConfig.checkVersionTimestamp();
298327
}
299328
});
300329
}else{

‎visualpython/js/m_apps/File.js‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ define([
2222
'vp_base/js/com/com_generatorV2',
2323
'vp_base/data/m_library/pandasLibrary',
2424
'vp_base/js/com/component/FileNavigation',
25-
'vp_base/js/com/component/SuggestInput',
26-
'vp_base/js/com/component/DataSelector'
25+
'vp_base/js/com/component/SuggestInput'
2726
],function(fileHtml,fileCss,com_String,com_util,com_Const,PopupComponent
28-
,pdGen,pandasLibrary,FileNavigation,SuggestInput,DataSelector){
27+
,pdGen,pandasLibrary,FileNavigation,SuggestInput){
2928

3029
/**
3130
* File
@@ -303,14 +302,7 @@ define([
303302

304303
templateForBody(){
305304
/** Implement generating template */
306-
letpage=$(fileHtml);
307-
308-
letallocateSelector=newDataSelector({
309-
pageThis:this,id:'vp_sampleReturn',placeholder:'Variable name'
310-
});
311-
$(page).find('#vp_sampleReturn').replaceWith(allocateSelector.toTagString());
312-
313-
returnpage;
305+
returnfileHtml;
314306
}
315307

316308
renderPage(pageType){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp