mediaInfoSama/main_window.py

48 lines
1.3 KiB
Python

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):
pass
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()
def populate_tabs(self, path = ''):
self.media_tracks_list_widget.clear()
self.media_tracks_list_widget.addItems(self.fileCmds.tabsList)
text = self.fileCmds.tabsContent["Basic"]
self.media_detail_plain_text_edit.setPlainText(text)