mediaInfoSama/main_window.py

48 lines
1.3 KiB
Python
Raw Normal View History

from PySide6.QtWidgets import QWidget
from ui_main_window import Ui_MainWindow
from file_cmds import FileCmds
2022-12-13 21:35:40 +01:00
from PySide6.QtGui import QFont
class MainWindow(QWidget, Ui_MainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
2022-12-13 21:35:40 +01:00
self.windowTitle = "mediainfoSama"
self.setWindowTitle(self.windowTitle)
self.setAcceptDrops(True)
self.setupConnections()
2022-12-13 21:35:40 +01:00
#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
2022-12-13 21:35:40 +01:00
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
2022-12-13 21:35:40 +01:00
self.setWindowTitle(f"{self.filePath} - {self.windowTitle}")
self.populate_tabs()
2022-12-13 21:35:40 +01:00
def populate_tabs(self, path = ''):
self.media_tracks_list_widget.clear()
2022-12-13 21:35:40 +01:00
self.media_tracks_list_widget.addItems(self.fileCmds.tabsList)
text = self.fileCmds.tabsContent["Basic"]
self.media_detail_plain_text_edit.setPlainText(text)