Skip to content

Commit

Permalink
Reduce noisy output
Browse files Browse the repository at this point in the history
  • Loading branch information
dragly committed Jun 14, 2017
1 parent c639ff9 commit 4852c67
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 40 deletions.
7 changes: 3 additions & 4 deletions qml/MainDesktop.qml
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,13 @@ Item {
}

onYesClicked: {
console.log("Accepted, try saving")
saveCurrentOrOpenDialog(function() {
console.log("Save complete, request closing")
if (requestedAction) {
requestedAction()
}
})
}
onNoClicked: {
console.log("Rejected, request close")
ignoreUnsavedChanges = true
if (requestedAction) {
requestedAction()
Expand Down Expand Up @@ -613,7 +610,9 @@ Item {

Shortcut {
sequence: "Ctrl+Shift+S"
onActivated: {console.log("saveas"); root.saveAs()}
onActivated: {
root.saveAs()
}
}

}
1 change: 0 additions & 1 deletion qml/MainMobile.qml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ Item {
var imageUrl = StandardPaths.toLocalFile(StandardPaths.originalSimulationLocation(currentSimulationUrl)).replace(".nfy", ".png")

workspaceFlickable.grabToImage(function(result) {
console.log("Saving image to " + imageUrl);
result.saveToFile(imageUrl);
}, Qt.size(workspaceFlickable.width / 3.0, workspaceFlickable.height / 3.0));
}
Expand Down
20 changes: 9 additions & 11 deletions qml/Neuronify.qml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Rectangle {
function loadSimulation(fileUrl) {
var code = fileManager.read(fileUrl);
if(!code) {
console.log("Load state got empty contents.")
console.error("Load state got empty contents.")
return;
}
reloadState(code)
Expand Down Expand Up @@ -163,18 +163,18 @@ Rectangle {
// for(var i in properties) {
// console.log(i + ": " + properties[i])
// }
console.log("Cannot apply.")
console.error("Cannot apply.")
return
}

for(var i in properties) {
var prop = properties[i]
if(prop === undefined) {
console.log("WARNING: Got undefined property on", object, i)
console.error("Got undefined property on", object, i)
continue
}
if(!object.hasOwnProperty("savedProperties")) {
console.warn("WARNING: Object " + object + " is missing savedProperties property.");
console.error("Object " + object + " is missing savedProperties property.");
continue;
}
var found = false;
Expand All @@ -192,13 +192,13 @@ Rectangle {
}
}
if(!found) {
console.warn("WARNING: Cannot assign to " + i + " on savedProperties of " + object);
console.error("Cannot assign to " + i + " on savedProperties of " + object);
}
}
}

function loadState(data) {
console.log("Neuronify.loadState called")
console.log("Loading state...")
firstLoadTimer.stop() // stop in case we loaded before the initial simulations was loaded
pinchArea.scaleSetByDoubleClick = false

Expand All @@ -215,7 +215,7 @@ Rectangle {
for(var i in data.nodes) {
var node = data.nodes[i];
if(node.filename && node.filename === "neurons/PassiveNeuron.qml") {
console.log("Replacing PassiveNeuron with LeakyNeuron due to file format change in 3 to 4.")
console.warn("Replacing PassiveNeuron with LeakyNeuron due to file format change in 3 to 4.")
node.filename = "neurons/LeakyNeuron.qml";
}
}
Expand Down Expand Up @@ -311,7 +311,7 @@ Rectangle {
function undo(){
var previousState = undoList.pop()
if(!previousState) {
console.log("Nothing to undo!")
console.warn("Nothing to undo!")
return
}
console.log("Undoing...")
Expand All @@ -330,7 +330,7 @@ Rectangle {
function redo() {
var nextState = redoList.pop()
if(!nextState) {
console.log("Nothing to redo!")
console.warn("Nothing to redo!")
return
}
console.log("Redoing...")
Expand Down Expand Up @@ -407,7 +407,6 @@ Rectangle {
function deleteNode(node) {
registerUndoState()
undoRecordingDepth += 1
console.log("Deleting node", node);
if(selectedEntities.indexOf(node) !== -1) {
deselectAll();
}
Expand All @@ -421,7 +420,6 @@ Rectangle {
}

function deleteEdge(edge) {
console.log("Deleting edge", edge);
registerUndoState()
undoRecordingDepth += 1
graphEngine.removeEdge(edge)
Expand Down
41 changes: 24 additions & 17 deletions qml/backend/Parse.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Qt.labs.settings 1.0

Backend {
id: root
property bool debug: true
property bool debug: false
property string serverUrl: "https://parseapi.back4app.com/"
property string applicationId: "JffGes20AXUtdN9B6E1RkkHaS7DOxVmxJFSJgLoN"
property string restApiKey: "bBKStu7bqeyWFTYFfM5OIes255k9XEz2Voe4fUxS"
Expand All @@ -18,16 +18,10 @@ Backend {
}

readonly property bool loggedIn: {
console.log("Checking", sessionToken, objectId)
return sessionToken !== "" && objectId !== ""
}

onLoggedInChanged: {
console.log("Logged in", loggedIn)
}

onSessionTokenChanged: {
console.log("Session token changed", sessionToken)
if(!sessionToken) {
objectId = ""
return
Expand All @@ -42,15 +36,16 @@ Backend {
console.log("Successfully logged in with previous token.")
})
}
console.log("GET", url)
if (debug) {
console.log("GET", url)
}
req.send();
}

function setHeaders(req) {
req.setRequestHeader("X-Parse-Application-Id", applicationId);
req.setRequestHeader("X-Parse-REST-API-Key", restApiKey);
if(sessionToken) {
console.log("Using session token", sessionToken)
req.setRequestHeader("X-Parse-Session-Token", sessionToken);
}
}
Expand All @@ -63,7 +58,7 @@ Backend {
if(callback) {
var result = JSON.parse(req.responseText)
if(result.errors !== undefined) {
console.log("Error parsing", req.responseText)
console.error("Error parsing", req.responseText)
return
}
callback(result)
Expand Down Expand Up @@ -96,7 +91,9 @@ Backend {
}
})
}
console.log("GET", url)
if (debug) {
console.log("GET", url)
}
req.send();
}

Expand All @@ -108,7 +105,9 @@ Backend {
req.onreadystatechange = function() {
processReply(req, callback)
}
console.log("GET", url)
if (debug) {
console.log("GET", url)
}
req.send();
}

Expand All @@ -126,7 +125,9 @@ Backend {
}
}
}
console.log("GET", url)
if (debug) {
console.log("GET", url)
}
req.send()
}

Expand All @@ -138,7 +139,9 @@ Backend {
req.onreadystatechange = function() {
processReply(req, callback)
}
console.log("PUT", url)
if (debug) {
console.log("PUT", url)
}
req.send(JSON.stringify(data));
}

Expand All @@ -150,8 +153,10 @@ Backend {
req.onreadystatechange = function() {
processReply(req, callback)
}
console.log("POST", url, data)
console.log("Data", JSON.stringify(data))
if (debug) {
console.log("POST", url, data)
console.log("Data", JSON.stringify(data))
}
req.send(JSON.stringify(data));
}

Expand All @@ -167,7 +172,9 @@ Backend {
callback(result)
}
}
console.log("POST", url)
if (debug) {
console.debug("POST", url)
}
req.send(JSON.stringify(data, null, 4));
}

Expand Down
4 changes: 0 additions & 4 deletions qml/menus/filemenu/FileView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ Item {
signal runRequested(var simulation)
signal loadRequested(url file) // TODO remove

onRevealedChanged: console.log("REVEALED", revealed)

Material.theme: Material.Dark

function open(name) {
Expand Down Expand Up @@ -316,7 +314,6 @@ Item {
text: "From older versions"
onClicked: {
openDialog.open()
console.log("Opening", savedataSettings.location)
openDialog.folder = savedataSettings.location
}
}
Expand Down Expand Up @@ -559,7 +556,6 @@ Item {
description: modelData.description
imageUrl: modelData.screenshot.url
onClicked: {
console.log("Pushing", JSON.stringify(modelData))
stackView.push(simulationComponent)
stackView.currentItem.objectData = modelData
}
Expand Down
2 changes: 0 additions & 2 deletions qml/meters/SpikeDetector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ Node {
onEdgeRemoved: {
numberOfEdges -=1
var neuron = edge.itemB
console.log(neuron)
var newList = neurons
var index = newList.indexOf(neuron)
console.log("Index " + index)
if(index > -1) {
newList.splice(index, 1)
neurons = newList
Expand Down
1 change: 0 additions & 1 deletion qml/neurons/NeuronDashboard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ Rectangle {
text: "Threshold"
next: resetSlider.field
onValueChanged: {
console.log("CHange!")
if(value < resetSlider.value + 0.05) {
value = resetSlider.value + 0.05
}
Expand Down

0 comments on commit 4852c67

Please sign in to comment.