From 03ddabd80ded9bbb66ef39cc81b9065368b4a9e7 Mon Sep 17 00:00:00 2001 From: westnife3 Date: Wed, 27 Aug 2025 18:08:50 +0900 Subject: [PATCH] refs # qt6 grid 4 x 3 layout --- qtDash/main.py | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 qtDash/main.py diff --git a/qtDash/main.py b/qtDash/main.py new file mode 100644 index 0000000..722cc2a --- /dev/null +++ b/qtDash/main.py @@ -0,0 +1,60 @@ +from PyQt6.QtWidgets import ( + QApplication, QWidget, QVBoxLayout, QLabel, QGridLayout, QProgressBar +) +from PyQt6.QtCore import Qt, QTimer +import sys + +class LoadingScreen(QWidget): + def __init__(self): + super().__init__() + self.setFixedSize(960, 640) + self.setWindowTitle("서버 모니터링 - 로딩 중") + layout = QVBoxLayout() + layout.setAlignment(Qt.AlignmentFlag.AlignCenter) + + self.label = QLabel("서버 상태를 불러오는 중...") + self.label.setAlignment(Qt.AlignmentFlag.AlignCenter) + self.spinner = QProgressBar() + self.spinner.setRange(0, 0) # 무한 로딩 표시 + + layout.addWidget(self.label) + layout.addWidget(self.spinner) + self.setLayout(layout) + +class MonitoringGrid(QWidget): + def __init__(self): + super().__init__() + self.setFixedSize(960, 640) + self.setWindowTitle("서버 모니터링") + + grid = QGridLayout() + grid.setSpacing(10) + + for row in range(3): + for col in range(4): + label = QLabel(f"서버 {row * 3 + col + 1}") + label.setStyleSheet("background-color: #e0e0e0; padding: 20px; border: 1px solid #aaa;") + label.setAlignment(Qt.AlignmentFlag.AlignCenter) + grid.addWidget(label, row, col) + + self.setLayout(grid) + +class MainApp: + def __init__(self): + self.app = QApplication(sys.argv) + self.loading = LoadingScreen() + self.grid = MonitoringGrid() + + def run(self): + self.loading.show() + + # 3초 후 로딩 화면 종료하고 그리드 표시 + QTimer.singleShot(3000, self.show_grid) + sys.exit(self.app.exec()) + + def show_grid(self): + self.loading.close() + self.grid.show() + +if __name__ == "__main__": + MainApp().run()