added starting of ui from cli, still hackish...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-01-17 17:51:26 +03:00
parent c0ecc7df80
commit eb800f9c70
2 changed files with 27 additions and 6 deletions

View File

@ -433,7 +433,9 @@ module.PortableAppControl = core.ImageGridFeatures.Feature({
//---------------------------------------------------------------------
// XXX would be nice to store/restore dev-tools state...
// XXX should we create and show the window here???
// ...if yes, then we'll need to start the ui features later as
// they need the dom ready...
var WindowedAppControlActions = actions.Actions({
config: {
// Window state:
@ -454,7 +456,6 @@ var WindowedAppControlActions = actions.Actions({
'show-splash-screen': 'on',
},
// XXX revise these...
close: ['File|Window/Close viewer',
function(){
this.stop()
@ -525,9 +526,6 @@ var WindowedAppControlActions = actions.Actions({
})],
})
// XXX store/load window state...
// - size
// - state (fullscreen/normal)
var WindowedAppControl =
module.WindowedAppControl = core.ImageGridFeatures.Feature({
title: '',
@ -558,6 +556,7 @@ module.WindowedAppControl = core.ImageGridFeatures.Feature({
function(){
// we are going to declare ready ourselves...
this.requestReadyAnnounce() }],
// XXX should we create and show the window here???
['start',
function(){
var that = this

View File

@ -23,6 +23,7 @@ if(typeof(process) != 'undefined'){
}
/*********************************************************************/
// setup logger...
@ -215,6 +216,8 @@ module.CLI = core.ImageGridFeatures.Feature({
actions: CLIActions,
handlers: [
// XXX sort out different run/stop/exit paths -- make this more
// systematic...
['ready',
function(){
var that = this
@ -363,7 +366,7 @@ module.CLI = core.ImageGridFeatures.Feature({
// npm install -g nwjs
// npm link nwjs
// nw install 0.14.5-sdk
.option('gui, --gui', 'start ImageGrid.Viewer', function(){
.option('nw, --nw', 'start ImageGrid.Viewer (nw)', function(){
throw new Error('ig: GUI startup not implemented.')
var path = requirejs('path')
@ -374,6 +377,25 @@ module.CLI = core.ImageGridFeatures.Feature({
keep_running = true
})
.option('electron, --electron', 'start ImageGrid.Viewer (electron)', function(){
var path = requirejs('path')
requirejs('child_process')
.spawn(requirejs('electron'), [
path.join(
path.dirname(nodeRequire.main.filename),
'e.js')])
// XXX need to stop the process iff nothing
// else is running, like repl...
// XXX feels hackish...
.on('exit', function(){
(!global.ig
|| global.ig.isStopped())
&& process.exit()
})
keep_running = true
})
/* // XXX the problem with this is that it still tires
// to find and run 'ig-index'...