Skip to content

Commit

Permalink
RARC tab: Enable multi-select editing compression and preload
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Sep 14, 2024
1 parent c5bb970 commit 3f74cbc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
8 changes: 6 additions & 2 deletions gcft_ui/custom_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,12 @@ def setEditorData(self, editor: QComboBox, index):
else:
editor.setCurrentIndex(-1)

def setModelData(self, editor: QComboBox, model, index):
model.setData(index, editor.currentText(), Qt.ItemDataRole.EditRole)
def setModelData(self, editor: QComboBox, model, primary_index):
selection_model: QItemSelectionModel = editor.parent().parent().selectionModel()
assert primary_index in selection_model.selectedIndexes()
for row_index in selection_model.selectedRows():
item_index = primary_index.siblingAtRow(row_index.row())
model.setData(item_index, editor.currentText(), Qt.ItemDataRole.EditRole)

class ReadOnlyDelegate(QItemDelegate):
def editorEvent(self, event, model, option, index):
Expand Down
8 changes: 6 additions & 2 deletions gcft_ui/rarc_tab.ui
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@
</widget>
</item>
<item>
<widget class="QTreeView" name="rarc_files_tree"/>
<widget class="QTreeView" name="rarc_files_tree">
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
</widget>
</item>
</layout>
<action name="actionReplaceRARCFile">
Expand Down Expand Up @@ -168,7 +172,7 @@
<string>Load J3D Animation</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::NoRole</enum>
<enum>QAction::NoRole</enum>
</property>
</action>
</widget>
Expand Down
11 changes: 6 additions & 5 deletions gcft_ui/uic/ui_rarc_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
################################################################################
## Form generated from reading UI file 'rarc_tab.ui'
##
## Created by: Qt User Interface Compiler version 6.7.1
## Created by: Qt User Interface Compiler version 6.6.3
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
Expand All @@ -16,9 +16,9 @@
QIcon, QImage, QKeySequence, QLinearGradient,
QPainter, QPalette, QPixmap, QRadialGradient,
QTransform)
from PySide6.QtWidgets import (QApplication, QCheckBox, QHBoxLayout, QHeaderView,
QLineEdit, QPushButton, QSizePolicy, QTreeView,
QVBoxLayout, QWidget)
from PySide6.QtWidgets import (QAbstractItemView, QApplication, QCheckBox, QHBoxLayout,
QHeaderView, QLineEdit, QPushButton, QSizePolicy,
QTreeView, QVBoxLayout, QWidget)

class Ui_RARCTab(object):
def setupUi(self, RARCTab):
Expand Down Expand Up @@ -51,7 +51,7 @@ def setupUi(self, RARCTab):
self.actionReplaceAllFilesInRARCFolder.setObjectName(u"actionReplaceAllFilesInRARCFolder")
self.actionLoadJ3DAnim = QAction(RARCTab)
self.actionLoadJ3DAnim.setObjectName(u"actionLoadJ3DAnim")
self.actionLoadJ3DAnim.setMenuRole(QAction.MenuRole.NoRole)
self.actionLoadJ3DAnim.setMenuRole(QAction.NoRole)
self.verticalLayout = QVBoxLayout(RARCTab)
self.verticalLayout.setObjectName(u"verticalLayout")
self.horizontalLayout = QHBoxLayout()
Expand Down Expand Up @@ -122,6 +122,7 @@ def setupUi(self, RARCTab):

self.rarc_files_tree = QTreeView(RARCTab)
self.rarc_files_tree.setObjectName(u"rarc_files_tree")
self.rarc_files_tree.setSelectionMode(QAbstractItemView.ExtendedSelection)

self.verticalLayout.addWidget(self.rarc_files_tree)

Expand Down

0 comments on commit 3f74cbc

Please sign in to comment.