Skip to content

Commit

Permalink
added header overwrite option to TreeModel
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinga13 committed Aug 3, 2024
1 parent 2628a81 commit 4c771e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions OSCRUI/datamodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ class TreeModel(QAbstractItemModel):
"""
Data model for the analysis table
"""
def __init__(self, root_item, header_font: QFont, name_font: QFont, cell_font: QFont):
def __init__(
self, root_item, header_font: QFont, name_font: QFont, cell_font: QFont,
header_data=None):
"""
Initializes Tree Model with data in root item.
Expand Down Expand Up @@ -263,6 +265,10 @@ def __init__(self, root_item, header_font: QFont, name_font: QFont, cell_font: Q
self._header_font = header_font
self._name_font = name_font
self._cell_font = cell_font
if header_data is None:
self._header_data = self._root.data
else:
self._header_data = header_data
if root_item.get_child(0).get_data(0) == 'Player':
self._player = root_item.get_child(0)
self._npc = root_item.get_child(1)
Expand Down Expand Up @@ -326,7 +332,7 @@ def flags(self, index: QModelIndex) -> Qt.ItemFlag:

def headerData(self, section, orientation, role) -> str:
if role == Qt.ItemDataRole.DisplayRole:
return self._root.data[section]
return self._header_data[section]
elif role == Qt.ItemDataRole.FontRole:
return self._header_font
elif role == Qt.ItemDataRole.TextAlignmentRole:
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class Launcher():

version = '2024.07b250'
version = '2024.08b030'
__version__ = '0.2'

# holds the style of the app
Expand Down

0 comments on commit 4c771e6

Please sign in to comment.