refresh table when updated

This commit is contained in:
Thomas Peetz
2025-01-05 21:47:27 +01:00
parent 04dfe483e4
commit bdf2b2ba43
7 changed files with 50 additions and 13 deletions
+20 -7
View File
@@ -6,8 +6,7 @@ from pathlib import Path
import yaml
from PySide6.QtGui import QAction, QIcon
from PySide6.QtSql import QSqlDatabase
from PySide6.QtWidgets import QWidget, QVBoxLayout, QMenu, QMessageBox, QTabWidget, QTableView
from PySide6.QtWidgets import QWidget, QVBoxLayout, QMenu, QMessageBox, QTabWidget, QTableView, QHBoxLayout, QCheckBox
from PySide6.QtWidgets import QApplication, QLabel, QMainWindow
from platformdirs import PlatformDirs
@@ -21,11 +20,11 @@ class MainWindow(QMainWindow):
def __init__(self, config):
super().__init__()
self.tick = QIcon('tick.png')
self.cross = QIcon('cross.png')
self.import_icon = QIcon("application-import.png")
self.export_icon = QIcon("application-export.png")
self.circle_icon = QIcon("arrow-circle-double.png")
self.tick = QIcon('res/tick.png')
self.cross = QIcon('res/cross.png')
self.import_icon = QIcon("res/application-import.png")
self.export_icon = QIcon("res/application-export.png")
self.circle_icon = QIcon("res/arrow-circle-double.png")
self.setWindowTitle("Kontor")
self.setMinimumSize(800, 500)
@@ -35,6 +34,7 @@ class MainWindow(QMainWindow):
self._createStatusBar()
self.data = []
self.filter = {}
self.central_widget = QWidget()
parent_layout = QVBoxLayout()
self.central_widget.setLayout(parent_layout)
@@ -111,11 +111,24 @@ class MainWindow(QMainWindow):
def generate_tab_media_file(self, db_configuration):
media_file_tab = QWidget()
layout = QVBoxLayout()
filter_layout = QHBoxLayout()
download_checkbox = QCheckBox()
download_checkbox.setText("Download")
download_checkbox.checkStateChanged.connect(self.refresh)
self.filter["download"] = download_checkbox
review_checkbox = QCheckBox()
review_checkbox.setText("Review")
review_checkbox.checkStateChanged.connect(self.refresh)
self.filter["review"] = review_checkbox
filter_layout.addWidget(review_checkbox)
filter_layout.addWidget(download_checkbox)
filter_layout.addStretch()
model = MediaFileTableModel(db_configuration, self)
self.data.append(model)
media_file_tab.setLayout(layout)
table_view = QTableView()
table_view.setModel(model)
layout.addLayout(filter_layout)
layout.addWidget(table_view)
return media_file_tab