Make selection adjustment permanent and improve consistency
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
parent
92b1e0b648
commit
e62432307f
File diff suppressed because one or more lines are too long
|
@ -185,6 +185,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
self.tabsData = self.saveCharacterTabs() # Used for restoring tabsData with loadCharacterTabs() methods.
|
self.tabsData = self.saveCharacterTabs() # Used for restoring tabsData with loadCharacterTabs() methods.
|
||||||
self.BulkManageUi = None
|
self.BulkManageUi = None
|
||||||
self.bulkAffectedCharacters = []
|
self.bulkAffectedCharacters = []
|
||||||
|
self.isPersoBulkModeEnabled = False
|
||||||
|
|
||||||
def updateDockVisibility(self, restore=False):
|
def updateDockVisibility(self, restore=False):
|
||||||
"""
|
"""
|
||||||
|
@ -317,18 +318,15 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
|
|
||||||
# Set the column headers
|
# Set the column headers
|
||||||
model.setColumnCount(2)
|
model.setColumnCount(2)
|
||||||
model.setHorizontalHeaderLabels(["Name", "Value"])
|
model.setHorizontalHeaderLabels([self.tr("Name"), self.tr("Value")])
|
||||||
|
|
||||||
# Set the width
|
# Set the width
|
||||||
bulkPersoInfoManagerUi.tableView.horizontalHeader().setStretchLastSection(True)
|
self.updatePersoInfoView(bulkPersoInfoManagerUi.tableView)
|
||||||
bulkPersoInfoManagerUi.tableView.horizontalHeader().setMinimumSectionSize(20)
|
|
||||||
bulkPersoInfoManagerUi.tableView.horizontalHeader().setMaximumSectionSize(500)
|
|
||||||
|
|
||||||
bulkPersoInfoManagerUi.tableView.setModel(model) # Set the model of tableView
|
bulkPersoInfoManagerUi.tableView.setModel(model) # Set the model of tableView
|
||||||
|
|
||||||
|
|
||||||
self.tabPersos.clear()
|
self.tabPersos.clear()
|
||||||
self.tabPersos.addTab(bulkPersoInfoManager, "Bulk Info Manager")
|
self.tabPersos.addTab(bulkPersoInfoManager, self.tr("Bulk Info Manager"))
|
||||||
self.isPersoBulkModeEnabled = True
|
self.isPersoBulkModeEnabled = True
|
||||||
self.refreshBulkAffectedCharacters()
|
self.refreshBulkAffectedCharacters()
|
||||||
|
|
||||||
|
@ -373,7 +371,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
# Get the data from the tableview
|
# Get the data from the tableview
|
||||||
model = bulkUi.tableView.model()
|
model = bulkUi.tableView.model()
|
||||||
if model.rowCount() == 0:
|
if model.rowCount() == 0:
|
||||||
QMessageBox.warning(self, "No Entries!", "Please add entries to apply to the selected characters.")
|
QMessageBox.warning(self, self.tr("No Entries!"),
|
||||||
|
self.tr("Please add entries to apply to the selected characters."))
|
||||||
return
|
return
|
||||||
|
|
||||||
# Loop through each selected character and add the bulk info to them
|
# Loop through each selected character and add the bulk info to them
|
||||||
|
@ -383,9 +382,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
value = model.item(row, 1).text()
|
value = model.item(row, 1).text()
|
||||||
self.lstCharacters._model.addCharacterInfo(ID, description, value)
|
self.lstCharacters._model.addCharacterInfo(ID, description, value)
|
||||||
|
|
||||||
QMessageBox.information(self, "Bulk Info Applied", "The bulk info has been applied to the selected characters.")
|
QMessageBox.information(self, self.tr("Bulk Info Applied"),
|
||||||
|
self.tr("The bulk info has been applied to the selected characters."))
|
||||||
|
|
||||||
#Remove all rows from the table
|
# Remove all rows from the table
|
||||||
model.removeRows(0, model.rowCount())
|
model.removeRows(0, model.rowCount())
|
||||||
|
|
||||||
def addBulkInfo(self, bulkUi): # Adds an item to the list
|
def addBulkInfo(self, bulkUi): # Adds an item to the list
|
||||||
|
@ -404,6 +404,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
bulkUi.tableView.model().appendRow(row)
|
bulkUi.tableView.model().appendRow(row)
|
||||||
|
|
||||||
bulkUi.tableView.update()
|
bulkUi.tableView.update()
|
||||||
|
|
||||||
def removeBulkInfo(self, bulkUi):
|
def removeBulkInfo(self, bulkUi):
|
||||||
# Get the selected rows
|
# Get the selected rows
|
||||||
selection = bulkUi.tableView.selectionModel().selectedRows()
|
selection = bulkUi.tableView.selectionModel().selectedRows()
|
||||||
|
@ -412,8 +413,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
for index in reversed(selection):
|
for index in reversed(selection):
|
||||||
bulkUi.tableView.model().removeRow(index.row())
|
bulkUi.tableView.model().removeRow(index.row())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def saveCharacterTabs(self):
|
def saveCharacterTabs(self):
|
||||||
tabsData = []
|
tabsData = []
|
||||||
for i in range(self.tabPersos.count()):
|
for i in range(self.tabPersos.count()):
|
||||||
|
@ -465,9 +464,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
for character in self.lstCharacters.currentCharacters():
|
for character in self.lstCharacters.currentCharacters():
|
||||||
self.bulkAffectedCharacters.append(character.name())
|
self.bulkAffectedCharacters.append(character.name())
|
||||||
|
|
||||||
|
|
||||||
def changeCurrentCharacter(self, character, trash=None):
|
def changeCurrentCharacter(self, character, trash=None):
|
||||||
|
|
||||||
if character is None:
|
if character is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -500,13 +497,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
self.tblPersoInfos.setRootIndex(index)
|
self.tblPersoInfos.setRootIndex(index)
|
||||||
|
|
||||||
if self.mdlCharacter.rowCount(index):
|
if self.mdlCharacter.rowCount(index):
|
||||||
self.updatePersoInfoView()
|
self.updatePersoInfoView(self.tblPersoInfos)
|
||||||
|
|
||||||
|
def updatePersoInfoView(self, infoView):
|
||||||
def updatePersoInfoView(self):
|
infoView.horizontalHeader().setStretchLastSection(True)
|
||||||
self.tblPersoInfos.horizontalHeader().setSectionResizeMode(0, QHeaderView.ResizeToContents)
|
infoView.horizontalHeader().setMinimumSectionSize(20)
|
||||||
self.tblPersoInfos.horizontalHeader().setSectionResizeMode(1, QHeaderView.Stretch)
|
infoView.horizontalHeader().setMaximumSectionSize(500)
|
||||||
self.tblPersoInfos.verticalHeader().hide()
|
infoView.verticalHeader().hide()
|
||||||
|
|
||||||
def updateCharacterColor(self, ID):
|
def updateCharacterColor(self, ID):
|
||||||
c = self.mdlCharacter.getCharacterByID(ID)
|
c = self.mdlCharacter.getCharacterByID(ID)
|
||||||
|
@ -1120,6 +1117,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
widget.setCurrentModelIndex(self.mdlFlatData.index(0, col))
|
widget.setCurrentModelIndex(self.mdlFlatData.index(0, col))
|
||||||
|
|
||||||
# Characters
|
# Characters
|
||||||
|
self.updatePersoInfoView(self.tblPersoInfos)
|
||||||
self.lstCharacters.setCharactersModel(self.mdlCharacter)
|
self.lstCharacters.setCharactersModel(self.mdlCharacter)
|
||||||
self.tblPersoInfos.setModel(self.mdlCharacter)
|
self.tblPersoInfos.setModel(self.mdlCharacter)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -313,9 +313,9 @@ class Ui_MainWindow(object):
|
||||||
self.verticalLayout_8 = QtWidgets.QVBoxLayout(self.groupBox)
|
self.verticalLayout_8 = QtWidgets.QVBoxLayout(self.groupBox)
|
||||||
self.verticalLayout_8.setObjectName("verticalLayout_8")
|
self.verticalLayout_8.setObjectName("verticalLayout_8")
|
||||||
self.lstCharacters = characterTreeView(self.groupBox)
|
self.lstCharacters = characterTreeView(self.groupBox)
|
||||||
self.lstCharacters.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
|
||||||
self.lstCharacters.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
self.lstCharacters.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
self.lstCharacters.setDragEnabled(True)
|
self.lstCharacters.setDragEnabled(True)
|
||||||
|
self.lstCharacters.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||||
self.lstCharacters.setObjectName("lstCharacters")
|
self.lstCharacters.setObjectName("lstCharacters")
|
||||||
self.lstCharacters.headerItem().setText(0, "1")
|
self.lstCharacters.headerItem().setText(0, "1")
|
||||||
self.verticalLayout_8.addWidget(self.lstCharacters)
|
self.verticalLayout_8.addWidget(self.lstCharacters)
|
||||||
|
|
|
@ -670,6 +670,9 @@
|
||||||
<property name="dragEnabled">
|
<property name="dragEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
|
</property>
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">1</string>
|
<string notr="true">1</string>
|
||||||
|
|
Loading…
Reference in New Issue