Browse Source

prevent white bg flicker on mainWnd and loadingWnd start

all-modes
pbca26 8 years ago
parent
commit
d7e126ff36
  1. 38
      main.js
  2. 15
      routes/shepherd.js

38
main.js

@ -28,9 +28,17 @@ var express = require('express'),
Promise = require('bluebird');
// read app version
const localVersionFile = fs.readFileSync(`version`, 'utf8');
if (osPlatform === 'linux') {
process.env.ELECTRON_RUN_AS_NODE = true;
// console.log(process.env);
}
// GUI APP settings and starting gui on address http://120.0.0.1:17777
var shepherd = require('./routes/shepherd');
var guiapp = express();
let localVersion;
let localVersionFile = shepherd.readVersionFile();
if (localVersionFile.indexOf('\r\n') > -1) {
localVersion = localVersionFile.split('\r\n');
@ -46,15 +54,6 @@ const appBasicInfo = {
app.setName(appBasicInfo.name);
app.setVersion(appBasicInfo.version);
if (osPlatform === 'linux') {
process.env.ELECTRON_RUN_AS_NODE = true;
// console.log(process.env);
}
// GUI APP settings and starting gui on address http://120.0.0.1:17777
var shepherd = require('./routes/shepherd');
var guiapp = express();
shepherd.createIguanaDirs();
const appSessionHash = md5(Date.now());
@ -229,7 +228,8 @@ function createLoadingWindow() {
width: 500,
height: 300,
frame: false,
icon: iguanaIcon
icon: iguanaIcon,
show: false,
});
loadingWindow.createWindow = createWindow; // expose createWindow to front-end scripts
@ -238,6 +238,11 @@ function createLoadingWindow() {
// load our index.html (i.e. easyDEX GUI)
loadingWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/`);
loadingWindow.webContents.on('did-finish-load', function() {
setTimeout(function() {
loadingWindow.show();
}, 40);
});
shepherd.writeLog('show loading window');
// DEVTOOLS - only for dev purposes - ca333
@ -279,7 +284,8 @@ function createWindow (status) {
mainWindow = new BrowserWindow({ // dirty hack to prevent main window flash on quit
width: closeAppAfterLoading ? 1 : 1280,
height: closeAppAfterLoading ? 1 : 800,
icon: iguanaIcon
icon: iguanaIcon,
show: false,
});
if (closeAppAfterLoading) {
@ -318,6 +324,12 @@ function createWindow (status) {
} else {
mainWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/EasyDEX-GUI/react/build`);
}
mainWindow.webContents.on('did-finish-load', function() {
setTimeout(function() {
mainWindow.show();
}, 40);
});
} else {
shepherd.writeLog('show edex gui');
mainWindow.loadURL(`http://${appConfig.host}:${appConfig.agamaPort}/gui/EasyDEX-GUI/`);

15
routes/shepherd.js

@ -107,6 +107,14 @@ shepherd.appConfig = {
shepherd.defaultAppConfig = Object.assign({}, shepherd.appConfig);
shepherd.readVersionFile = function() {
// read app version
const rootLocation = path.join(__dirname, '../');
const localVersionFile = fs.readFileSync(rootLocation + 'version', 'utf8');
return localVersionFile;
}
shepherd.writeLog = function(data) {
const logLocation = `${iguanaDir}/shepherd`;
const timeFormatted = new Date(Date.now()).toLocaleString('en-US', { hour12: false });
@ -655,9 +663,10 @@ shepherd.quitKomodod = function() {
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
if (stdout.indexOf('stopping') > -1 ||
stdout.indexOf('EOF reached') > -1 ||
stdout.indexOf('connect to server: unknown (code -1)') > -1) {
if (stdout.indexOf('EOF reached') > -1 ||
stderr.indexOf('EOF reached') > -1 ||
stdout.indexOf('connect to server: unknown (code -1)') > -1 ||
stderr.indexOf('connect to server: unknown (code -1)') > -1) {
clearInterval(coindExitInterval[key]);
}

Loading…
Cancel
Save