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

Commit5844de4

Browse files
author
minjk-bl
committed
Add selecting execution type on app running
1 parentd84b7c8 commit5844de4

File tree

3 files changed

+96
-8
lines changed

3 files changed

+96
-8
lines changed

‎visualpython/css/component/popupComponent.css‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,14 @@
222222
margin-top:9px;
223223
margin-right:10px;
224224
}
225-
.vp-popup-button[data-type="run"] {
225+
.vp-popup-run-button {
226226
display: inline-block;
227227
width:60px;
228228
min-width:60px;
229229
border-radius:3px0px0px3px;
230230
border-right:0.25px solid white!important;
231231
}
232-
.vp-popup-button[data-type="show-detail"] {
232+
.vp-popup-button.vp-popup-show-detail-button {
233233
display: inline-block;
234234
width:20px;
235235
min-width:20px;
@@ -251,11 +251,23 @@
251251
}
252252
.vp-popup-detail-button {
253253
color:var(--vp-font-primary);
254+
display: grid;
255+
grid-template-columns:25pxcalc(100%-25px);
254256
}
255257
.vp-popup-detail-button:hover {
256258
color:var(--vp-font-highlight);
257259
background:var(--vp-light-gray-color);
258260
}
261+
.vp-popup-detail-button>label {
262+
border-right:0.25px solidvar(--vp-border-gray-color);
263+
margin:0;
264+
padding-left:5px;
265+
}
266+
.vp-popup-detail-button> .vp-popup-detail-action-button {
267+
text-align: left;
268+
line-height:35px;
269+
padding-left:5px;
270+
}
259271
.vp-popup-save-button {
260272
float: right;
261273
height:30px;

‎visualpython/html/component/popupComponent.html‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,26 @@
105105
<buttontype="button"class="vp-button vp-popup-button"data-type="help">Help</button>
106106

107107
<divclass="vp-popup-runadd-box">
108-
<buttontype="button"class="vp-button activated vp-popup-button"data-type="run"title="Save to block &Runcell">Run</button>
109-
<buttontype="button"class="vp-button activated vp-popup-button"data-type="show-detail">
108+
<buttontype="button"class="vp-button activated vp-popup-button vp-popup-run-button"data-type="run"title="Runcode">Run</button>
109+
<buttontype="button"class="vp-button activated vp-popup-button vp-popup-show-detail-button"data-type="show-detail">
110110
<!-- LAB: img to url -->
111111
<!-- <img src="${vp_base}/img/arrow_short_up.svg"/> -->
112112
<divclass="vp-icon-arrow-short-up"></div>
113113
</button>
114114
<divclass="vp-popup-run-detailbox vp-cursor vp-close-on-blur">
115115
<!-- <div class="vp-popup-detail-button" data-type="apply" title="Save to block">Save to block</div> -->
116-
<divclass="vp-popup-detail-button"data-type="run-save"title="Save to block & Run code">Run & Save</div>
117-
<divclass="vp-popup-detail-button"data-type="add"title="Add code to cell">Code to cell</div>
116+
<divclass="vp-popup-detail-button"title="Run code">
117+
<label><inputtype="radio"class="vp-popup-run-type"name="runType"value="run"checked/><span></span></label>
118+
<spanclass="vp-popup-detail-action-button"data-type="run">Run</span>
119+
</div>
120+
<divclass="vp-popup-detail-button"title="Save to block & Run code">
121+
<label><inputtype="radio"class="vp-popup-run-type"name="runType"value="run-save"/><span></span></label>
122+
<spanclass="vp-popup-detail-action-button"data-type="run-save">Run & Save</span>
123+
</div>
124+
<divclass="vp-popup-detail-button"title="Add code to cell">
125+
<label><inputtype="radio"class="vp-popup-run-type"name="runType"value="add"/><span></span></label>
126+
<spanclass="vp-popup-detail-action-button"data-type="add">Code to cell</span>
127+
</div>
118128
</div>
119129
</div>
120130
<buttontype="button"class="vp-button activated vp-popup-button vp-popup-save-button"data-type="save"title="Save to target"style="display:none;">OK</button>

‎visualpython/js/com/component/PopupComponent.js‎

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ define([
9999
this.category=category;
100100

101101
this.config={
102-
sizeLevel:0,// 0: 400x400 / 1: 500x500 / 2: 600x500 / 3: 750x500
102+
sizeLevel:0,// 0: 400x400 / 1: 500x500 / 2: 600x500 / 3: 750x500 / 4:
103103
executeMode:'code',// cell execute mode
104104
// show header bar buttons
105105
installButton:false,// install button (#popupInstall) // FIXME: after creating packagemanager, deprecate it
@@ -112,6 +112,8 @@ define([
112112
// show footer
113113
runButton:true,
114114
footer:true,
115+
// run type : run / run-save / add
116+
runType:'run',
115117
// position and size
116118
position:{right:10,top:120},
117119
size:{width:400,height:550},
@@ -487,15 +489,53 @@ define([
487489
case'save':
488490
that.save();
489491
break;
492+
case'run-save':
493+
varresult=that.run();
494+
if(result){
495+
that.save();
496+
}
497+
break;
498+
case'add':
499+
varresult=that.run(false);
500+
if(result){
501+
// that.save();
502+
that.close();
503+
}
504+
break;
505+
}
506+
});
507+
// Click detail radio
508+
$(this.wrapSelector('.vp-popup-run-type')).on('click',function(evt){
509+
letrunType=$(that.wrapSelector('.vp-popup-run-type[name=runType]:checked')).val();
510+
that.config.runType=runType;
511+
// save as vpConfig
512+
vpConfig.setData({runType:runType},'vpcfg');
513+
$(that.wrapSelector('.vp-popup-run-button')).attr('data-type',runType);
514+
letrunTitle='Run code';
515+
switch(runType){
516+
case'run-save':
517+
runTitle='Save to block & Run code';
518+
break;
519+
case'add':
520+
runTitle='Add code to cell';
521+
break;
490522
}
523+
$(that.wrapSelector('.vp-popup-run-button')).prop('title',runTitle);
491524
});
492525
// Click detail buttons
493-
$(this.wrapSelector('.vp-popup-detail-button')).on('click',function(evt){
526+
$(this.wrapSelector('.vp-popup-detail-action-button')).on('click',function(evt){
494527
varbtnType=$(this).data('type');
495528
switch(btnType){
496529
// case 'apply':
497530
// that.save();
498531
// break;
532+
case'run':
533+
varresult=that.run();
534+
if(result){
535+
// that.save();
536+
that.close();
537+
}
538+
break;
499539
case'run-save':
500540
varresult=that.run();
501541
if(result){
@@ -684,7 +724,30 @@ define([
684724
$(this.wrapSelector('.vp-popup-body')).css({
685725
'height':'calc(100% - 30px)'
686726
})
727+
}else{
728+
// set run button
729+
letthat=this;
730+
vpConfig.getData('runType','vpcfg').then(function(data){
731+
vpLog.display(VP_LOG_TYPE.DEVELOP,'Runtype get data',data);
732+
if(data==null||data===''){
733+
data='run';// default = run
734+
}
735+
that.config.runType=data;
736+
$(that.wrapSelector(`.vp-popup-run-type[value="${data}"]`)).prop('checked',true);
737+
$(that.wrapSelector('.vp-popup-run-button')).attr('data-type',data);
738+
letrunTitle='Run code';
739+
switch(data){
740+
case'run-save':
741+
runTitle='Save to block & Run code';
742+
break;
743+
case'add':
744+
runTitle='Add code to cell';
745+
break;
746+
}
747+
$(that.wrapSelector('.vp-popup-run-button')).prop('title',runTitle);
748+
});
687749
}
750+
688751

689752
// popup-frame size
690753
switch(sizeLevel){
@@ -698,6 +761,9 @@ define([
698761
this.config.size={width:760,height:550};
699762
break;
700763
case4:
764+
this.config.size={width:840,height:550};
765+
break;
766+
case5:
701767
this.config.size={width:1064,height:550};
702768
break;
703769
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp