Skip to content

Commit

Permalink
Column index constants were removed from ClosedTradesModel (and repla…
Browse files Browse the repository at this point in the history
…ced by fieldIndex() calls)
  • Loading branch information
titov-vv committed Feb 11, 2024
1 parent 883e53d commit 516227b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions jal/db/trades_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,18 @@ def data(self, index, role=Qt.DisplayRole):
def footerData(self, section: int, role=Qt.DisplayRole):
if role == Qt.DisplayRole:
total_data = self._root.details()
if section == 0:
if section == self.fieldIndex('symbol'):
return self.tr("Total:")
elif section == 9:
elif section == self.fieldIndex('p/l'):
return localize_decimal(total_data[self._columns[section]['field']], precision=2)
elif section == 10:
elif section == self.fieldIndex('p/l%'):
return self._total_currency_name
elif role == Qt.FontRole:
font = QFont()
font.setBold(True)
return font
elif role == Qt.TextAlignmentRole:
if section == 9:
if section == self.fieldIndex('p/l'):
return Qt.AlignRight | Qt.AlignVCenter
else:
return Qt.AlignLeft | Qt.AlignVCenter
Expand Down Expand Up @@ -188,7 +188,7 @@ def prepareData(self):
def configureView(self):
self._view.setSortingEnabled(True)
for column in range(self.columnCount()):
if column == 0:
if column == self.fieldIndex('symbol'):
self._view.setColumnWidth(column, 300)
else:
self._view.setColumnWidth(column, 100)
Expand Down

0 comments on commit 516227b

Please sign in to comment.