New list height + new populate signal
Increase the height of the QListWidget Now populate the content with selectionChanged insted of Clicked, allow to select with arrow keys
This commit is contained in:
parent
733a9b61ac
commit
0ffc67e04a
@ -29,11 +29,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="media_tracks_list_widget"/>
|
||||
<widget class="QListWidget" name="tracks_list_widget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="media_detail_plain_text_edit">
|
||||
<widget class="QPlainTextEdit" name="detail_plain_text_edit">
|
||||
<property name="undoRedoEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
@ -39,18 +39,18 @@ class Ui_MainWindow(object):
|
||||
|
||||
self.verticalLayout.addWidget(self.lineEdit)
|
||||
|
||||
self.media_tracks_list_widget = QListWidget(self.layoutWidget)
|
||||
self.media_tracks_list_widget.setObjectName(u"media_tracks_list_widget")
|
||||
self.tracks_list_widget = QListWidget(self.layoutWidget)
|
||||
self.tracks_list_widget.setObjectName(u"tracks_list_widget")
|
||||
|
||||
self.verticalLayout.addWidget(self.media_tracks_list_widget)
|
||||
self.verticalLayout.addWidget(self.tracks_list_widget)
|
||||
|
||||
self.splitter.addWidget(self.layoutWidget)
|
||||
self.media_detail_plain_text_edit = QPlainTextEdit(self.splitter)
|
||||
self.media_detail_plain_text_edit.setObjectName(u"media_detail_plain_text_edit")
|
||||
self.media_detail_plain_text_edit.setUndoRedoEnabled(False)
|
||||
self.media_detail_plain_text_edit.setLineWrapMode(QPlainTextEdit.NoWrap)
|
||||
self.media_detail_plain_text_edit.setReadOnly(True)
|
||||
self.splitter.addWidget(self.media_detail_plain_text_edit)
|
||||
self.detail_plain_text_edit = QPlainTextEdit(self.splitter)
|
||||
self.detail_plain_text_edit.setObjectName(u"detail_plain_text_edit")
|
||||
self.detail_plain_text_edit.setUndoRedoEnabled(False)
|
||||
self.detail_plain_text_edit.setLineWrapMode(QPlainTextEdit.NoWrap)
|
||||
self.detail_plain_text_edit.setReadOnly(True)
|
||||
self.splitter.addWidget(self.detail_plain_text_edit)
|
||||
|
||||
self.verticalLayout_2.addWidget(self.splitter)
|
||||
|
||||
@ -63,6 +63,6 @@ class Ui_MainWindow(object):
|
||||
def retranslateUi(self, MainWindow):
|
||||
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Form", None))
|
||||
self.lineEdit.setText(QCoreApplication.translate("MainWindow", u"Search", None))
|
||||
self.media_detail_plain_text_edit.setPlainText("")
|
||||
self.detail_plain_text_edit.setPlainText("")
|
||||
# retranslateUi
|
||||
|
||||
|
@ -2,6 +2,7 @@ from PySide6.QtWidgets import QWidget
|
||||
from ui_main_window import Ui_MainWindow
|
||||
from file_cmds import FileCmds
|
||||
from PySide6.QtGui import QFont
|
||||
from PySide6.QtCore import QSize
|
||||
|
||||
|
||||
class MainWindow(QWidget, Ui_MainWindow):
|
||||
@ -13,13 +14,13 @@ class MainWindow(QWidget, Ui_MainWindow):
|
||||
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))
|
||||
font = "UbuntuMono NF"
|
||||
self.tracks_list_widget.setFont(QFont(font, 12))
|
||||
self.detail_plain_text_edit.setFont(QFont(font, 12))
|
||||
|
||||
|
||||
def setupConnections(self):
|
||||
self.media_tracks_list_widget.itemClicked.connect(self.popuplate_content)
|
||||
self.tracks_list_widget.itemSelectionChanged.connect(self.popuplate_content)
|
||||
|
||||
|
||||
def dragEnterEvent(self, event):
|
||||
@ -39,16 +40,21 @@ class MainWindow(QWidget, Ui_MainWindow):
|
||||
|
||||
self.setWindowTitle(f"{self.filePath} - {self.windowTitle}")
|
||||
self.populate_tabs()
|
||||
item = self.media_tracks_list_widget.item(0).setSelected(True)
|
||||
self.popuplate_content()
|
||||
|
||||
self.tracks_list_widget.item(0).setSelected(True)
|
||||
|
||||
|
||||
def populate_tabs(self):
|
||||
self.media_tracks_list_widget.clear()
|
||||
self.media_tracks_list_widget.addItems(self.fileCmds.tabsList)
|
||||
self.tracks_list_widget.clear()
|
||||
self.tracks_list_widget.addItems(self.fileCmds.tabsList)
|
||||
|
||||
for i in range(self.tracks_list_widget.count()):
|
||||
item = self.tracks_list_widget.item(i)
|
||||
height = self.tracks_list_widget.sizeHintForRow(0)
|
||||
item.setSizeHint(QSize(0, height+5))
|
||||
|
||||
|
||||
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)
|
||||
itemsSelected = self.tracks_list_widget.selectedItems()
|
||||
if itemsSelected:
|
||||
text = self.fileCmds.tabsContent[itemsSelected[0].text()]
|
||||
self.detail_plain_text_edit.setPlainText(text)
|
@ -39,18 +39,18 @@ class Ui_MainWindow(object):
|
||||
|
||||
self.verticalLayout.addWidget(self.lineEdit)
|
||||
|
||||
self.media_tracks_list_widget = QListWidget(self.layoutWidget)
|
||||
self.media_tracks_list_widget.setObjectName(u"media_tracks_list_widget")
|
||||
self.tracks_list_widget = QListWidget(self.layoutWidget)
|
||||
self.tracks_list_widget.setObjectName(u"tracks_list_widget")
|
||||
|
||||
self.verticalLayout.addWidget(self.media_tracks_list_widget)
|
||||
self.verticalLayout.addWidget(self.tracks_list_widget)
|
||||
|
||||
self.splitter.addWidget(self.layoutWidget)
|
||||
self.media_detail_plain_text_edit = QPlainTextEdit(self.splitter)
|
||||
self.media_detail_plain_text_edit.setObjectName(u"media_detail_plain_text_edit")
|
||||
self.media_detail_plain_text_edit.setUndoRedoEnabled(False)
|
||||
self.media_detail_plain_text_edit.setLineWrapMode(QPlainTextEdit.NoWrap)
|
||||
self.media_detail_plain_text_edit.setReadOnly(True)
|
||||
self.splitter.addWidget(self.media_detail_plain_text_edit)
|
||||
self.detail_plain_text_edit = QPlainTextEdit(self.splitter)
|
||||
self.detail_plain_text_edit.setObjectName(u"detail_plain_text_edit")
|
||||
self.detail_plain_text_edit.setUndoRedoEnabled(False)
|
||||
self.detail_plain_text_edit.setLineWrapMode(QPlainTextEdit.NoWrap)
|
||||
self.detail_plain_text_edit.setReadOnly(True)
|
||||
self.splitter.addWidget(self.detail_plain_text_edit)
|
||||
|
||||
self.verticalLayout_2.addWidget(self.splitter)
|
||||
|
||||
@ -63,6 +63,6 @@ class Ui_MainWindow(object):
|
||||
def retranslateUi(self, MainWindow):
|
||||
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Form", None))
|
||||
self.lineEdit.setText(QCoreApplication.translate("MainWindow", u"Search", None))
|
||||
self.media_detail_plain_text_edit.setPlainText("")
|
||||
self.detail_plain_text_edit.setPlainText("")
|
||||
# retranslateUi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user