Skip to content

Commit

Permalink
server bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
itsMando committed Feb 13, 2025
1 parent 5dda70c commit 8913afc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion glimpse/electron-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ win:
- x64
mac:
target:
- target: dmg
- target: pkg
arch:
- arm64

Expand Down
4 changes: 1 addition & 3 deletions glimpse/local-server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@

GRAPH = nx.MultiGraph()

#Convert glm file to python dictionary
def glm_to_dict( file_paths: list ) -> dict:
glm_dicts = {}
for glm_path in file_paths:
glm_dicts[ path.basename(glm_path).split(".")[0] + ".json" ] = glm.load(glm_path)

return glm_dicts

#Converts glm dict to json
def dict2json( glm_dict: dict ) -> str:
glm_json = json.dumps( glm_dict, indent= 3 )
return glm_json
Expand Down Expand Up @@ -152,6 +150,6 @@ def delete_edge(edgeID):
#-------------------------- Start WebSocket Server --------------------------#

if __name__ == "__main__":
socketio.run(app, port=5051, debug=True)
socketio.run(app, port=5051, debug=False)

#-------------------------- End Start WebSocket Server --------------------------#
11 changes: 6 additions & 5 deletions glimpse/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const path = require("path");
const { io } = require("socket.io-client");
const fs = require("fs");
const Ajv = require("ajv");
// const kill = require("tree-kill");
// const log = require('electron-log');
// const { autoUpdater } = require("electron-updater");

Expand Down Expand Up @@ -437,8 +438,8 @@ const initiateServer = () => {
} else {
const python = spawn("python", [path.join(__dirname, "local-server", "server.py")]);
python.stdout.on("data", (data) => {
// console.log("data: ", data.toString("utf8"));
console.log("data: ", data);
console.log("data: ", data.toString("utf8"));
// console.log("data: ", data);
});
python.stderr.on("data", (data) => {
console.log(`log: ${data}`); // when error
Expand Down Expand Up @@ -475,10 +476,10 @@ app.whenReady()
});
});

// app.on("before-quit", () => kill(process.pid));

app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
app.quit();
});

app.on("activate", () => {
Expand Down

0 comments on commit 8913afc

Please sign in to comment.