84 lines
2.8 KiB
Python
84 lines
2.8 KiB
Python
import sys
|
|
from PyQt6.QtWidgets import (QApplication, QMainWindow, QWidget,
|
|
QVBoxLayout, QHBoxLayout,
|
|
QLabel, QLineEdit, QListWidget,
|
|
QTableWidget, QHeaderView, QPushButton, QComboBox, QProgressBar)
|
|
|
|
|
|
class PortainerUi:
|
|
def __init__(self):
|
|
self.main_window = QMainWindow()
|
|
|
|
self.main_window.show()
|
|
self.main_window.setWindowTitle("Natalie")
|
|
|
|
self.search_box = QLineEdit()
|
|
self.combo_box = QComboBox()
|
|
|
|
search_layout = QHBoxLayout()
|
|
search_layout.addWidget(self.search_box)
|
|
search_layout.addWidget(self.combo_box)
|
|
|
|
self.stacks_list = QListWidget()
|
|
|
|
self.stack_name_label = QLabel()
|
|
self.endpoint_label = QLabel()
|
|
self.created_by_label = QLabel()
|
|
self.creation_date_label = QLabel()
|
|
self.updated_by_label = QLabel()
|
|
self.update_date_label = QLabel()
|
|
|
|
self.containers_table = QTableWidget()
|
|
self.containers_table.setColumnCount(4)
|
|
self.containers_table.setHorizontalHeaderLabels(["ID", "Name", "Status", "Image Status"])
|
|
self.containers_table.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.ResizeToContents)
|
|
self.containers_table.horizontalHeader().setStretchLastSection(True)
|
|
|
|
self.start = QPushButton("Start")
|
|
self.stop = QPushButton("Stop")
|
|
self.update = QPushButton("Update")
|
|
|
|
buttons_layout = QHBoxLayout()
|
|
buttons_layout.addWidget(self.start)
|
|
buttons_layout.addWidget(self.stop)
|
|
buttons_layout.addWidget(self.update)
|
|
|
|
info_layout = QVBoxLayout()
|
|
info_layout.addWidget(self.stack_name_label)
|
|
info_layout.addWidget(self.endpoint_label)
|
|
info_layout.addWidget(self.created_by_label)
|
|
info_layout.addWidget(self.creation_date_label)
|
|
info_layout.addWidget(self.updated_by_label)
|
|
info_layout.addWidget(self.update_date_label)
|
|
info_layout.addLayout(buttons_layout)
|
|
info_layout.addWidget(self.containers_table)
|
|
|
|
main_layout = QHBoxLayout()
|
|
main_layout.addWidget(self.stacks_list)
|
|
main_layout.addLayout(info_layout)
|
|
main_layout.setStretch(0, 1)
|
|
main_layout.setStretch(1, 2)
|
|
|
|
layout = QVBoxLayout()
|
|
layout.addLayout(search_layout)
|
|
layout.addLayout(main_layout)
|
|
|
|
widget = QWidget()
|
|
widget.setLayout(layout)
|
|
self.main_window.setCentralWidget(widget)
|
|
|
|
self.progress_bar = QProgressBar()
|
|
self.progress_bar.setTextVisible(False)
|
|
self.main_window.statusBar().addPermanentWidget(self.progress_bar)
|
|
self.progress_bar.hide()
|
|
|
|
def show(self):
|
|
self.main_window.show()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app = QApplication(sys.argv)
|
|
win = PortainerUi()
|
|
win.show()
|
|
sys.exit(app.exec())
|