Skip to content

Commit 1b64bdc

Browse files
committed
.
1 parent 588c1c1 commit 1b64bdc

12 files changed

Lines changed: 277 additions & 83 deletions

File tree

elle-app/elle-electron/main.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const __filename = fileURLToPath(import.meta.url)
66
const __dirname = path.dirname(__filename)
77

88
import type { BrowserWindowConstructorOptions } from 'electron'
9-
import { app, BrowserWindow, ipcMain, screen } from 'electron'
9+
import { app, BrowserWindow, ipcMain, screen, nativeTheme } from 'electron'
1010
import { isDev } from './config.js'
1111
import { appConfig } from './electron-store/configuration.js'
1212
import type { ChildProcess } from 'node:child_process'
@@ -76,27 +76,35 @@ async function createWindow() {
7676
// Settings handlers (global)
7777
ipcMain.handle('getSettings', () => ({
7878
diameterMode: (appConfig as any).get('setting.diameterMode'),
79-
defaultMetricOnStartup: (appConfig as any).get('setting.defaultMetricOnStartup')
79+
defaultMetricOnStartup: (appConfig as any).get('setting.defaultMetricOnStartup'),
80+
selectedThreadingTab: (appConfig as any).get('setting.selectedThreadingTab', 0),
81+
selectedTurningTab: (appConfig as any).get('setting.selectedTurningTab', 0),
82+
selectedPitchTab: (appConfig as any).get('setting.selectedPitchTab', [0, 0]),
83+
pitchX: (appConfig as any).get('setting.pitchX', 0.0),
84+
pitchZ: (appConfig as any).get('setting.pitchZ', 0.0)
8085
}))
8186

8287
ipcMain.handle('saveSettings', (event, settings) => {
8388
const currentSettings = (appConfig as any).get('setting', {})
8489
;(appConfig as any).set('setting', {
8590
...currentSettings,
8691
diameterMode: settings.diameterMode,
87-
defaultMetricOnStartup: settings.defaultMetricOnStartup
92+
defaultMetricOnStartup: settings.defaultMetricOnStartup,
93+
selectedThreadingTab: settings.selectedThreadingTab,
94+
selectedTurningTab: settings.selectedTurningTab,
95+
selectedPitchTab: settings.selectedPitchTab,
96+
pitchX: settings.pitchX,
97+
pitchZ: settings.pitchZ
8898
})
8999
return true
90100
})
91101

92-
// Silence Intel GPU dmesg noise
93-
//app.commandLine.appendSwitch('ignore-gpu-blacklist');
94-
//app.commandLine.appendSwitch('disable-gpu');
95-
//app.commandLine.appendSwitch('disable-gpu-compositing');
96-
//app.disableHardwareAcceleration()
97102
app.commandLine.appendSwitch('gtk-version', '3')
98103

99104
app.whenReady().then(async () => {
105+
// Force dark mode for the entire application
106+
nativeTheme.themeSource = 'dark'
107+
100108
if (isDev) {
101109
try {
102110
const { installExt } = await import('./installDevTool.js')

elle-app/elle-electron/preload.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ declare interface api {
44
}
55

66
declare interface settings {
7-
get: () => Promise<{ diameterMode: boolean; defaultMetricOnStartup: boolean }>
8-
save: (settings: { diameterMode: boolean; defaultMetricOnStartup: boolean }) => Promise<boolean>
7+
get: () => Promise<{ diameterMode: boolean; defaultMetricOnStartup: boolean; selectedThreadingTab: number; selectedTurningTab: number; selectedPitchTab: number[]; pitchX: number; pitchZ: number }>
8+
save: (settings: { diameterMode: boolean; defaultMetricOnStartup: boolean; selectedThreadingTab: number; selectedTurningTab: number; selectedPitchTab: number[]; pitchX: number; pitchZ: number }) => Promise<boolean>
99
}

elle-app/elle-frontend/src/App.vue

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ const xpitchlabel = ref('…')
182182
const zpitchlabel = ref('')
183183
const xpitchangle = ref(0)
184184
// Get settings from composable
185-
const { metric, diameterMode, defaultMetricOnStartup, isQuitting, loadSettings } = useSettings()
185+
const { metric, diameterMode, defaultMetricOnStartup, selectedThreadingTab, selectedTurningTab, selectedPitchTab, pitchX, pitchZ, isQuitting, loadSettings } = useSettings()
186186
187187
const cursorpos = ref(0)
188188
@@ -636,7 +636,7 @@ const startHAL = () => {
636636
halStdoutText.value = ''
637637
const userAgent = navigator.userAgent.toLowerCase()
638638
if (userAgent.indexOf(' electron/') > -1) {
639-
window.api.send('startHAL')
639+
window.api.send('startHAL', {})
640640
xpos.value = 0
641641
zpos.value = 0
642642
setAxisOffset('x', 0)
@@ -648,7 +648,7 @@ const stopHAL = () => {
648648
halStdoutText.value = ''
649649
const userAgent = navigator.userAgent.toLowerCase()
650650
if (userAgent.indexOf(' electron/') > -1) {
651-
window.api.send('stopHAL')
651+
window.api.send('stopHAL', {})
652652
xpos.value = 0
653653
zpos.value = 0
654654
setAxisOffset('x', 0)
@@ -666,13 +666,18 @@ const quitApplication = async () => {
666666
try {
667667
await window.settings.save({
668668
diameterMode: diameterMode.value,
669-
defaultMetricOnStartup: defaultMetricOnStartup.value
669+
defaultMetricOnStartup: defaultMetricOnStartup.value,
670+
selectedThreadingTab: selectedThreadingTab.value,
671+
selectedTurningTab: selectedTurningTab.value,
672+
selectedPitchTab: selectedPitchTab.value,
673+
pitchX: pitchX.value,
674+
pitchZ: pitchZ.value
670675
})
671676
} catch (error) {
672677
console.error('Failed to save final settings:', error)
673678
}
674679
675-
window.api.send('quit')
680+
window.api.send('quit', {})
676681
}
677682
}
678683
@@ -804,6 +809,9 @@ watch([selectedFeedMode, selectedDirectionMode], () => {
804809
805810
watch([zpitch, xpitch], () => {
806811
updateHALOut(selectedFeedMode, selectedDirectionMode, FeedMode, DirectionMode)
812+
// Save pitch values to global settings
813+
pitchX.value = xpitch.value
814+
pitchZ.value = zpitch.value
807815
})
808816
809817
watch(selectedMenu, () => {
@@ -1107,6 +1115,14 @@ const updatePitchFromTurning = () => {
11071115
onMounted(async () => {
11081116
// Load settings first
11091117
await loadSettings()
1118+
1119+
// Initialize pitch values from settings
1120+
if (pitchX.value > 0) {
1121+
xpitch.value = pitchX.value
1122+
}
1123+
if (pitchZ.value > 0) {
1124+
zpitch.value = pitchZ.value
1125+
}
11101126
11111127
const userAgent = navigator.userAgent.toLowerCase()
11121128
if (userAgent.indexOf(' electron/') > -1) {
@@ -1464,31 +1480,31 @@ onUnmounted(() => {
14641480
<button
14651481
size="large"
14661482
class="col-12 dro-font-mode button-mode p-3 m-1"
1467-
@click="cannedCycleClicked(CannedCycle.threading)"
1483+
@click="cannedCycleClicked(CannedCycle.turning)"
14681484
>
14691485
<span class="flex flex-row align-items-center">
14701486
<i
1471-
v-if="selectedCannedCycle == CannedCycle.threading"
1487+
v-if="selectedCannedCycle == CannedCycle.turning"
14721488
class="pi pi-circle-fill mr-3"
14731489
style="color: #ff0000"
14741490
/>
14751491
<i v-else class="pi pi-circle mr-3" />
1476-
Threading
1492+
Turning
14771493
</span>
14781494
</button>
14791495
<button
14801496
size="large"
14811497
class="col-12 dro-font-mode button-mode p-3 m-1"
1482-
@click="cannedCycleClicked(CannedCycle.turning)"
1498+
@click="cannedCycleClicked(CannedCycle.threading)"
14831499
>
14841500
<span class="flex flex-row align-items-center">
14851501
<i
1486-
v-if="selectedCannedCycle == CannedCycle.turning"
1502+
v-if="selectedCannedCycle == CannedCycle.threading"
14871503
class="pi pi-circle-fill mr-3"
14881504
style="color: #ff0000"
14891505
/>
14901506
<i v-else class="pi pi-circle mr-3" />
1491-
Turning
1507+
Threading
14921508
</span>
14931509
</button>
14941510
<button

elle-app/elle-frontend/src/assets/turningpresets.json

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,152 @@
11
{
2+
"metric": [
3+
{
4+
"name": "10mm Bar",
5+
"description": "Standard 10mm turning operation",
6+
"target": 4.0,
7+
"stock": 5.0,
8+
"zEnd": -20.0,
9+
"feedRate": 0.15,
10+
"finalStepDown": 0.1,
11+
"taperAngle": 0,
12+
"stepDown": 0.5,
13+
"springPasses": 0
14+
},
15+
{
16+
"name": "12mm Bar",
17+
"description": "Standard 12mm turning operation",
18+
"target": 5.0,
19+
"stock": 6.0,
20+
"zEnd": -25.0,
21+
"feedRate": 0.15,
22+
"finalStepDown": 0.1,
23+
"taperAngle": 0,
24+
"stepDown": 0.5,
25+
"springPasses": 0
26+
},
27+
{
28+
"name": "16mm Bar",
29+
"description": "Standard 16mm turning operation",
30+
"target": 6.0,
31+
"stock": 8.0,
32+
"zEnd": -30.0,
33+
"feedRate": 0.2,
34+
"finalStepDown": 0.15,
35+
"taperAngle": 0,
36+
"stepDown": 0.75,
37+
"springPasses": 0
38+
},
39+
{
40+
"name": "20mm Bar",
41+
"description": "Standard 20mm turning operation",
42+
"target": 8.0,
43+
"stock": 10.0,
44+
"zEnd": -40.0,
45+
"feedRate": 0.25,
46+
"finalStepDown": 0.15,
47+
"taperAngle": 0,
48+
"stepDown": 1.0,
49+
"springPasses": 0
50+
},
51+
{
52+
"name": "25mm Bar",
53+
"description": "Standard 25mm turning operation",
54+
"target": 10.0,
55+
"stock": 12.5,
56+
"zEnd": -50.0,
57+
"feedRate": 0.3,
58+
"finalStepDown": 0.2,
59+
"taperAngle": 0,
60+
"stepDown": 1.25,
61+
"springPasses": 0
62+
},
63+
{
64+
"name": "30mm Bar",
65+
"description": "Standard 30mm turning operation",
66+
"target": 12.0,
67+
"stock": 15.0,
68+
"zEnd": -60.0,
69+
"feedRate": 0.3,
70+
"finalStepDown": 0.2,
71+
"taperAngle": 0,
72+
"stepDown": 1.5,
73+
"springPasses": 0
74+
}
75+
],
76+
"imperial": [
77+
{
78+
"name": "1/2\" Bar",
79+
"description": "Standard 1/2 inch turning operation",
80+
"target": 4.76,
81+
"stock": 6.35,
82+
"zEnd": -25.4,
83+
"feedRate": 0.006,
84+
"finalStepDown": 0.004,
85+
"taperAngle": 0,
86+
"stepDown": 0.02,
87+
"springPasses": 0
88+
},
89+
{
90+
"name": "5/8\" Bar",
91+
"description": "Standard 5/8 inch turning operation",
92+
"target": 6.35,
93+
"stock": 7.94,
94+
"zEnd": -31.75,
95+
"feedRate": 0.008,
96+
"finalStepDown": 0.004,
97+
"taperAngle": 0,
98+
"stepDown": 0.025,
99+
"springPasses": 0
100+
},
101+
{
102+
"name": "3/4\" Bar",
103+
"description": "Standard 3/4 inch turning operation",
104+
"target": 9.53,
105+
"stock": 9.53,
106+
"zEnd": -38.1,
107+
"feedRate": 0.008,
108+
"finalStepDown": 0.006,
109+
"taperAngle": 0,
110+
"stepDown": 0.03,
111+
"springPasses": 0
112+
},
113+
{
114+
"name": "1\" Bar",
115+
"description": "Standard 1 inch turning operation",
116+
"target": 12.7,
117+
"stock": 12.7,
118+
"zEnd": -50.8,
119+
"feedRate": 0.01,
120+
"finalStepDown": 0.006,
121+
"taperAngle": 0,
122+
"stepDown": 0.04,
123+
"springPasses": 0
124+
},
125+
{
126+
"name": "1-1/4\" Bar",
127+
"description": "Standard 1-1/4 inch turning operation",
128+
"target": 15.88,
129+
"stock": 15.88,
130+
"zEnd": -63.5,
131+
"feedRate": 0.012,
132+
"finalStepDown": 0.008,
133+
"taperAngle": 0,
134+
"stepDown": 0.05,
135+
"springPasses": 0
136+
},
137+
{
138+
"name": "1-1/2\" Bar",
139+
"description": "Standard 1-1/2 inch turning operation",
140+
"target": 19.05,
141+
"stock": 19.05,
142+
"zEnd": -76.2,
143+
"feedRate": 0.012,
144+
"finalStepDown": 0.008,
145+
"taperAngle": 0,
146+
"stepDown": 0.06,
147+
"springPasses": 0
148+
}
149+
],
2150
"npt": [
3151
{
4152
"name": "⅛-27 NPT-2A",

elle-app/elle-frontend/src/components/PitchPresetSelector.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<script setup lang="ts">
22
import { onMounted, inject } from 'vue'
33
import { useDialog } from 'primevue/usedialog'
4+
import { useSettings } from '../composables/useSettings'
45
56
import json from '../assets/manualpresets.json'
67
78
const emit = defineEmits(['selected'])
89
const dialogRef = inject('dialogRef') as any
910
// eslint-disable-next-line no-unused-vars
1011
const dialog = useDialog()
12+
const { selectedPitchTab } = useSettings()
1113
1214
const headers: string[] = []
1315
@@ -31,7 +33,7 @@ onMounted(() => {})
3133
</script>
3234

3335
<template>
34-
<TabView>
36+
<TabView v-model:active-index="selectedPitchTab[axis]">
3537
<TabPanel
3638
v-for="(title, sindex) in headers"
3739
:key="sindex"

elle-app/elle-frontend/src/components/ThreadPresetSelector.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<script setup lang="ts">
22
import { inject } from 'vue'
33
import presetsData from '../assets/threadpresets.json'
4+
import { useSettings } from '../composables/useSettings'
45
56
const emit = defineEmits(['selected'])
67
const dialogRef = inject('dialogRef') as any
8+
const { selectedThreadingTab } = useSettings()
79
810
interface ThreadPreset {
911
name: string
@@ -60,7 +62,7 @@ const shouldShowSeparator = (section: any, pindex: number): boolean => {
6062
</script>
6163

6264
<template>
63-
<TabView>
65+
<TabView v-model:active-index="selectedThreadingTab">
6466
<TabPanel
6567
v-for="(section, sindex) in sections"
6668
:key="sindex"

0 commit comments

Comments
 (0)