@@ -36,6 +36,10 @@ def __init__(self, parent, stuff, item, items, context=None):
36
36
self .item = item
37
37
self .items = sorted (items , key = defaultSort )
38
38
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 = []
39
43
40
44
# get a dict of attrName: attrInfo of all unique attributes across all items
41
45
for item in self .items :
@@ -88,6 +92,24 @@ def __init__(self, parent, stuff, item, items, context=None):
88
92
self .toggleViewBtn .Bind (wx .EVT_TOGGLEBUTTON , self .ToggleViewMode )
89
93
self .Bind (wx .EVT_LIST_COL_CLICK , self .SortCompareCols )
90
94
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
+
91
113
def SortCompareCols (self , event ):
92
114
self .Freeze ()
93
115
self .paramList .ClearAll ()
@@ -214,4 +236,4 @@ def attributeIDCallback():
214
236
fvalue = v
215
237
return "%s %s" % (fvalue , override [1 ])
216
238
else :
217
- return "%s %s" % (formatAmount (value , 3 , 0 ), unitName )
239
+ return "%s %s" % (formatAmount (value , 3 , 0 ), unitName )
0 commit comments