Skip to content
Snippets Groups Projects
Commit 38b5c2f1 authored by Vincent Texier's avatar Vincent Texier
Browse files

[fix] fix open in browser menu in network view

parent 821cfcc2
Branches
Tags
2 merge requests!7810.52.0,!780Issue 807
from duniterpy.api.client import Client, API
from .model import NetworkModel from .model import NetworkModel
from .view import NetworkView from .view import NetworkView
from PyQt5.QtWidgets import QAction, QMenu from PyQt5.QtWidgets import QAction, QMenu
...@@ -77,9 +79,11 @@ class NetworkController(QObject): ...@@ -77,9 +79,11 @@ class NetworkController(QObject):
node = self.sender().data() node = self.sender().data()
bma_endpoints = [e for e in node.endpoints if isinstance(e, BMAEndpoint)] bma_endpoints = [e for e in node.endpoints if isinstance(e, BMAEndpoint)]
if bma_endpoints: if bma_endpoints:
conn_handler = next(bma_endpoints[0].conn_handler()) client = Client(bma_endpoints[0])
peering_url = bma.API(conn_handler, bma.network.URL_PATH).reverse_url( # fixme: duniterpy should compose API in Client and should return url from endpoint easily, see #126
conn_handler.http_scheme, "/peering" 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) url = QUrl(peering_url)
QDesktopServices.openUrl(url) QDesktopServices.openUrl(url)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment