moxious / triage

testing triage actions for issues
0 stars 1 forks source link

PyQt can't open grafana correctly #368

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

if you are seeing this, Grafana has failed to load its application files

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

Hi @tonypowa, it looks like you are encountering an issue related to embedding Grafana dashboards into a PyQt application. This problem might be due to Grafana's frontend aspects or configuration settings that affect how it runs within a web engine environment. I recommend you to create an issue in the Frontend Platform project, as they might have more insights on integrations with different web view environments and can help troubleshoot the issue with embedding.

moxious commented 4 days ago

Summary: User tonypowa reports an issue when attempting to load Grafana URLs using PyQt's QWebEngineView, with the application files failing to load, though the URLs work in a standard web browser. The issue remains open and unresolved.

moxious commented 4 days ago

Elaboration:

Hi @tonypowa,

Thank you for reaching out for help with your issue related to opening Grafana in a PyQt application. In order to assist you more effectively, there are a few pieces of information that could be very helpful:

  1. Error Messages: Are there any error messages in Python's console when trying to open the Grafana URL? If so, could you please include them?
  2. Grafana Version: Which version of Grafana are you using?
  3. PyQt Version: What version of PyQt are you currently using?
  4. Web Engine: Are there any particular configurations you have set up with the QWebEngine that might be relevant?
  5. Network Information: Is there any network security setup, such as CORS policy, that might be blocking the rendering?
  6. Reproduction Steps: Can you provide detailed steps for someone to reproduce the issue on their end? This could include specific setup instructions for PyQt and Grafana.
  7. Development Environment: Information about your operating system and development environment could also be relevant.
  8. Screenshot/Video: The screenshot link you've provided does not seem to work. Could you please upload the screenshot again or confirm the link?

Providing this additional information could be vital for diagnosing and resolving the issue you're encountering. Once you've provided it, the community might be able to offer more targeted advice.

Best regards, The Open Source Community Support Team