Skip to content

Commit c79d901

Browse files
committed
wip #73
1 parent 4491128 commit c79d901

File tree

4 files changed

+70
-59
lines changed

4 files changed

+70
-59
lines changed

src/components/Activity.vue

+9-13
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ export default {
381381
type: 'text',
382382
},
383383
{
384-
action: 'runProgramLegacy',
384+
action: 'runProgram',
385385
icon: 'play_arrow',
386386
label: this.$i18n.t('message.activity_program_run'),
387387
type: 'text',
@@ -509,7 +509,7 @@ export default {
509509
// path: 'static/js/blockly/',
510510
// TODO: Use values from fetched configuration!
511511
scrollbars: true,
512-
maxBlocks: this.activity ? this.activity.maxBlocks : -1,
512+
maxBlocks: this.activity.maxBlocks,
513513
zoom: {
514514
controls: true,
515515
wheel: false,
@@ -842,7 +842,6 @@ export default {
842842
});
843843
}
844844
},
845-
846845
runProgram() {
847846
if (this.status) {
848847
const axios = this.$axios;
@@ -858,19 +857,23 @@ export default {
858857
Blockly.Python.INFINITE_LOOP_TRAP = null;
859858
860859
axios.post(`${CB}/exec`, {
861-
name: 'Hello, World!',
860+
name: 'run program',
862861
dom_code,
863862
code,
864863
}).then((response) => {
865864
console.log(response);
865+
this.runtimeDialog = true;
866+
setTimeout(() => {
867+
this.updateExecStatus();
868+
}, 1000);
866869
});
867870
} else {
868871
this.generalDialog = true;
869872
this.generalDialogTitle = this.$i18n.t('error');
870873
this.generalDialogText = this.$i18n.t('coderbot_offline_3');
871874
}
872875
},
873-
876+
/*
874877
runProgramLegacy() {
875878
if (this.status) {
876879
const axios = this.$axios;
@@ -899,14 +902,7 @@ export default {
899902
});
900903
}
901904
},
902-
903-
run() {
904-
// Run program handler
905-
906-
// Some decision logic here
907-
this.runProgramLegacy();
908-
},
909-
905+
*/
910906
stopProgram() {
911907
console.log('Stopping');
912908
const axios = this.$axios;

src/components/ActivityEditor.vue

+56-42
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
<v-card>
3434
<v-form class="cardContent">
3535
<v-text-field v-model="activity.name" label="Nome" required></v-text-field>
36-
<v-text-field v-model="activity.description" v-bind:label="$t('message.activity_description')"></v-text-field>
37-
<v-select v-model="defaultView" :items="viste" v-bind:label="$t('message.activity_predefined_view')" required></v-select>
36+
<v-text-field v-model="activity.description" v-bind:label="$t('message.activity_description')">
37+
</v-text-field>
38+
<v-select v-model="defaultView" :items="viste"
39+
v-bind:label="$t('message.activity_predefined_view')" required></v-select>
3840
</v-form>
3941
</v-card>
4042
<br><br>
@@ -44,7 +46,8 @@
4446
<!--
4547
<v-select :items="fontSizeLabels" v-model="activity.fontSize" label="Grandezza testo"></v-select>
4648
-->
47-
<v-switch v-bind:label="$t('message.activity_caps_only')" v-model="activity.capsSwitch"></v-switch>
49+
<v-switch v-bind:label="$t('message.activity_caps_only')" v-model="activity.capsSwitch">
50+
</v-switch>
4851
<!--
4952
<v-layout row wrap>
5053
<v-flex>
@@ -94,10 +97,10 @@
9497
</v-card>
9598
<br><br>
9699
-->
97-
<h3 class="text-xs-left">{{ $t("message.activity_programing_title") }}</h3>
98-
<v-card>
99-
<div class="cardContent">
100-
<v-layout row wrap>
100+
<h3 class="text-xs-left">{{ $t("message.activity_programing_title") }}</h3>
101+
<v-card>
102+
<div class="cardContent">
103+
<v-layout row wrap>
101104
<!--
102105
<v-flex>
103106
<v-checkbox v-model="activity.availableViews" label="Programmazione a Blocchi" value="blockly"></v-checkbox>
@@ -112,12 +115,17 @@
112115
<v-switch v-model="activity.viewSource" label="Permetti di visualizzare il codice generato"></v-switch>
113116
</v-flex>
114117
-->
115-
<v-flex>
116-
<v-text-field v-model="activity.maxBlocks" v-bind:label="$t('message.activity_blocks_max_blocks')"></v-text-field>
117-
</v-flex>
118-
</v-layout>
119-
</div>
120-
</v-card>
118+
<v-flex>
119+
<v-checkbox v-model="activity.autoRecVideo"
120+
v-bind:label="$t('message.activity_auto_rec_video')"></v-checkbox>
121+
</v-flex>
122+
<v-flex>
123+
<v-text-field v-model="activity.maxBlocks"
124+
v-bind:label="$t('message.activity_blocks_max_blocks')"></v-text-field>
125+
</v-flex>
126+
</v-layout>
127+
</div>
128+
</v-card>
121129
<!--
122130
<h3 class="text-xs-left">Funzionalità sperimentali</h3>
123131
<v-card>
@@ -147,7 +155,8 @@
147155
<h3> {{ $t("message.activity_toolbar_preview") }} </h3>
148156
<v-app-bar>
149157
<v-app-bar-nav-icon v-if="activity.drawerEnabled"></v-app-bar-nav-icon>
150-
<v-app-bar-title v-if="activity.showName">{{ activity.name || $t("message.activity_name")}}</v-app-bar-title>
158+
<v-app-bar-title v-if="activity.showName">{{ activity.name || $t("message.activity_name")}}
159+
</v-app-bar-title>
151160
<v-spacer></v-spacer>
152161
<template v-for="button in activity.buttons">
153162
<v-btn style="height: 70%" :color="button.colorBtn" :class="button.colorText">
@@ -158,7 +167,8 @@
158167
</template>
159168
</v-app-bar>
160169
<br>
161-
<v-switch v-bind:label="$t('message.activity_lateral_menu_icon')" v-model="activity.drawerEnabled"></v-switch>
170+
<v-switch v-bind:label="$t('message.activity_lateral_menu_icon')" v-model="activity.drawerEnabled">
171+
</v-switch>
162172
<v-switch v-bind:label="$t('message.activity_name')" v-model="activity.showName"></v-switch>
163173
<br>
164174
<h3> {{ $t("message.activity_toolbar_buttons") }} </h3>
@@ -186,7 +196,8 @@
186196
<v-select v-model="button.action" :items="actions" v-bind:label="$t('message.activity_action')"
187197
:disabled="button.notErasable">
188198
</v-select>
189-
<v-select :items="textColors" v-model="button.colorText" v-bind:label="$t('message.activity_text_color')"></v-select>
199+
<v-select :items="textColors" v-model="button.colorText"
200+
v-bind:label="$t('message.activity_text_color')"></v-select>
190201
<v-layout row wrap>
191202
<v-flex xs4 style="text-align: left">
192203
<span style="vertical-align: 55%"> {{ $t("message.activity_toolbar_buttons_color") }}
@@ -248,8 +259,10 @@
248259
<h3 class="text-xs-left">{{ $t("message.activity_views_title") }}</h3>
249260
<v-card>
250261
<v-form class="cardContent">
251-
<v-switch v-bind:label='$t("message.activity_views_runtime_camera")' v-model="activity.exec.camera"></v-switch>
252-
<v-switch v-bind:label='$t("message.activity_views_runtime_log")' v-model="activity.exec.log"></v-switch>
262+
<v-switch v-bind:label='$t("message.activity_views_runtime_camera")'
263+
v-model="activity.exec.camera"></v-switch>
264+
<v-switch v-bind:label='$t("message.activity_views_runtime_log")' v-model="activity.exec.log">
265+
</v-switch>
253266
</v-form>
254267
</v-card>
255268
</v-flex>
@@ -376,11 +389,15 @@ export default {
376389
capsSwitch: true,
377390
bodyFont: 'Roboto',
378391
codeFont: 'ubuntumono',
379-
maxBlocks: -1,
392+
maxBlocks: 0,
380393
availableViews: [],
381394
viewSource: null,
395+
autoRecVideo: null,
382396
},
383-
colors: ['red', 'pink', 'purple', 'yellow', 'deep-purple', 'indigo', 'blue', 'light-blue', 'cyan', 'teal', 'green', 'light-green', 'lime', 'yellow', 'amber', 'orange', 'deep-orange', 'brown', 'blue-grey', 'black', 'grey', 'black', 'white'],
397+
colors: ['red', 'pink', 'purple', 'yellow', 'deep-purple', 'indigo', 'blue', 'light-blue', 'cyan', 'teal',
398+
'green', 'light-green', 'lime', 'yellow', 'amber', 'orange', 'deep-orange', 'brown', 'blue-grey', 'black',
399+
'grey', 'black', 'white'
400+
],
384401
textColors: [
385402
{
386403
text: 'Bianco',
@@ -394,7 +411,7 @@ export default {
394411
actions: [
395412
{
396413
text: this.$i18n.t('message.activity_program_run'),
397-
value: 'runProgramLegacy'
414+
value: 'runProgram'
398415
},
399416
{
400417
text: this.$i18n.t('message.activity_program_save'),
@@ -527,16 +544,14 @@ export default {
527544
this.activity.buttons.splice(index, 1);
528545
},
529546
removeAll() {
530-
this.activity.buttons = [
531-
{
532-
label: this.$i18n.t('message.activity_program_run'),
533-
icon: 'play_arrow',
534-
colorBtn: 'green',
535-
colorText: 'white--text',
536-
action: 'runProgramLegacy',
537-
notErasable: true
538-
},
539-
];
547+
this.activity.buttons = [{
548+
label: this.$i18n.t('message.activity_program_run'),
549+
icon: 'play_arrow',
550+
colorBtn: 'green',
551+
colorText: 'white--text',
552+
action: 'runProgram',
553+
notErasable: true
554+
}];
540555
},
541556
restoreDefaults() {
542557
this.activity.buttons = [
@@ -545,7 +560,7 @@ export default {
545560
icon: 'play_arrow',
546561
colorBtn: 'green',
547562
colorText: 'white--text',
548-
action: 'runProgramLegacy',
563+
action: 'runProgram',
549564
notErasable: true,
550565
},
551566
{
@@ -562,15 +577,14 @@ export default {
562577
</script>
563578
<!-- Add "scoped" attribute to limit CSS to this component only -->
564579
<style scoped>
565-
.rounded1 {
566-
border-radius: 25px;
567-
border: 2px solid #73AD21;
568-
padding: 20px;
569-
width: 100px;
570-
}
571-
572-
.cardContent {
573-
padding: 16px;
574-
}
580+
.rounded1 {
581+
border-radius: 25px;
582+
border: 2px solid #73AD21;
583+
padding: 20px;
584+
width: 100px;
585+
}
575586

587+
.cardContent {
588+
padding: 16px;
589+
}
576590
</style>

src/components/ActivityList.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@
5555
text
5656
@click="confirmDeleteDlg = false"
5757
>
58-
Annulla
58+
{{ $t("message.cancel") }}
5959
</v-btn>
6060
<v-btn
6161
color="green darken-1"
6262
text
6363
@click="confirmDeleteDlg = false; deleteActivity(activity.name)"
6464
>
65-
Ok
65+
{{ $t("message.ok") }}
6666
</v-btn>
6767
</v-card-actions>
6868
</v-card>

src/i18n/locales/it/messages.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"activity_new": "Nuova Attività",
2828
"activity_open": "Apri",
2929
"activity_modify": "Modifica Attività",
30-
"activity_tip_1": "Qui puoi creare o modificare una attività, definendo come dovrà apparire allo studente che dovrà utilizzarla per scrivere programmi. Ricorda che l'attività andrà poi <b> avviata </b> (Menù Attività -> Apri) per poterne fare effettivamente uso.",
30+
"activity_tip_1": "Qui puoi creare o modificare una attività, definendo come dovrà apparire allo studente che dovrà utilizzarla per scrivere programmi. Ricorda che l'attività andrà poi avviata (Menù Attività -> Apri) per poterne fare effettivamente uso.",
3131
"activity_data": "Dati Attività",
3232
"activity_typography": "Tipografia",
3333
"activity_typography_font_ui": "Carattere tipografico dell'interfaccia",
@@ -71,6 +71,7 @@
7171
"activity_caps_only": "solo maiuscole",
7272
"activity_programing_title": "Programmazione",
7373
"activity_blocks_max_blocks": "Numero massimo di blocchi",
74+
"activity_auto_rec_video": "Registra video a ogni esecuzione del programma",
7475
"activity_name": "Nome attività",
7576
"activity_lateral_menu_icon": "Icona menù laterale",
7677
"activity_text_color": "Colore testo",
@@ -81,7 +82,7 @@
8182
"activity_list_text_1": "L'icona {0} ti permette di eliminarla, mentre cliccando su {1} puoi modificarla.",
8283
"activity_list_text_2": "Nessuna Attività, perchè non ne {0} una nuova?",
8384
"activity_list_create": "crei",
84-
"activity_list_delete_confirm_title": "Conferma Cancella Attività",
85+
"activity_list_delete_confirm_title": "Cancella Attività",
8586
"activity_list_delete_confirm_text": "Sei sicuro di voler cancellare l'attività?\nL'azione non è reversibile",
8687
"control_speak": "Pronuncia",
8788
"control_speaking": "Sto pronunciando",

0 commit comments

Comments
 (0)