gui app for windows fix

This commit is contained in:
zserg 2016-01-27 22:38:08 +03:00
parent 70724d59ac
commit 0055aa3a62
7 changed files with 17 additions and 49 deletions

View File

@ -186,18 +186,3 @@ button {
small {
font-size:.7em;
}
#holder {
border: 4px dashed #ccc;
margin: 0 auto;
height: 100px;
color: #ccc;
font-size: 40px;
line-height: 100px;
text-align: center;
-webkit-user-select: none;
}
#holder.hover {
border: 4px dashed #999;
color: #eee;
}

View File

@ -15,7 +15,7 @@
How can I help you? <em>-- Elodie</em><i></i>
</div>
<form class="importPhotos" action="" method="post">
<div class="content">
<div id="content" class="content">
<p>
Let me know where your photos are and where you'd like me to put them as I sort them.
</p>
@ -31,9 +31,6 @@
</div>
<div class="import-success"></div>
</div>
<div id="holder">
Drag your app here to run it
</div>
</form>
</body>
</html>

View File

@ -9,11 +9,9 @@ if(typeof(require) === 'function') {
var path = require('path');
var os = require('os');
ipc.on('files', function(files) {
console.log('--files',files);
__process__.files = files;
});
ipc.on('preview', function(files) {
console.log('--preview',files);
handlers.renderPreview(files);
});
ipc.on('update-import-success', function(args) {
@ -48,9 +46,6 @@ if(typeof(require) === 'function') {
function Broadcast() {
this.send = function(name, message) {
console.log(message);
console.log(name);
console.log('broadcast ',message);
ipc.send(name, message);
};
}
@ -59,10 +54,8 @@ if(typeof(require) === 'function') {
var broadcast = new Broadcast();
window.ondragover = function (e){ e.preventDefault(); return false };
window.ondragover = function (e){ e.preventDefault(); return false };
var holder = document.getElementById('holder');
var holder = document.getElementById('content');
if(holder != null){
holder.ondragover = function () { this.className = 'hover'; return false; };
holder.ondragleave = function () { this.className = ''; return false; };
holder.ondrop = function (e) {
e.preventDefault();
files = []
@ -70,12 +63,6 @@ if(typeof(require) === 'function') {
console.log(e.dataTransfer.files[i].path);
files.push(e.dataTransfer.files[i].path);
}
console.log('files=',e.dataTransfer);
msg = {};
//msg['files'] = ['f1','f2','f3'];
msg['files'] = e.dataTransfer.files;
console.log('handlers:',msg['files'].length);
//broadcast.send('load-update-photos', msg);
broadcast.send('load-update-photos', files);
return false;
};
@ -201,9 +188,7 @@ function Handlers() {
html = '<label>You selected ' + (files.length > 1 ? 'these photos' : 'this photo') + '</label>';
for(var i=0; i<files.length && i<16; i++) {
if(files[i].match(/(mov|mp4|3gp|avi)/i) === null) {
console.log("preview:",fileUrl(files[i]));
html += '<div class="center-cropped" style="background-image:url(\'file://'+fileUrl(files[i])+'\');" title="'+files[i]+'"></div>';
console.log('html',html);
} else {
html += '<div class="center-cropped video"></div>';
}

View File

@ -18,7 +18,7 @@
<a href="index.html" class="right"><i class="icon-media-add"></i></a>
</div>
<form class="updatePhotos" action="" method="post">
<div class="content">
<div id="content" class="content">
<div class="location">
<label for="location-field"><i class="icon-map"></i>Change geolocation</label>
<input id="location-field" type="text" placeholder="i.e. Sunnyvale, CA">

View File

@ -24,7 +24,7 @@ exports.importPhotos = function(event, args) {
args['source'] = args['source'].normalize();
args['destination'] = args['destination'].normalize();
update_command = path.normalize(__dirname + '/../../elodie.py') + ' import --source="' + args['source'] + '" --destination="' + args['destination'] + '"';
update_command = path.normalize(__dirname + '/../../dist/elodie/elodie') + ' import --source="' + args['source'] + '" --destination="' + args['destination'] + '"';
//update_command = __dirname + '/../../elodie.py import --source="' + args['source'] + '" --destination="' + args['destination'] + '"';
console.log(update_command);
@ -73,8 +73,7 @@ exports.updatePhotos = function(event, args) {
return files
}
files = normalize(args['files'])
elodie_path = path.normalize(__dirname + '/../../elodie.py');
console.log(elodie_path);
elodie_path = path.normalize(__dirname + '/../../dist/elodie/elodie');
update_command = elodie_path +' update'
//update_command = __dirname + '/../../elodie.py update'
if(args['location'].length > 0) {

View File

@ -1,13 +1,14 @@
var exports = module.exports = {};
var fs = require('fs'),
os = require('os'),
defaultConfigFile = (function() {
var f = __dirname;
for(var i=0; i<2; i++) {
f = f.substr(0, f.lastIndexOf('\\'));
f = f.substr(0, f.lastIndexOf(os.platform() == 'win32' ? '\\' : '/'));
}
return f + '\\config.ini-sample';
return f + (os.platform() == 'win32' ? '\\config.ini-sample': '/config.ini-sample');
})(),
configFile = (process.env.HOME || process.env.USERPROFILE) + '\\.elodie\\config.ini',
configFile = (process.env.HOME || process.env.USERPROFILE) + (os.platform() == 'win32' ? '\\.elodie\\config.ini' : '/.elodie/config.ini'),
hasConfig,
setConfig;

View File

@ -5,11 +5,15 @@ var menubar = require('menubar'),
tray = require('tray'),
config = require('./config.js'),
loadUrl = null;
var os = require('os')
var s_dir = __dirname.substr(0,__dirname.lastIndexOf(os.platform() == 'win32' ? '\\' : '/')) +
(os.platform() == 'win32' ? '\\html' : '/html');
exports.app = app = menubar(
{
preloadWindow: true,
dir: __dirname.substr(0, __dirname.lastIndexOf('\\')) + '\\html',
dir: s_dir,
index: 'index.html',
pages: {
'blank': 'blank.html',
@ -19,8 +23,8 @@ exports.app = app = menubar(
width: 400,
height: 500,
'window-position': 'trayCenter',
'frame': true,
'always-on-top': true
'frame': os.platform() == 'win32' ? true : false,
'always-on-top': os.platform() == 'win32' ? true : false
}
);
@ -62,10 +66,7 @@ exports.ready = function() {
};
exports.onDropFiles = function(event, args) {
console.log(args);
console.log('onDropFiles',args);
var files = args;
console.log('Hello',typeof(args));
loadUrl = app.getOption('pages')['location'];
app.showWindow();
@ -93,7 +94,7 @@ exports.show = function() {
this.window.loadUrl('file://' + this.getOption('dir') + '/' + loadUrl);
loadUrl = null;
app.window.openDevTools();
//app.window.openDevTools();
};
exports.afterShow = function() {