Skip to content

Commit

Permalink
Fixed update UI
Browse files Browse the repository at this point in the history
  • Loading branch information
fetacore committed Nov 15, 2018
1 parent 4c18835 commit c241347
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 67 deletions.
18 changes: 7 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,15 @@ autoUpdater.on('error', (err) => {
// autoUpdater.on('download-progress', (e, progressObj) => {
// tray.setToolTip('Downloaded: ' + progressObj.percent+'% with speed:' + progressObj.bytesPerSecond * 1024 * 1024+'MB/s')
// })
autoUpdater.on('update-downloaded', (info) => {
notification = new Notification({
title: 'Updater',
body: 'Update downloaded. Press here to quit and install!',
icon: nativeImage.createFromPath(__dirname + '/static/infty_white.png')
})
notification.show()
notification.on('click', () => {
app.isQuiting = true
autoUpdater.quitAndInstall()
})
autoUpdater.on('update-downloaded', (event, info) => {
mainWindow.webContents.send('update-ready')
});

ipcMain.on('update-goddammit', (event) => {
app.isQuiting = true
autoUpdater.quitAndInstall()
})

// 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 import them here.

Expand Down
117 changes: 61 additions & 56 deletions src/react/Grid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ export default class Grid extends React.Component {
areYouSureDialogDisplay: false,
areYouSureTemplateDialogDisplay: false,
packageDialog: false,
packages: startTex.slice(0, startTex.indexOf('\\begin{document}') + 16)
packages: startTex.slice(0, startTex.indexOf('\\begin{document}') + 16),
// For updates
downloadProgress: 0
}
}

Expand Down Expand Up @@ -362,6 +364,12 @@ You can refer to the graph as \\ref{figure:nickname}\n'
}
}
})
ipcRenderer.on('update-ready', (event) => {
this.setState({
networkFeatures: true,
networkPageIndex: 6
})
})
window.onbeforeunload = (event) => {
if (this.state.filepath != null) {
dialog.showMessageBox(
Expand Down Expand Up @@ -480,6 +488,15 @@ You can refer to the graph as \\ref{figure:nickname}\n'
} else {
return true;
}
if (this.state.downloadProgress !== nextState.downloadProgress) {
return false;
} else {
return true;
}
}

sendUpdateToMain () {
ipcRenderer.send('update-goddammit');
}

spellcheck () {
Expand Down Expand Up @@ -510,7 +527,6 @@ You can refer to the graph as \\ref{figure:nickname}\n'
}

misspelled (line) {

let content = line.replace(/citet\{.*\}|citep\{.*\}|label\{.*\}|ref\{.*\}|bibliography\{.*\}|\{|\}|\(|\)|\,|\.|\?|\"|\:|\^|\/|\\\\|\\|\-|\'|\|/g, " ")
let words = content.split(' ')
let last = words.length - 1
Expand Down Expand Up @@ -1607,15 +1623,15 @@ note = ,\n\u007D\n'
themeMenu =
<MenuItem
primaryText="Dark Theme"
style={{color: '#fff'}}
style={{color: letterColor}}
checked={true}
onClick={(e) => this.themeChooser('Light')}
/>
} else {
themeMenu =
<MenuItem
primaryText="White Theme"
style={{color: '#fff'}}
style={{color: letterColor}}
checked={true}
onClick={(e) => this.themeChooser('Default')}
/>
Expand Down Expand Up @@ -2155,7 +2171,7 @@ note = ,\n\u007D\n'
thickness={9}
color={loadingPDFCircleColor}
style={{marginLeft: 0, marginRight: 0, marginTop: '30%'}}
/>
/>
</div>
} else if (this.state.networkPageIndex == 1) {
infIconPageNavigation = 2
Expand Down Expand Up @@ -2257,46 +2273,57 @@ note = ,\n\u007D\n'
}}
/>
</div>
} else if (this.state.networkPageIndex == 6) {
infIconPageNavigation = 0
networkstuff =
<div>
<RaisedButton
onClick={() => this.sendUpdateToMain()}
label='Quit and Update'
buttonStyle={buttonStyles}
style={{width: '90%', marginTop: '30%'}}
/>
</div>
} else if (this.state.networkPageIndex == 7) {
infIconPageNavigation = 0
networkstuff =
<div>
<MenuItem value={1} primaryText='Compile Pdf' style={{color: '#fff'}} onClick={() => {
<MenuItem value={1} primaryText='Compile Pdf' style={{color: letterColor}} onClick={() => {
this.setState({
networkFeatures: false
}, () => {
this.compileText()
})
}}
/>
<MenuItem value={2} primaryText='Open Project' style={{color: '#fff'}} onClick={() => {
<MenuItem value={2} primaryText='Open Project' style={{color: letterColor}} onClick={() => {
this.setState({
networkFeatures: false
}, () => {
this.onOpenProjectClick()
})
}}
/>
<MenuItem value={3} primaryText='Create Project' style={{color: '#fff'}} onClick={() => {
<MenuItem value={3} primaryText='Create Project' style={{color: letterColor}} onClick={() => {
this.setState({
networkFeatures: false
}, () => {
this.onCreateProjectClick()
})
}}
/>
<MenuItem value={4} primaryText='Search Books' style={{color: '#fff'}} onClick={() => this.setState({networkPageIndex: 2, split: false})} />
<MenuItem value={5} primaryText='Search Papers' style={{color: '#fff'}} onClick={() => this.setState({networkPageIndex: 5, split: false})} />
<MenuItem value={4} primaryText='Search Books' style={{color: letterColor}} onClick={() => this.setState({networkPageIndex: 2, split: false})} />
<MenuItem value={5} primaryText='Search Papers' style={{color: letterColor}} onClick={() => this.setState({networkPageIndex: 5, split: false})} />
{themeMenu}
<MenuItem value={7} primaryText='Help with LaTeX' style={{color: '#fff'}} onClick={() => {
<MenuItem value={7} primaryText='Help with LaTeX' style={{color: letterColor}} onClick={() => {
this.setState({
networkFeatures: false
}, () => {
this.openLatexHelp()
})
}}
/>
<MenuItem value={8} primaryText='Close Project' style={{color: '#fff'}} onClick={() => {
<MenuItem value={8} primaryText='Close Project' style={{color: letterColor}} onClick={() => {
this.setState({
networkFeatures: false
}, () => {
Expand All @@ -2305,35 +2332,8 @@ note = ,\n\u007D\n'
}}
/>
</div>
} else {
infIconPageNavigation = 3
networkstuff =
<div>
<LinearProgress
mode='determinate'
value={this.state.downloadProgress}
min={0}
max={100}
color={loadingPDFCircleColor}
style={{marginLeft: 0, marginRight: 0, marginTop: '30%'}}
/>
<TextField
value={'Downloading Updates'}
id='Pare ta arxidia Material UI'
disabled
inputStyle={{
fontSize: '12pt',
textAlign: 'center',
color: letterColor
}}
style={{
width: '90%'
}}
/>
</div>
}


let texEditorHeight = null
let separateTexBibHeight = 0
let bibEditorHeight = 0
Expand Down Expand Up @@ -2411,23 +2411,28 @@ note = ,\n\u007D\n'
</div>
</Paper>
} else {
logoIconDiv =
<IconMenu
iconButtonElement={
<img style={{width: 130, marginTop: 30, cursor: 'pointer'}} src={logosrc} />
}
anchorOrigin={{horizontal: 'left', vertical: 'top'}}
targetOrigin={{horizontal: 'left', vertical: 'top'}}
value={0}
>
<MenuItem value={1} primaryText='Open Project' style={{color: '#fff'}} onClick={() => this.onOpenProjectClick()} />
<MenuItem value={2} primaryText='Create Project' style={{color: '#fff'}} onClick={() => this.onCreateProjectClick()} />
<MenuItem value={3} primaryText='Search Books' style={{color: '#fff'}} onClick={() => this.editorLeftClickWithoutLiteratureDisplay(infIconPageNavigation)} />
<MenuItem value={4} primaryText='Search Papers' style={{color: '#fff'}} onClick={() => this.setState({networkPageIndex: 5})} />
{themeMenu}
<MenuItem value={5} primaryText='Help with LaTeX' style={{color: '#fff'}} onClick={() => this.openLatexHelp()} />
<MenuItem value={6} primaryText='Close Project' style={{color: '#fff'}} onClick={() => this.closeProject()} />
</IconMenu>
if (this.state.networkPageIndex == 7) {
logoIconDiv =
<img style={{width: 130, marginTop: 30, cursor: 'pointer'}} src={logosrc} onClick={() => this.setState({networkFeatures: false})} />
} else {
logoIconDiv =
<IconMenu
iconButtonElement={
<img style={{width: 130, marginTop: 30, cursor: 'pointer'}} src={logosrc} />
}
anchorOrigin={{horizontal: 'left', vertical: 'top'}}
targetOrigin={{horizontal: 'left', vertical: 'top'}}
value={0}
>
<MenuItem value={1} primaryText='Open Project' style={{color: '#fff'}} onClick={() => this.onOpenProjectClick()} />
<MenuItem value={2} primaryText='Create Project' style={{color: '#fff'}} onClick={() => this.onCreateProjectClick()} />
<MenuItem value={3} primaryText='Search Books' style={{color: '#fff'}} onClick={() => this.editorLeftClickWithoutLiteratureDisplay(infIconPageNavigation)} />
<MenuItem value={4} primaryText='Search Papers' style={{color: '#fff'}} onClick={() => this.setState({networkPageIndex: 5})} />
{themeMenu}
<MenuItem value={5} primaryText='Help with LaTeX' style={{color: '#fff'}} onClick={() => this.openLatexHelp()} />
<MenuItem value={6} primaryText='Close Project' style={{color: '#fff'}} onClick={() => this.closeProject()} />
</IconMenu>
}
if (this.state.preview) {
if (this.state.split) {
layout = [
Expand Down

0 comments on commit c241347

Please sign in to comment.