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):
|
||||
self.version = "0.3.2"
|
||||
self.rev = 395
|
||||
self.rev = 396
|
||||
self.argv = argv
|
||||
self.action = None
|
||||
self.createParser()
|
||||
|
|
|
@ -85,8 +85,9 @@ class Connection(object):
|
|||
|
||||
# Detect protocol
|
||||
self.send({"cmd": "handshake", "req_id": 0, "params": self.handshakeInfo()})
|
||||
event_connected = self.event_connected
|
||||
gevent.spawn(self.messageLoop)
|
||||
return self.event_connected.get() # Wait for handshake
|
||||
return event_connected.get() # Wait for handshake
|
||||
|
||||
# Handle incoming connection
|
||||
def handleIncomingConnection(self, sock):
|
||||
|
@ -170,6 +171,7 @@ class Connection(object):
|
|||
if crypt:
|
||||
self.crypt = crypt
|
||||
self.event_connected.set(True) # Mark handshake as done
|
||||
self.event_connected = None
|
||||
|
||||
# Handle incoming message
|
||||
def handleMessage(self, message):
|
||||
|
@ -350,7 +352,8 @@ class Connection(object):
|
|||
return False # Already closed
|
||||
self.closed = True
|
||||
self.connected = False
|
||||
self.event_connected.set(False)
|
||||
if self.event_connected:
|
||||
self.event_connected.set(False)
|
||||
|
||||
if config.debug_socket:
|
||||
self.log(
|
||||
|
@ -373,3 +376,4 @@ class Connection(object):
|
|||
# Little cleanup
|
||||
self.sock = None
|
||||
self.unpacker = None
|
||||
self.event_connected = None
|
||||
|
|
|
@ -482,10 +482,10 @@ class ContentManager(object):
|
|||
hash_valid = CryptHash.sha1sum(file) == file_info["sha1"]
|
||||
else:
|
||||
hash_valid = False
|
||||
if file_info["size"] != file.tell():
|
||||
if file_info.get("size", 0) != file.tell():
|
||||
self.log.error(
|
||||
"%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 hash_valid
|
||||
|
|
|
@ -117,6 +117,8 @@ class Wrapper
|
|||
body.append(button)
|
||||
@notifications.add("notification-#{caption}", "ask", body)
|
||||
|
||||
setTimeout (-> button.focus() ), 1500
|
||||
|
||||
|
||||
actionConfirm: (message, cb=false) ->
|
||||
message.params = @toHtmlSafe(message.params) # Escape html
|
||||
|
@ -126,7 +128,6 @@ class Wrapper
|
|||
return false
|
||||
|
||||
|
||||
|
||||
displayPrompt: (message, type, caption, cb) ->
|
||||
body = $("<span class='message'>"+message+"</span>")
|
||||
|
||||
|
@ -144,6 +145,8 @@ class Wrapper
|
|||
|
||||
@notifications.add("notification-#{message.id}", "ask", body)
|
||||
|
||||
setTimeout (-> input.focus() ), 1500
|
||||
|
||||
|
||||
actionPrompt: (message) ->
|
||||
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.on("click", cb);
|
||||
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) {
|
||||
|
@ -943,7 +946,10 @@ jQuery.extend( jQuery.easing,
|
|||
};
|
||||
})(this));
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue