Skip to content

Commit ce6910f

Browse files
committed
Added highlight feature to the compare item window. Double click and item to highlight and bold it.
1 parent 7892e63 commit ce6910f

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ target/
9090

9191
# pyenv
9292
.python-version
93+
PyfaEnv/
9394

9495
# celery beat schedule file
9596
celerybeat-schedule
@@ -123,3 +124,6 @@ gitversion
123124

124125
*.fsdbinary
125126
/locale/progress.json
127+
128+
launch.json
129+
eve.db

gui/builtinItemStatsViews/itemCompare.py

+23-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ def __init__(self, parent, stuff, item, items, context=None):
3636
self.item = item
3737
self.items = sorted(items, key=defaultSort)
3838
self.attrs = {}
39+
self.defaultRowBackgroundColour = None
40+
self.HighlightOn = wx.Colour(255, 255, 0, wx.ALPHA_OPAQUE)
41+
self.HighlightOff = wx.Colour(-1, -1, -1, -127)
42+
self.highlightedRows = []
3943

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

95+
self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.HighlightRow)
96+
97+
def HighlightRow(self, event):
98+
itemIdx = event.GetIndex()
99+
item = self.paramList.GetItem(itemIdx)
100+
if itemIdx in self.highlightedRows:
101+
item.SetBackgroundColour(self.HighlightOff)
102+
f = item.GetFont()
103+
f.SetWeight(wx.FONTWEIGHT_NORMAL)
104+
item.SetFont(f)
105+
self.highlightedRows.remove(itemIdx)
106+
else:
107+
item.SetBackgroundColour(self.HighlightOn)
108+
item.SetFont(item.GetFont().MakeBold())
109+
self.highlightedRows.append(itemIdx)
110+
self.paramList.SetItem(item)
111+
112+
91113
def SortCompareCols(self, event):
92114
self.Freeze()
93115
self.paramList.ClearAll()
@@ -214,4 +236,4 @@ def attributeIDCallback():
214236
fvalue = v
215237
return "%s %s" % (fvalue, override[1])
216238
else:
217-
return "%s %s" % (formatAmount(value, 3, 0), unitName)
239+
return "%s %s" % (formatAmount(value, 3, 0), unitName)

0 commit comments

Comments
 (0)