Rev396, Cleanup gevent event after connecting finished, Autofocus on notification input/button, Missing file size info error fix
This commit is contained in:
parent
fa37f58982
commit
5c72030373
5 changed files with 21 additions and 8 deletions
|
@ -8,7 +8,7 @@ class Config(object):
|
||||||
|
|
||||||
def __init__(self, argv):
|
def __init__(self, argv):
|
||||||
self.version = "0.3.2"
|
self.version = "0.3.2"
|
||||||
self.rev = 395
|
self.rev = 396
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.action = None
|
self.action = None
|
||||||
self.createParser()
|
self.createParser()
|
||||||
|
|
|
@ -85,8 +85,9 @@ class Connection(object):
|
||||||
|
|
||||||
# Detect protocol
|
# Detect protocol
|
||||||
self.send({"cmd": "handshake", "req_id": 0, "params": self.handshakeInfo()})
|
self.send({"cmd": "handshake", "req_id": 0, "params": self.handshakeInfo()})
|
||||||
|
event_connected = self.event_connected
|
||||||
gevent.spawn(self.messageLoop)
|
gevent.spawn(self.messageLoop)
|
||||||
return self.event_connected.get() # Wait for handshake
|
return event_connected.get() # Wait for handshake
|
||||||
|
|
||||||
# Handle incoming connection
|
# Handle incoming connection
|
||||||
def handleIncomingConnection(self, sock):
|
def handleIncomingConnection(self, sock):
|
||||||
|
@ -170,6 +171,7 @@ class Connection(object):
|
||||||
if crypt:
|
if crypt:
|
||||||
self.crypt = crypt
|
self.crypt = crypt
|
||||||
self.event_connected.set(True) # Mark handshake as done
|
self.event_connected.set(True) # Mark handshake as done
|
||||||
|
self.event_connected = None
|
||||||
|
|
||||||
# Handle incoming message
|
# Handle incoming message
|
||||||
def handleMessage(self, message):
|
def handleMessage(self, message):
|
||||||
|
@ -350,7 +352,8 @@ class Connection(object):
|
||||||
return False # Already closed
|
return False # Already closed
|
||||||
self.closed = True
|
self.closed = True
|
||||||
self.connected = False
|
self.connected = False
|
||||||
self.event_connected.set(False)
|
if self.event_connected:
|
||||||
|
self.event_connected.set(False)
|
||||||
|
|
||||||
if config.debug_socket:
|
if config.debug_socket:
|
||||||
self.log(
|
self.log(
|
||||||
|
@ -373,3 +376,4 @@ class Connection(object):
|
||||||
# Little cleanup
|
# Little cleanup
|
||||||
self.sock = None
|
self.sock = None
|
||||||
self.unpacker = None
|
self.unpacker = None
|
||||||
|
self.event_connected = None
|
||||||
|
|
|
@ -482,10 +482,10 @@ class ContentManager(object):
|
||||||
hash_valid = CryptHash.sha1sum(file) == file_info["sha1"]
|
hash_valid = CryptHash.sha1sum(file) == file_info["sha1"]
|
||||||
else:
|
else:
|
||||||
hash_valid = False
|
hash_valid = False
|
||||||
if file_info["size"] != file.tell():
|
if file_info.get("size", 0) != file.tell():
|
||||||
self.log.error(
|
self.log.error(
|
||||||
"%s file size does not match %s <> %s, Hash: %s" %
|
"%s file size does not match %s <> %s, Hash: %s" %
|
||||||
(inner_path, file.tell(), file_info["size"], hash_valid)
|
(inner_path, file.tell(), file_info.get("size", 0), hash_valid)
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
return hash_valid
|
return hash_valid
|
||||||
|
|
|
@ -117,6 +117,8 @@ class Wrapper
|
||||||
body.append(button)
|
body.append(button)
|
||||||
@notifications.add("notification-#{caption}", "ask", body)
|
@notifications.add("notification-#{caption}", "ask", body)
|
||||||
|
|
||||||
|
setTimeout (-> button.focus() ), 1500
|
||||||
|
|
||||||
|
|
||||||
actionConfirm: (message, cb=false) ->
|
actionConfirm: (message, cb=false) ->
|
||||||
message.params = @toHtmlSafe(message.params) # Escape html
|
message.params = @toHtmlSafe(message.params) # Escape html
|
||||||
|
@ -126,7 +128,6 @@ class Wrapper
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
displayPrompt: (message, type, caption, cb) ->
|
displayPrompt: (message, type, caption, cb) ->
|
||||||
body = $("<span class='message'>"+message+"</span>")
|
body = $("<span class='message'>"+message+"</span>")
|
||||||
|
|
||||||
|
@ -144,6 +145,8 @@ class Wrapper
|
||||||
|
|
||||||
@notifications.add("notification-#{message.id}", "ask", body)
|
@notifications.add("notification-#{message.id}", "ask", body)
|
||||||
|
|
||||||
|
setTimeout (-> input.focus() ), 1500
|
||||||
|
|
||||||
|
|
||||||
actionPrompt: (message) ->
|
actionPrompt: (message) ->
|
||||||
message.params = @toHtmlSafe(message.params) # Escape html
|
message.params = @toHtmlSafe(message.params) # Escape html
|
||||||
|
|
|
@ -897,7 +897,10 @@ jQuery.extend( jQuery.easing,
|
||||||
button = $("<a href='#" + caption + "' class='button button-" + caption + "'>" + caption + "</a>");
|
button = $("<a href='#" + caption + "' class='button button-" + caption + "'>" + caption + "</a>");
|
||||||
button.on("click", cb);
|
button.on("click", cb);
|
||||||
body.append(button);
|
body.append(button);
|
||||||
return this.notifications.add("notification-" + caption, "ask", body);
|
this.notifications.add("notification-" + caption, "ask", body);
|
||||||
|
return setTimeout((function() {
|
||||||
|
return button.focus();
|
||||||
|
}), 1500);
|
||||||
};
|
};
|
||||||
|
|
||||||
Wrapper.prototype.actionConfirm = function(message, cb) {
|
Wrapper.prototype.actionConfirm = function(message, cb) {
|
||||||
|
@ -943,7 +946,10 @@ jQuery.extend( jQuery.easing,
|
||||||
};
|
};
|
||||||
})(this));
|
})(this));
|
||||||
body.append(button);
|
body.append(button);
|
||||||
return this.notifications.add("notification-" + message.id, "ask", body);
|
this.notifications.add("notification-" + message.id, "ask", body);
|
||||||
|
return setTimeout((function() {
|
||||||
|
return input.focus();
|
||||||
|
}), 1500);
|
||||||
};
|
};
|
||||||
|
|
||||||
Wrapper.prototype.actionPrompt = function(message) {
|
Wrapper.prototype.actionPrompt = function(message) {
|
||||||
|
|
Loading…
Reference in a new issue