Skip to content

Commit

Permalink
Added highlight feature to the compare item window. Double click and …
Browse files Browse the repository at this point in the history
…item to highlight and bold it.
  • Loading branch information
yeaido committed Sep 4, 2022
1 parent 7892e63 commit ce6910f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ target/

# pyenv
.python-version
PyfaEnv/

# celery beat schedule file
celerybeat-schedule
Expand Down Expand Up @@ -123,3 +124,6 @@ gitversion

*.fsdbinary
/locale/progress.json

launch.json
eve.db
24 changes: 23 additions & 1 deletion gui/builtinItemStatsViews/itemCompare.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def __init__(self, parent, stuff, item, items, context=None):
self.item = item
self.items = sorted(items, key=defaultSort)
self.attrs = {}
self.defaultRowBackgroundColour = None
self.HighlightOn = wx.Colour(255, 255, 0, wx.ALPHA_OPAQUE)
self.HighlightOff = wx.Colour(-1, -1, -1, -127)
self.highlightedRows = []

# get a dict of attrName: attrInfo of all unique attributes across all items
for item in self.items:
Expand Down Expand Up @@ -88,6 +92,24 @@ def __init__(self, parent, stuff, item, items, context=None):
self.toggleViewBtn.Bind(wx.EVT_TOGGLEBUTTON, self.ToggleViewMode)
self.Bind(wx.EVT_LIST_COL_CLICK, self.SortCompareCols)

self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.HighlightRow)

def HighlightRow(self, event):
itemIdx = event.GetIndex()
item = self.paramList.GetItem(itemIdx)
if itemIdx in self.highlightedRows:
item.SetBackgroundColour(self.HighlightOff)
f = item.GetFont()
f.SetWeight(wx.FONTWEIGHT_NORMAL)
item.SetFont(f)
self.highlightedRows.remove(itemIdx)
else:
item.SetBackgroundColour(self.HighlightOn)
item.SetFont(item.GetFont().MakeBold())
self.highlightedRows.append(itemIdx)
self.paramList.SetItem(item)


def SortCompareCols(self, event):
self.Freeze()
self.paramList.ClearAll()
Expand Down Expand Up @@ -214,4 +236,4 @@ def attributeIDCallback():
fvalue = v
return "%s %s" % (fvalue, override[1])
else:
return "%s %s" % (formatAmount(value, 3, 0), unitName)
return "%s %s" % (formatAmount(value, 3, 0), unitName)

0 comments on commit ce6910f

Please sign in to comment.