Skip to content

Commit

Permalink
Merge branch 'release/v0.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
mamarguerat committed Mar 7, 2024
2 parents b6f4a94 + aa86040 commit a6a6cc7
Show file tree
Hide file tree
Showing 7 changed files with 1,399 additions and 1,784 deletions.
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Bug Report
about: Describe your issue in detail to help us improve Mixo
title: ''
labels: ''
assignees: ''

---

⚠ Have you searched for similar, already existing issues?

**Describe the issue**
Please write a clear and concise description of the issue here.


**Steps to reproduce**
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error


**Expected behaviour**
A clear and concise description of what you expected to happen.


**Screenshots**
If applicable, add screenshots or screen recordings to help explain your problem.


**System information:**
- Operating system and its version: [iOS 12, Android 10, Ubuntu 22, MacOS Big Sur, etc.]
- Mixo version: [you can find it by going in the Mixo menu > About Mixo]


**Additional context**
Please add any other context or comments here that may be useful.
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/device-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Device request
about: Suggest an device to add in the app
title: ''
labels: [Device]
assignees: ''

---

**Device information**
Give as much information as possible about the device you would like to be added in Mixo.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Feature Request
about: Suggest an idea for Mixo
title: ''
labels: [Enhancement]
assignees: ''

---

⚠ Have you searched for similar, already existing issues?

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. For example:
I'm always frustrated when [...]


**Describe the ideal solution**
A clear and concise description of what you want to see in Mixo.


**Describe alternatives you have considered**
- How do you solve this issue now with Mixo or other apps?
- Attach any examples, screenshots, or screen recordings from other apps that help us to better understand the idea.


**Additional context**
Add any other context or screenshots about the feature request here.
72 changes: 68 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const { app, BrowserWindow, ipcMain, Menu } = require('electron')
const path = require('path')
const { dialog, app, BrowserWindow, ipcMain, Menu } = require('electron');
const path = require('path');
const fs = require('fs');
let win
let filePath = "";

// Autoupdater from https://samuelmeuli.com/blog/2019-04-07-packaging-and-publishing-an-electron-app/
const { autoUpdater } = require("electron-updater")
Expand All @@ -17,11 +19,16 @@ const menuTemplate = [
{
label: 'Load',
accelerator: 'CmdOrCtrl+O',
click: () => console.log('Oh, hi there!'),
click: () => loadFile(),
},
{
label: 'Save',
accelerator: 'CmdOrCtrl+S',
click: () => win.webContents.send('file', { function: 'save' }),
},
{
label: 'Save as',
click: () => win.webContents.send('file', { function: 'saveas' }),
},
{
label: 'Export documentation',
Expand All @@ -45,6 +52,7 @@ const menuTemplate = [
},
{
label: 'X32 Compact',
accelerator: 'CmdOrCtrl+M',
click: () => win.webContents.send('menu', 'x32c'),
},
{
Expand Down Expand Up @@ -150,12 +158,68 @@ ipcMain.on('window', (event, arg) => {
childWindow.webContents.send('type', arg)
})

ipcMain.on('file', (event, arg) => {
if ('saveas' == arg.function || ('save' == arg.function && filePath == "")) {
dialog.showSaveDialog({
title: 'Save Mixo project',
filters: [
{ name: 'Mixo project', extensions: ['mixo_prj'] },
{ name: 'All Files', extensions: ['*'] }
]
}).then(result => {
if (!result.canceled) {
filePath = result.filePath;
win.setTitle('Mixo • ' + filePath.replace(/^.*[\\\/]/, '').slice(0, -9));
// Write the JSON to the chosen file
fs.writeFile(result.filePath, arg.json, (err) => {
if (err) throw err;
});
}
}).catch(err => {
console.log(err);
});
}
else if ('save' == arg.function && filePath != "") {
fs.writeFile(filePath, arg.json, (err) => {
if (err) throw err;
})
}
})
function loadFile() {
dialog.showOpenDialog({
title: 'Open Mixo project',
filters: [
{ name: 'Mixo project', extensions: ['mixo_prj'] },
{ name: 'All Files', extensions: ['*'] }
],
properties: ['openFile']
}).then(result => {
if (!result.canceled) {
filePath = result.filePaths[0];
win.setTitle('Mixo • ' + filePath.replace(/^.*[\\\/]/, '').slice(0, -9));
// Read the chosen file
fs.readFile(result.filePaths[0], 'utf-8', (err, data) => {
if (err) throw err;
// Parse the JSON data
let jsonData = JSON.parse(data);
// Extract the arrays
win.webContents.send('file', {
function: 'load',
devices: jsonData.devices,
links: jsonData.links
});
});
}
}).catch(err => {
console.log(err);
});
}

// function to create a child window
function createChildWindow(fileName, preloadFileName) {
childWindow = new BrowserWindow({
width: 700,
height: 500,
parent: win, // accessing the parent window
menuBarVisible: false,
autoHideMenuBar: true,
webPreferences: {
Expand Down
Loading

0 comments on commit a6a6cc7

Please sign in to comment.