Skip to content

Commit

Permalink
Ensure StarToggleButton hover states honor offline status
Browse files Browse the repository at this point in the history
  • Loading branch information
rmol committed Mar 13, 2020
1 parent 7066e9b commit 69d5b58
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1263,11 +1263,15 @@ def enable(self):
self.toggled.connect(self.on_toggle)

def eventFilter(self, obj, event):
checkable = self.isCheckable()
t = event.type()
if t == QEvent.HoverEnter:
if t == QEvent.HoverEnter and checkable:
self.setIcon(load_icon('star_hover.svg'))
elif t == QEvent.HoverLeave:
self.set_icon(on='star_on.svg', off='star_off.svg')
if checkable:
self.set_icon(on='star_on.svg', off='star_off.svg')
else:
self.set_icon(on='star_on.svg', off='star_on.svg')
return QObject.event(obj, event)

def on_authentication_changed(self, authenticated: bool):
Expand Down

0 comments on commit 69d5b58

Please sign in to comment.