Commit 38b5c2f1 authored by Vincent Texier's avatar Vincent Texier

[fix] fix open in browser menu in network view

parent 821cfcc2
from duniterpy.api.client import Client, API
from .model import NetworkModel
from .view import NetworkView
from PyQt5.QtWidgets import QAction, QMenu
......@@ -77,9 +79,11 @@ class NetworkController(QObject):
node = self.sender().data()
bma_endpoints = [e for e in node.endpoints if isinstance(e, BMAEndpoint)]
if bma_endpoints:
conn_handler = next(bma_endpoints[0].conn_handler())
peering_url = bma.API(conn_handler, bma.network.URL_PATH).reverse_url(
conn_handler.http_scheme, "/peering"
client = Client(bma_endpoints[0])
# fixme: duniterpy should compose API in Client and should return url from endpoint easily, see #126
api_ = API(client.endpoint.conn_handler(client.session, client.proxy))
peering_url = api_.reverse_url(
api_.connection_handler.http_scheme, "/network/peering"
)
url = QUrl(peering_url)
QDesktopServices.openUrl(url)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment