Skip to content

Commit

Permalink
Operation's icons were updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
titov-vv committed Feb 2, 2024
1 parent 69cbfc2 commit 456a382
Show file tree
Hide file tree
Showing 33 changed files with 58 additions and 30 deletions.
25 changes: 17 additions & 8 deletions jal/db/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,11 @@ class Dividend(LedgerTransaction):

def __init__(self, operation_id=None):
icons = {
Dividend.Dividend: JalIcons.INTEREST,
Dividend.BondInterest: JalIcons.INTEREST,
Dividend.StockDividend: JalIcons.NONE,
Dividend.StockVesting: JalIcons.NONE,
Dividend.BondAmortization: JalIcons.NONE
Dividend.Dividend: JalIcons.DIVIDEND,
Dividend.BondInterest: JalIcons.BOND_INTEREST,
Dividend.StockDividend: JalIcons.STOCK_DIVIDEND,
Dividend.StockVesting: JalIcons.STOCK_VESTING,
Dividend.BondAmortization: JalIcons.BOND_AMORTIZATION
}
self.names = {
Dividend.NA: self.tr("UNDEFINED"),
Expand Down Expand Up @@ -1024,8 +1024,8 @@ def __init__(self, operation_id=None):
CorporateAction.Merger: JalIcons.MERGER,
CorporateAction.SpinOff: JalIcons.SPINOFF,
CorporateAction.Split: JalIcons.SPLIT,
CorporateAction.SymbolChange: JalIcons.NONE,
CorporateAction.Delisting: JalIcons.NONE
CorporateAction.SymbolChange: JalIcons.SYMBOL_CHANGE,
CorporateAction.Delisting: JalIcons.DELISTING
}
self.names = {
CorporateAction.NA: self.tr("UNDEFINED"),
Expand Down Expand Up @@ -1217,6 +1217,15 @@ class TermDeposit(LedgerTransaction):
}

def __init__(self, operation_id=None, display_type=None):
icons = {
DepositActions.Opening: JalIcons.DEPOSIT_OPEN,
DepositActions.TopUp: JalIcons.DEPOSIT_OPEN,
DepositActions.Renewal: JalIcons.DEPOSIT_OPEN,
DepositActions.PartialWithdrawal: JalIcons.DEPOSIT_CLOSE,
DepositActions.Closing: JalIcons.DEPOSIT_CLOSE,
DepositActions.InterestAccrued: JalIcons.INTEREST,
DepositActions.TaxWithheld: JalIcons.TAX
}
super().__init__(operation_id)
self._otype = LedgerTransaction.TermDeposit
self._aid = display_type # action id
Expand All @@ -1236,7 +1245,7 @@ def __init__(self, operation_id=None, display_type=None):
self._amount = self._get_deposit_amount()
else:
self._amount = Decimal(self._data['amount'])
self._icon = JalIcons().icon(JalIcons.TAX)
self._icon = JalIcons().icon(icons[self._action])
self._oname = f'{DepositActions().get_name(self._action)}'

def _get_deposit_amount(self) -> Decimal:
Expand Down
Binary file added jal/img/ui_amortization.ico
Binary file not shown.
Binary file modified jal/img/ui_buy.ico
Binary file not shown.
Binary file added jal/img/ui_coupon.ico
Binary file not shown.
Binary file added jal/img/ui_delisting.ico
Binary file not shown.
Binary file added jal/img/ui_deposit_close.ico
Binary file not shown.
Binary file added jal/img/ui_deposit_open.ico
Binary file not shown.
Binary file added jal/img/ui_dividend.ico
Binary file not shown.
Binary file added jal/img/ui_dividend_stock.ico
Binary file not shown.
Binary file added jal/img/ui_fee.ico
Binary file not shown.
Binary file removed jal/img/ui_fee.png
Binary file not shown.
Binary file added jal/img/ui_interest.ico
Binary file not shown.
Binary file removed jal/img/ui_interest.png
Binary file not shown.
Binary file added jal/img/ui_merger.ico
Binary file not shown.
Binary file removed jal/img/ui_merger.png
Binary file not shown.
Binary file modified jal/img/ui_minus.ico
Binary file not shown.
Binary file modified jal/img/ui_plus.ico
Binary file not shown.
Binary file added jal/img/ui_renaming.ico
Binary file not shown.
Binary file modified jal/img/ui_sell.ico
Binary file not shown.
Binary file added jal/img/ui_spinoff.ico
Binary file not shown.
Binary file removed jal/img/ui_spinoff.png
Binary file not shown.
Binary file added jal/img/ui_split.ico
Binary file not shown.
Binary file removed jal/img/ui_split.png
Binary file not shown.
Binary file added jal/img/ui_tax.ico
Binary file not shown.
Binary file removed jal/img/ui_tax.png
Binary file not shown.
Binary file added jal/img/ui_transfer_asset_in.ico
Binary file not shown.
Binary file added jal/img/ui_transfer_asset_out.ico
Binary file not shown.
Binary file added jal/img/ui_transfer_in.ico
Binary file not shown.
Binary file removed jal/img/ui_transfer_in.png
Binary file not shown.
Binary file added jal/img/ui_transfer_out.ico
Binary file not shown.
Binary file removed jal/img/ui_transfer_out.png
Binary file not shown.
Binary file added jal/img/ui_vesting.ico
Binary file not shown.
63 changes: 41 additions & 22 deletions jal/widgets/icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,50 @@
ICON_PREFIX = "ui_"
class JalIcons:
NONE = 0
PLUS = 1
MINUS = 2
BOND_AMORTIZATION = 1
BOND_INTEREST = 2
BUY = 3
SELL = 4
TRANSFER_IN = 5
TRANSFER_OUT = 6
FEE = 7
INTEREST = 8
MERGER = 9
SPINOFF = 10
SPLIT = 11
TAX = 12
DELISTING = 4
DEPOSIT_OPEN = 5
DEPOSIT_CLOSE = 6
DIVIDEND = 7
FEE = 8
INTEREST = 9
MERGER = 10
MINUS = 11
PLUS = 12
SELL = 13
SPINOFF = 14
SPLIT = 15
STOCK_DIVIDEND = 16
STOCK_VESTING = 17
SYMBOL_CHANGE = 18
TAX = 19
TRANSFER_IN = 20
TRANSFER_OUT = 21

_icon_files = {
BOND_AMORTIZATION: "amortization.ico",
BOND_INTEREST: "coupon.ico",
BUY: "buy.ico",
FEE: "fee.png",
INTEREST: "interest.png",
MERGER: "merger.png",
DELISTING: "delisting.ico",
DEPOSIT_OPEN: "deposit_open.ico",
DEPOSIT_CLOSE: "deposit_close.ico",
DIVIDEND: "dividend.ico",
FEE: "fee.ico",
INTEREST: "interest.ico",
MERGER: "merger.ico",
MINUS: "minus.ico",
PLUS: "plus.ico",
SELL: "sell.ico",
SPINOFF: "spinoff.png",
SPLIT: "split.png",
TAX: "tax.png",
TRANSFER_IN: "transfer_in.png",
TRANSFER_OUT: "transfer_out.png"
SPINOFF: "spinoff.ico",
SPLIT: "split.ico",
STOCK_DIVIDEND: "dividend_stock.ico",
STOCK_VESTING: "vesting.ico",
SYMBOL_CHANGE: "renaming.ico",
TAX: "tax.ico",
TRANSFER_IN: "transfer_in.ico",
TRANSFER_OUT: "transfer_out.ico"
}
_icons = {}

Expand All @@ -44,7 +63,7 @@ def __init__(self):
for icon_id, filename in self._icon_files.items():
self._icons[icon_id] = QIcon(img_path + filename)

def icon(self, id: int) -> QIcon:
if id not in self._icons:
def icon(self, icon_id: int) -> QIcon:
if icon_id not in self._icons:
return QIcon()
return self._icons[id]
return self._icons[icon_id]

0 comments on commit 456a382

Please sign in to comment.