diff options
author | Devine Lu Linvega <[email protected]> | 2018-12-09 13:09:22 +1200 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2018-12-09 13:09:22 +1200 |
commit | 5d888fa9ece5008dda835d3e012a51ff70cb7bc4 (patch) | |
tree | 866b168f47fbe98e5ded3d5f33cf2a61051f82d0 /desktop/sources/scripts/lib | |
parent | 5c31ece4a376df80d92eb36cc5ff05efaa16d796 (diff) | |
download | Orca-5d888fa9ece5008dda835d3e012a51ff70cb7bc4.tar.gz Orca-5d888fa9ece5008dda835d3e012a51ff70cb7bc4.zip |
Added theme open
Diffstat (limited to 'desktop/sources/scripts/lib')
-rw-r--r-- | desktop/sources/scripts/lib/theme.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/desktop/sources/scripts/lib/theme.js b/desktop/sources/scripts/lib/theme.js index 9b8ac21..4b9e3b1 100644 --- a/desktop/sources/scripts/lib/theme.js +++ b/desktop/sources/scripts/lib/theme.js @@ -2,6 +2,8 @@ function Theme (noir, pale) { const themer = this + const fs = require('fs') + const { dialog, app } = require('electron').remote this.collection = { noir: noir, pale: pale } this.active = this.collection.noir @@ -80,6 +82,16 @@ function Theme (noir, pale) { reader.readAsText(file) } + this.open = function () { + console.log('Open') + let paths = dialog.showOpenDialog(app.win, { properties: ['openFile'] }) + if (!paths) { console.log('Nothing to load') } + fs.readFile(paths[0], 'utf8', function (err, data) { + if (err) throw err + themer.load(data) + }) + } + window.addEventListener('dragover', this.drag) window.addEventListener('drop', this.drop) |