from PySide6.QtWidgets import QWidget from ui_main_window import Ui_MainWindow from file_cmds import FileCmds from PySide6.QtGui import QFont class MainWindow(QWidget, Ui_MainWindow): def __init__(self): super().__init__() self.setupUi(self) self.windowTitle = "mediainfoSama" self.setWindowTitle(self.windowTitle) self.setAcceptDrops(True) self.setupConnections() #TEMP to remove #Set font to Mononoki system wise self.media_detail_plain_text_edit.setFont(QFont("Mononoki Nerd Font", 10)) def setupConnections(self): self.media_tracks_list_widget.itemClicked.connect(self.popuplate_content) def dragEnterEvent(self, event): event.accept() def dragMoveEvent(self, event): event.accept() def dropEvent(self, event): self.filePath = event.mimeData().urls()[0].toLocalFile() self.fileCmds = FileCmds(self.filePath) if self.fileCmds.file_exist() == False: return self.setWindowTitle(f"{self.filePath} - {self.windowTitle}") self.populate_tabs() item = self.media_tracks_list_widget.item(0).setSelected(True) self.popuplate_content() def populate_tabs(self): self.media_tracks_list_widget.clear() self.media_tracks_list_widget.addItems(self.fileCmds.tabsList) def popuplate_content(self): itemSelected = self.media_tracks_list_widget.selectedItems()[0].text() text = self.fileCmds.tabsContent[itemSelected] self.media_detail_plain_text_edit.setPlainText(text)