Browse Source

upgrade to latest Electron version (1.4.7)

Some Electron API have changed, this is just a compatibility commit.
No new functionality just API fixes.
tags/v0.14.0
Sasha Aliashkevich 3 years ago
parent
commit
5427be7e61
9 changed files with 41 additions and 40 deletions
  1. +1
    -1
      .npmrc
  2. +4
    -3
      main.js
  3. +7
    -7
      src/About.js
  4. +1
    -1
      src/CloudMessage.js
  5. +5
    -5
      src/Menu.js
  6. +0
    -1
      src/OutputConsole.js
  7. +14
    -14
      src/Project.js
  8. +4
    -4
      src/UpgradeMessage.js
  9. +5
    -4
      src/index.js

+ 1
- 1
.npmrc View File

@@ -1,2 +1,2 @@
disturl=https://atom.io/download/atom-shell
#disturl=https://atom.io/download/atom-shell
arch=x64

+ 4
- 3
main.js View File

@@ -21,8 +21,9 @@ if (process.platform == 'linux'){
});
}

var app = require('app');
var BrowserWindow = require('browser-window');
var electron = require('electron');
var app = electron.app;
var BrowserWindow = electron.BrowserWindow;

var mainWindow = null;

@@ -38,7 +39,7 @@ app.on('ready', function() {
});
mainWindow.maximize();

mainWindow.loadUrl('file://' + __dirname + '/index.html');
mainWindow.loadURL('file://' + __dirname + '/index.html');

mainWindow.on('closed', function() {
mainWindow = null;

+ 7
- 7
src/About.js View File

@@ -1,16 +1,16 @@
/*
Copyright (C) 2015 Aliaksandr Aliashkevich
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -20,7 +20,7 @@ var Modal = require('react-bootstrap').Modal;
var Button = require('react-bootstrap').Button;
var OverlayMixin = require('react-bootstrap').OverlayMixin;
var TabsStore = require('./TabsStore');
var Shell = require('shell');
var Shell = require('electron').shell;

var About = React.createClass({

@@ -29,11 +29,11 @@ var About = React.createClass({
},

componentDidMount: function(){
TabsStore.bind('about', this.aboutHandler);
TabsStore.bind('about', this.aboutHandler);
},

componentWillUnmount: function(){
TabsStore.unbind('about', this.aboutHandler);
TabsStore.unbind('about', this.aboutHandler);
},

aboutHandler: function(){
@@ -57,7 +57,7 @@ var About = React.createClass({
return (
<div className='static-modal'>

<Modal
<Modal
bsStyle='primary'
backdrop={false}
animation={false}

+ 1
- 1
src/CloudMessage.js View File

@@ -22,7 +22,7 @@ var Button = require('react-bootstrap').Button;
var OverlayMixin = require('react-bootstrap').OverlayMixin;
var TabsStore = require('./TabsStore');
var Actions = require('./Actions');
var Shell = require('shell');
var Shell = require('electron').shell;

var CloudMessage = React.createClass({


+ 5
- 5
src/Menu.js View File

@@ -17,11 +17,11 @@

var Actions = require ('./Actions');
var TabsStore = require('./TabsStore');
var remote = require('remote');
var Menu = remote.require('menu');
var BrowserWindow = remote.require('browser-window');
var dialog = remote.require('dialog');
var app = remote.require('app');
var remote = require('electron').remote;
var Menu = remote.Menu;
var BrowserWindow = remote.BrowserWindow;
var dialog = remote.dialog;
var app = remote.app;
var fs = require('fs');

if (typeof(DEVMODE) == 'undefined'){

+ 0
- 1
src/OutputConsole.js View File

@@ -19,7 +19,6 @@ var React = require('react');
var Chart = require('./Chart');
var ObjectInfo = require('./ObjectInfo');
var Marked = require('marked');
var Shell = require('shell');
var Actions = require('./Actions');
var SqlDoc = require('sqldoc');


+ 14
- 14
src/Project.js View File

@@ -1,8 +1,8 @@
var React = require('react');
var Actions = require('./Actions');
var TabsStore = require('./TabsStore');
var remote = require('remote');
var dialog = remote.require('dialog');
var remote = require('electron').remote;
var dialog = remote.dialog;
var fs = require('fs');
var path = require('path');
var async = require('async');
@@ -23,7 +23,7 @@ var Project = React.createClass({
componentDidMount: function(){
TabsStore.bind('show-project-'+this.props.eventKey, this.showProjectHandler);
TabsStore.bind('hide-project-'+this.props.eventKey, this.hideProjectHandler);
TabsStore.bind('font-size-changed', this.resize);
TabsStore.bind('font-size-changed', this.resize);
React.findDOMNode(this.refs.project_div).addEventListener("keydown", this.keyPressHandler);

},
@@ -31,7 +31,7 @@ var Project = React.createClass({
componentWillUnmount: function(){
TabsStore.unbind('show-project-'+this.props.eventKey, this.showProjectHandler);
TabsStore.unbind('hide-project-'+this.props.eventKey, this.hideProjectHandler);
TabsStore.unbind('font-size-changed', this.resize);
TabsStore.unbind('font-size-changed', this.resize);
React.findDOMNode(this.refs.project_div).removeEventListener("keydown", this.keyPressHandler);
},

@@ -47,7 +47,7 @@ var Project = React.createClass({

componentDidUpdate: function(){

this.resize();
this.resize();
},

resize: function(){
@@ -59,7 +59,7 @@ var Project = React.createClass({
},

update: function(){
this.setState({projects: TabsStore.getProjects()});
this.setState({projects: TabsStore.getProjects()});
},

keyPressHandler: function(e){
@@ -73,7 +73,7 @@ var Project = React.createClass({
this.enterHandler(e);
}
if (e.keyCode == 39){ // right arrow
this.viewFile();
this.viewFile();
}
if (e.keyCode == 8){ // backspace
this.goDirUp();
@@ -128,7 +128,7 @@ var Project = React.createClass({
if (this.state.active.type == "project" && this.state.active.idx < this.state.projects.length-1){
return this.setState({active: {type: "project", idx: this.state.active.idx+1}});
}
// next file
if (this.state.active.type == "file" && this.state.active.idx < this.state.files.length-1){
return this.setState({active: {type: "file", idx: this.state.active.idx+1}},
@@ -176,7 +176,7 @@ var Project = React.createClass({
addProjectHandler: function(){
var self = this;

dialog.showOpenDialog({ properties: ['openDirectory']},
dialog.showOpenDialog({ properties: ['openDirectory']},
function(dirs){
if (typeof(dirs) != 'undefined' && dirs.length == 1){
var dirname = dirs[0];
@@ -197,7 +197,7 @@ var Project = React.createClass({
}

return (
<div className="project-toolbar">
<div className="project-toolbar">
<div ref="hidden" tabIndex="0"/>
<a href="#" onClick={this.addProjectHandler}> <span className="glyphicon glyphicon-plus-sign"/> </a>
{path}
@@ -235,7 +235,7 @@ var Project = React.createClass({
loadPath: function(p){
var dirs = [{path: '..', dir: true}];
var files = [];
var ls = fs.readdirSync(p);
ls.forEach(function(file_name, idx){
var file_path = path.join(p, file_name);
@@ -303,7 +303,7 @@ var Project = React.createClass({

});

return <div id={"project-files-list-"+this.props.eventKey} className="project-files-list" ref="project_files_list">
return <div id={"project-files-list-"+this.props.eventKey} className="project-files-list" ref="project_files_list">
{ret}
</div>
}
@@ -314,12 +314,12 @@ var Project = React.createClass({

var projects = this.state.projects.map(function(item, idx){
if (self.state.active.type == "project" && self.state.active.idx == idx){
return <div key={"project_"+self.props.eventKey+"_"+idx}>
return <div key={"project_"+self.props.eventKey+"_"+idx}>
<div className="project-button project-button-active" onClick={function(){self.loadProjectHandler(idx)}}> {item.alias} </div>
<div className="project-button-remove" onClick={function(){self.removeProjectHandler(idx)}}> <span className="glyphicon glyphicon-minus-sign"/></div>
</div>;
} else {
return <div key={"project_"+self.props.eventKey+"_"+idx}>
return <div key={"project_"+self.props.eventKey+"_"+idx}>
<div className="project-button" onClick={function(){self.loadProjectHandler(idx)}}> {item.alias} </div>
<div className="project-button-remove" onClick={function(){self.removeProjectHandler(idx)}}> <span className="glyphicon glyphicon-minus-sign"/></div>
</div>;

+ 4
- 4
src/UpgradeMessage.js View File

@@ -3,7 +3,7 @@ var Modal = require('react-bootstrap').Modal;
var Button = require('react-bootstrap').Button;
var OverlayMixin = require('react-bootstrap').OverlayMixin;
var TabsStore = require('./TabsStore');
var Shell = require('shell');
var Shell = require('electron').shell;

var UpgradeMessage = React.createClass({

@@ -12,11 +12,11 @@ var UpgradeMessage = React.createClass({
},

componentDidMount: function(){
TabsStore.bind('new-version-available', this.newVersionHandler);
TabsStore.bind('new-version-available', this.newVersionHandler);
},

componentWillUnmount: function(){
TabsStore.unbind('new-version-available', this.newVersionHandler);
TabsStore.unbind('new-version-available', this.newVersionHandler);
},

newVersionHandler: function(){
@@ -38,7 +38,7 @@ var UpgradeMessage = React.createClass({
return (
<div className='static-modal'>

<Modal
<Modal
bsStyle='primary'
backdrop={false}
animation={false}

+ 5
- 4
src/index.js View File

@@ -3,7 +3,8 @@ var $ = require('jquery');
var c3 = require('c3');

function openExternal(url){
require('shell').openExternal(url);
var shell = require('electron').shell;
shell.openExternal(url);
}

function scrollTo(div, to){
@@ -34,7 +35,7 @@ function scrollToUp(div, to){
if (position > $(div).height()){ // if scrolled away down
return $(div).scrollTop(position);
}
if (position - $(to).height() < 0){
if (position - $(to).height() < 0){
return $(div).scrollTop(scroll - $(to).height());
}
}
@@ -69,10 +70,10 @@ function mount_charts(){
if (column_charts.indexOf(chart_type) != -1){
// field name as a header
var rows = dataset.data;
rows.unshift(fields);
rows.unshift(fields);

data = {
rows: rows,
rows: rows,
type: chart_type,
}


Loading…
Cancel
Save