moxious / triage

testing triage actions for issues
0 stars 1 forks source link

PyQt can't open grafana correctly #366

Open tonypowa opened 4 days ago

tonypowa commented 4 days ago

Dear all:

I'm working with grafana recently to show some figures and tables. While there're issues i found. When I try to open grafana url with PyQt,the fatal problem come out. My python code and the result as following

`

import sys

from PyQt5.QtWidgets import QApplication, QMainWindow

from PyQt5.QtCore import QUrl

from PyQt5.QtWebEngineWidgets import QWebEngineView

class GrafanaDashboard(QMainWindow):

def init(self, grafana_url):

super().init()

self.browser = QWebEngineView()

self.browser.load(QUrl(grafana_url))

clear all

self.browser.page().profile().clearAllVisitedLinks()

self.browser.page().profile().clearHttpCache()

self.browser.page().profile().cookieStore().deleteAllCookies()

Connect the loadFinished signal to the handler function

self.browser.loadFinished.connect(self.on_load_finished)

self.setCentralWidget(self.browser)

self.showMaximized()

Add a slot to handle the loadFinished signal

def on_load_finished(self, success):

The success parameter indicates whether the page was loaded successfully

if success:

print("Page loaded successfully")

else:

print("Failed to load the page")

if name == 'main':

app = QApplication(sys.argv)

grafana_url = 'http://10.1.160.133:3015'

mainWin = GrafanaDashboard(grafana_url)

mainWin.show()

sys.exit(app.exec_())`

and the results show

info1

I don't know the reason why it gets error. However, when the dashboard url is linked by webbrowser all is OK. Our group has decided to import PyQt to show the statistical tables and images with grafana dashboard url. This iussue bores us for a long time. If anyone who has sovled the same problem give me some useful imformation please.

Thanks a lot.

tonypowa commented 4 days ago

This issue is a test copy of an issue in another repo. Original issue: https://github.com/grafana/grafana/issues/#88402

moxious commented 4 days ago

Summary: User tonypowa reports an issue with opening a Grafana URL in a PyQt application, with errors encountered during page loading. The problem persists despite the dashboard working correctly when accessed via a web browser. Assistance is sought from anyone who has resolved a similar issue.

moxious commented 4 days ago

Elaboration:

Hello @tonypowa, thank you for reaching out to the community with your issue. To help pinpoint the problem you're facing with opening Grafana through PyQt, we need a bit more detailed information. Could you please provide the following additional details?

Once you provide more context and details, it will be easier for the community to assist you in resolving the issue.

moxious commented 4 days ago

Hi @tonypowa, it seems like your issue involves integrating Grafana with a PyQt application. This isn't directly related to Grafana's core functionality but appears to be more of an external application integration challenge. Nevertheless, your issue might be more effectively addressed by the Grafana App Platform project, as they might have insights into how the Grafana interface operates within external applications like PyQt. It may also be beneficial to share any error messages you're receiving to help diagnose the problem more accurately.