|
|
@@ -4,7 +4,7 @@ const CoreWindow = require('ee-core/electron/window');
|
|
|
const WebSocket = require('ws'); // 引入原生 ws 库
|
|
|
const { readConfigFile } = require('./config');
|
|
|
const pyapp = readConfigFile().pyapp
|
|
|
-const { app} = require('electron');
|
|
|
+const { app } = require('electron');
|
|
|
const path = require('path');
|
|
|
const fs = require('fs');
|
|
|
|
|
|
@@ -42,7 +42,6 @@ function livePreview(data){
|
|
|
} else {
|
|
|
fs.rename(tempFilePath, previewPath, (renameErr) => {
|
|
|
if (renameErr) {
|
|
|
- Log.error('重命名文件失败:', renameErr);
|
|
|
} else {
|
|
|
}
|
|
|
});
|
|
|
@@ -55,7 +54,9 @@ function livePreview(data){
|
|
|
|
|
|
const pySocket = function () {
|
|
|
|
|
|
- this.init = async function () {
|
|
|
+ this.app = null;
|
|
|
+ this.init = async function (this_app) {
|
|
|
+ if(this_app) this.app = this_app;
|
|
|
await new Promise(async (resolve,reject) => {
|
|
|
|
|
|
const win = CoreWindow.getMainWindow()
|
|
|
@@ -83,11 +84,14 @@ const pySocket = function () {
|
|
|
|
|
|
if(this_data.msg_type){
|
|
|
|
|
|
+ let notAllMessage = false
|
|
|
switch (this_data.msg_type){
|
|
|
case 'smart_shooter_enable_preview':
|
|
|
+ notAllMessage = true;
|
|
|
livePreview(this_data);
|
|
|
break;
|
|
|
}
|
|
|
+ if(notAllMessage) return;
|
|
|
let channel = 'controller.socket.message_'+this_data.msg_type;
|
|
|
if(typeToMessage[this_data.msg_type]){
|
|
|
if(typeof typeToMessage[this_data.msg_type] === 'object'){
|