Skip to content

Commit

Permalink
feat: make monitor server standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
giulioungaretti authored and jenshnielsen committed Sep 11, 2017
1 parent f81fd2f commit 7138f07
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions qcodes/monitor/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ def run(self):
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)
Monitor.running = self
self.show()
self.loop.run_forever()

def stop(self):
Expand Down Expand Up @@ -196,7 +195,7 @@ def __init__(self, port=3000):
def run(self):
os.chdir(self.static_dir)
log.debug("serving directory %s", self.static_dir)
log.debug("serving at port", self.port)
log.info("Open broswer at http://localhost::{}".format(self.port))
self.httpd.serve_forever()

def stop(self):
Expand All @@ -205,5 +204,10 @@ def stop(self):


if __name__ == "__main__":
server = Server()
server.run()
server = Server(SERVER_PORT)
print("Open broswer at http://localhost:{}".format(server.port))
try:
webbrowser.open("http://localhost:{}".format(server.port))
server.run()
except KeyboardInterrupt:
exit()

0 comments on commit 7138f07

Please sign in to comment.