Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add wrapper for an electron app #222

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ To build:
...then open any of the HTML files in the `example-browsers` directory
to test.

Electron app
------------

To run as an electron app, do:

```
npm start
```

Documentation
-------------
Expand Down
39 changes: 39 additions & 0 deletions example-browsers/zn_for_amy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>

<html>

<head>

<style>
</style>

<title>Zaire Ebolavirus :: Dalliance</title>
<script language="javascript" src="../build/dalliance-all.js"></script>

<script language="javascript">

var b = new Browser({
chr: 'ZEBOV',
viewStart: 1,
viewEnd: 200,
cookieKey: 'ZEBOV',

coordSystem: {
speciesName: 'ZN',
},

sources: [{name: 'Genome',
twoBitURI: '/Users/olgabot/code/winky/notebooks/ZN_refSeq.2bit',
desc: 'ZN Reference Sequence',
tier_type: 'sequence',
provides_entrypoints: true}],
uiPrefix: '../',
fullScreen: true
});
</script>
</head>

<body>
<div id='svgHolder'>Failed to load the Biodalliance genome browser. Have you run "gulp"?</div>
</body>
</html>
60 changes: 60 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
const electron = require('electron')
// Module to control application life.
const app = electron.app
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow

const path = require('path')
const url = require('url')

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow

function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 600})

// and load the index.html of the app.
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'example-browsers/mouse38.html'),
protocol: 'file:',
slashes: true
}))

// Open the DevTools.
// mainWindow.webContents.openDevTools()

// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})

app.on('activate', function () {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
})

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
45 changes: 45 additions & 0 deletions npm-debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 silly lifecycle [email protected]~prestart: no script for prestart, continuing
7 info lifecycle [email protected]~start: [email protected]
8 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/olgabot/code/dalliance/node_modules/.bin:/Users/olgabot/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
10 verbose lifecycle [email protected]~start: CWD: /Users/olgabot/code/dalliance
11 silly lifecycle [email protected]~start: Args: [ '-c', 'electron .' ]
12 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: `electron .`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:920:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
15 verbose pkgid [email protected]
16 verbose cwd /Users/olgabot/code/dalliance
17 error Darwin 16.7.0
18 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 error node v6.11.3
20 error npm v3.10.10
21 error code ELIFECYCLE
22 error [email protected] start: `electron .`
22 error Exit status 1
23 error Failed at the [email protected] start script 'electron .'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the dalliance package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error electron .
23 error You can get information on how to open an issue for this project with:
23 error npm bugs dalliance
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls dalliance
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"babel-preset-es2015": "^6.13.2",
"babelify": "^7.3.0",
"browserify": "12.0.1",
"electron": "1.7.6",
"eslint": "^2.13.1",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
Expand All @@ -36,9 +37,18 @@
"vinyl-source-stream": "1.1.0",
"watchify": "~3.6.1"
},
"files": ["lib", "css", "fonts", "help", "img", "build/worker-all.js"],
"files": [
"lib",
"css",
"fonts",
"help",
"img",
"build/worker-all.js"
],
"main": "lib/module-exports.js",
"scripts": {
"compile": "babel js -d lib && gulp compile-worker"
"compile": "babel js -d lib && gulp compile-worker",
"start": "electron main.js"
}

}