mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
Implemented the interaction between the gui and main so that the ai/transcript names get loaded inside the dropdowns
This commit is contained in:
@@ -10,6 +10,14 @@ try {
|
|||||||
contextBridge.exposeInMainWorld("electronAPI", {
|
contextBridge.exposeInMainWorld("electronAPI", {
|
||||||
getFilePath: (file) => {return webUtils.getPathForFile(file)}
|
getFilePath: (file) => {return webUtils.getPathForFile(file)}
|
||||||
})
|
})
|
||||||
|
contextBridge.exposeInMainWorld("onStartup", {
|
||||||
|
getModuleNames: (file) => { ipcRenderer.send("get_modules", "")}
|
||||||
|
})
|
||||||
|
|
||||||
|
ipcRenderer.on("modules", (event, resp) => {
|
||||||
|
loadAiOptions(resp.ai_modules);
|
||||||
|
loadTranscriptionOptions(resp.transcription_modules);
|
||||||
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error in preload.js");
|
console.log("Error in preload.js");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,13 +32,14 @@ uploadContainer.addEventListener("drop", (e) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
window.addEventListener('load', (e) => {
|
window.addEventListener('load', (e) => {
|
||||||
try {
|
try {
|
||||||
console.log("test");
|
console.log("test");
|
||||||
loadLanguageOptions();
|
loadLanguageOptions();
|
||||||
} catch (error) {
|
window.onStartup.getModuleNames();
|
||||||
|
} catch (error) {
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+8
-12
@@ -55,11 +55,7 @@ function checkBoxes() {
|
|||||||
"style": selectedStyles
|
"style": selectedStyles
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
console.log(sendingPackage);
|
ipcRenderer.send("file_submit", sendingPackage)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//window.extractor.extract({inputVideoPath: pathTest, outputType:"wav"});
|
|
||||||
}else{
|
}else{
|
||||||
alert('The given file is not compatible. These are the available types: [".mp4", ".mov", ".avi", ".mkv"].');
|
alert('The given file is not compatible. These are the available types: [".mp4", ".mov", ".avi", ".mkv"].');
|
||||||
}
|
}
|
||||||
@@ -137,11 +133,11 @@ function loadAiOptions(options){
|
|||||||
var menu = document.getElementById('ai_type');
|
var menu = document.getElementById('ai_type');
|
||||||
var object_holdy;
|
var object_holdy;
|
||||||
var choice ;
|
var choice ;
|
||||||
object_holdy = Object.keys(options);
|
object_holdy = options
|
||||||
for(i = 0; i < options.length; i++){
|
for(i = 0; i < options.length; i++){
|
||||||
choice = document.createElement('option');
|
choice = document.createElement('option');
|
||||||
choice.textContent = object_holdy[i];
|
choice.textContent = object_holdy[i].displayname;
|
||||||
choice.value = object_holdy[i];
|
choice.value = object_holdy[i].name;
|
||||||
menu.appendChild(choice);
|
menu.appendChild(choice);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -153,14 +149,14 @@ function loadAiOptions(options){
|
|||||||
//function to load transcription options to the drop down list
|
//function to load transcription options to the drop down list
|
||||||
function loadTranscriptionOptions(options){
|
function loadTranscriptionOptions(options){
|
||||||
try {
|
try {
|
||||||
var menu = document.getElementById('transkript_type');
|
var menu = document.getElementById('ai_type');
|
||||||
var object_holdy;
|
var object_holdy;
|
||||||
var choice ;
|
var choice ;
|
||||||
object_holdy = Object.keys(options);
|
object_holdy = options
|
||||||
for(i = 0; i < options.length; i++){
|
for(i = 0; i < options.length; i++){
|
||||||
choice = document.createElement('option');
|
choice = document.createElement('option');
|
||||||
choice.textContent = object_holdy[i];
|
choice.textContent = object_holdy[i].displayname;
|
||||||
choice.value = object_holdy[i];
|
choice.value = object_holdy[i].name;
|
||||||
menu.appendChild(choice);
|
menu.appendChild(choice);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user