Merge pull request #2466 from yeaido/feature/compare_highlight

Feature/compare highlight
This commit is contained in:
Anton Vorobyov
2022-09-30 16:40:43 +03:00
committed by GitHub
3 changed files with 25 additions and 0 deletions

4
.gitignore vendored
View File

@@ -90,6 +90,7 @@ target/
# pyenv
.python-version
PyfaEnv/
# celery beat schedule file
celerybeat-schedule
@@ -123,3 +124,6 @@ gitversion
*.fsdbinary
/locale/progress.json
# vscode settings
.vscode

BIN
eve.db Normal file

Binary file not shown.

View File

@@ -36,6 +36,9 @@ class ItemCompare(wx.Panel):
self.item = item
self.items = sorted(items, key=defaultSort)
self.attrs = {}
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:
@@ -88,6 +91,24 @@ class ItemCompare(wx.Panel):
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()