-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kazon Wilson
committed
Jul 16, 2020
1 parent
0f3c6c0
commit 0a34613
Showing
20 changed files
with
8,629 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,130 +1,8 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
node_modules | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
.vscode/settings.json | ||
*.7z | ||
*.exe | ||
*.rar | ||
DoW-Mod-Installer/ | ||
test.py | ||
*.zip | ||
.next | ||
app | ||
dist | ||
mods.copy.json | ||
configurations.json | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
DEFAULT_DOW_DIRECTORY: | ||
"C:/Program Files (x86)/Steam/steamapps/common/Dawn of War Soulstorm", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
appId: com.example.nextron | ||
productName: DoW Mod Installer | ||
copyright: Copyright © 2020 Kazon Wilson | ||
directories: | ||
output: dist | ||
buildResources: resources | ||
files: | ||
- from: . | ||
filter: | ||
- package.json | ||
- mods.json | ||
- configurations.json | ||
- mods.copy.json | ||
- app | ||
|
||
extraFiles: mods.json | ||
|
||
win: | ||
target: | ||
- target: zip | ||
publish: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { app } from "electron"; | ||
import serve from "electron-serve"; | ||
import { createWindow } from "./helpers"; | ||
const unhandled = require("electron-unhandled"); | ||
const shell = require("electron").shell; | ||
|
||
const isProd = process.env.NODE_ENV === "production"; | ||
|
||
unhandled(); | ||
|
||
if (isProd) { | ||
serve({ directory: "app" }); | ||
} else { | ||
app.setPath("userData", `${app.getPath("userData")} (development)`); | ||
} | ||
|
||
(async () => { | ||
await app.whenReady(); | ||
|
||
const mainWindow = createWindow("main", { | ||
width: 1000, | ||
height: 600, | ||
webPreferences: { | ||
nodeIntegration: true, | ||
preload: __dirname + "\\preload.js", | ||
enableRemoteModule: true, | ||
}, | ||
}); | ||
|
||
mainWindow.webContents.on("will-navigate", (event, url) => { | ||
event.preventDefault(); | ||
shell.openExternal(url); | ||
}); | ||
|
||
if (isProd) { | ||
await mainWindow.loadURL("app://./home.html"); | ||
} else { | ||
const port = process.argv[2]; | ||
await mainWindow.loadURL(`http://localhost:${port}/home`); | ||
mainWindow.webContents.openDevTools(); | ||
} | ||
})(); | ||
|
||
app.on("window-all-closed", () => { | ||
app.quit(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { | ||
screen, | ||
BrowserWindow, | ||
} from 'electron'; | ||
import * as Store from 'electron-store'; | ||
|
||
export default function createWindow(windowName, options) { | ||
const key = 'window-state'; | ||
const name = `window-state-${windowName}`; | ||
const store = new Store({ name }); | ||
const defaultSize = { | ||
width: options.width, | ||
height: options.height, | ||
}; | ||
let state = {}; | ||
let win; | ||
|
||
const restore = () => store.get(key, defaultSize); | ||
|
||
const getCurrentPosition = () => { | ||
const position = win.getPosition(); | ||
const size = win.getSize(); | ||
return { | ||
x: position[0], | ||
y: position[1], | ||
width: size[0], | ||
height: size[1], | ||
}; | ||
}; | ||
|
||
const windowWithinBounds = (windowState, bounds) => { | ||
return ( | ||
windowState.x >= bounds.x && | ||
windowState.y >= bounds.y && | ||
windowState.x + windowState.width <= bounds.x + bounds.width && | ||
windowState.y + windowState.height <= bounds.y + bounds.height | ||
); | ||
}; | ||
|
||
const resetToDefaults = () => { | ||
const bounds = screen.getPrimaryDisplay().bounds; | ||
return Object.assign({}, defaultSize, { | ||
x: (bounds.width - defaultSize.width) / 2, | ||
y: (bounds.height - defaultSize.height) / 2 | ||
}); | ||
}; | ||
|
||
const ensureVisibleOnSomeDisplay = (windowState) => { | ||
const visible = screen.getAllDisplays().some(display => { | ||
return windowWithinBounds(windowState, display.bounds) | ||
}); | ||
if (!visible) { | ||
// Window is partially or fully not visible now. | ||
// Reset it to safe defaults. | ||
return resetToDefaults(); | ||
} | ||
return windowState; | ||
}; | ||
|
||
const saveState = () => { | ||
if (!win.isMinimized() && !win.isMaximized()) { | ||
Object.assign(state, getCurrentPosition()); | ||
} | ||
store.set(key, state); | ||
}; | ||
|
||
state = ensureVisibleOnSomeDisplay(restore()); | ||
|
||
win = new BrowserWindow({ | ||
...options, | ||
...state, | ||
webPreferences: { | ||
nodeIntegration: true, | ||
...options.webPreferences, | ||
}, | ||
}); | ||
|
||
win.on('close', saveState); | ||
|
||
return win; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import createWindow from './create-window'; | ||
|
||
export { | ||
createWindow, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const { dialog } = require("electron").remote; | ||
window.electron = {}; | ||
window.electron.dialog = dialog; |
Oops, something went wrong.