diff --git a/public/shablons/emergency_and_navigate.txt b/public/shablons/emergency_and_navigate.txt index 708ff95..5889c07 100644 --- a/public/shablons/emergency_and_navigate.txt +++ b/public/shablons/emergency_and_navigate.txt @@ -91,7 +91,7 @@ def main(): #в дальнейшем не передавать переменной auto_arm значение True - <> +<> land() #посадка diff --git a/src/App.vue b/src/App.vue index f61d5cb..776a790 100644 --- a/src/App.vue +++ b/src/App.vue @@ -57,7 +57,7 @@ function setNumber(item) { function saveResult() { let navigate_waites = '' for (const item of listOfTrips.value) { - navigate_waites += `navigate_wait(${item.x}, ${item.y})\n\t`; + navigate_waites += `\tnavigate_wait(${item.x}, ${item.y})\n`; } fetch('/shablons/emergency_and_navigate.txt') .then(response => response.text()) @@ -99,9 +99,34 @@ useEventListener('keydown', handleKeydown); function copyAndToast(text){ copyToclipboard(text) izitoast.success({ - title:'Успешно', - message:'Код скопирован в буфер обмена' - }) + title:'Успешно', + message:'Код скопирован в буфер обмена' + }) + isModalVisible.value = false +} + +function handleDownloadBtn(){ + console.log(finallyText) + // Создание файла + const downloadUrl = ref(''); + const blob = new Blob([finallyText], { type: 'text/plain' }); + downloadUrl.value = URL.createObjectURL(blob); + // Задержка для избежания ошибок в некоторых браузерах + setTimeout(() => { + // Загрузка + const link = document.createElement('a'); + link.href = downloadUrl.value; + link.download = 'itinerary.py'; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }, 0); + + izitoast.success({ + title:'Успешно', + message:'Загрузка файла уже началась' + }) + isModalVisible.value = false } @@ -135,7 +160,7 @@ function copyAndToast(text){

diff --git a/src/main.js b/src/main.js index bd7c393..8668dab 100644 --- a/src/main.js +++ b/src/main.js @@ -8,10 +8,13 @@ if (started) { } const createWindow = () => { + const { screen } = require('electron'); + const primaryDisplay = screen.getPrimaryDisplay(); + const { width, height } = primaryDisplay.workAreaSize; // Create the browser window. const mainWindow = new BrowserWindow({ - width: 800, - height: 600, + width: width, + height: height, webPreferences: { preload: path.join(__dirname, 'preload.js'), },