First commit
This commit is contained in:
1 parent
b1828bae9a
commit
5e01a3d0c8
2 files changed
+61
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
.venv
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
import sys
|
||||||
|
import requests
|
||||||
|
import webbrowser
|
||||||
|
from PyQt6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QPushButton, QLabel, QWidget
|
||||||
|
from PyQt6.QtCore import QSize
|
||||||
|
|
||||||
|
class MyWindow(QMainWindow):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
self.setMinimumSize(QSize(300, 100))
|
||||||
|
self.setWindowTitle("Hello QT - Test")
|
||||||
|
|
||||||
|
layout = QVBoxLayout()
|
||||||
|
|
||||||
|
self.gitea = QLabel("Gitea: ")
|
||||||
|
self.jellyfin = QLabel("Jellyfin: ")
|
||||||
|
self.music = QLabel("Music: ")
|
||||||
|
b1 = QPushButton("Refresh")
|
||||||
|
|
||||||
|
# Verbindung zur Test-Methode
|
||||||
|
b1.clicked.connect(self.refresh)
|
||||||
|
|
||||||
|
layout.addWidget(self.gitea)
|
||||||
|
layout.addWidget(self.jellyfin)
|
||||||
|
layout.addWidget(self.music)
|
||||||
|
layout.addWidget(b1)
|
||||||
|
|
||||||
|
central_widget = QWidget()
|
||||||
|
central_widget.setLayout(layout)
|
||||||
|
self.setCentralWidget(central_widget)
|
||||||
|
|
||||||
|
def refresh(self):
|
||||||
|
r_gitea = requests.get("https://gitea.dansbude.org/")
|
||||||
|
r_jellyfin = requests.get("https://jellyfin.dansbude.org/")
|
||||||
|
r_music = requests.get("https://music.dansbude.org/")
|
||||||
|
|
||||||
|
webbrowser.open("https://gitea.dansbude.org/")
|
||||||
|
|
||||||
|
if r_gitea.status_code == 200:
|
||||||
|
self.gitea.setText("Gitea: ONLINE")
|
||||||
|
else:
|
||||||
|
self.gitea.setText("Gitea: ERROR")
|
||||||
|
|
||||||
|
if r_jellyfin.status_code == 200:
|
||||||
|
# Text ändern
|
||||||
|
self.jellyfin.setText("Jellyfin: ONLINE")
|
||||||
|
else:
|
||||||
|
self.jellyfin.setText("Jellyfin: ERROR")
|
||||||
|
|
||||||
|
if r_music.status_code == 200:
|
||||||
|
self.music.setText("Music: ONLINE")
|
||||||
|
else:
|
||||||
|
self.music.setText("Music: ERROR")
|
||||||
|
|
||||||
|
# Wichtig: Nutzen Sie QApplication direkt aus QtWidgets
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
win = MyWindow()
|
||||||
|
win.show()
|
||||||
|
sys.exit(app.exec())
|
||||||
Reference in new issue
Block a user