PY-56669 SciView(fix): plots shown in wrong window

GitOrigin-RevId: 53573d890d8dfb87e8103a07c72fe60c94dcfd37
This commit is contained in:
Nikita.Ashihmin
2024-05-20 00:55:57 +04:00
committed by intellij-monorepo-bot
parent 426de238b2
commit a2208c4a22

View File

@@ -19,6 +19,7 @@ else:
__all__ = ['display']
HOST = os.getenv("PYCHARM_DISPLAY_HOST", "http://127.0.0.1")
PROJECT_HASH = os.getenv("PYCHARM_PROJECT_ID", "")
PORT_ENV = int(os.getenv("PYCHARM_DISPLAY_PORT", "-1"))
PORT = PORT_ENV
if PORT == -1:
@@ -57,7 +58,7 @@ def try_empty_proxy(buffer):
opener = urllib_request.build_opener(empty_proxy)
urllib_request.install_opener(opener)
try:
url = HOST + ":" + str(PORT) + "/api/python.scientific"
url = HOST + ":" + str(PORT) + "/api/python.scientific?project=" + PROJECT_HASH
urllib_request.urlopen(url, buffer)
except:
sys.stderr.write("Error: failed to send plot to %s:%s\n" % (HOST, PORT))
@@ -73,7 +74,7 @@ def _send_display_message(message_spec):
buffer = serialized.encode()
try:
debug("Sending display message to %s:%s" % (HOST, PORT))
url = HOST + ":" + str(PORT) + "/api/python.scientific"
url = HOST + ":" + str(PORT) + "/api/python.scientific?project=" + PROJECT_HASH
if PYCHARM_DISPLAY_HTTP_PROXY is not None:
debug("Using HTTP proxy %s" % PYCHARM_DISPLAY_HTTP_PROXY)