Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CardMonitoring: cards can be seen multiple times #30

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
CardMonitoring: Fix notifying observers when a card is removed
When setting newcardonly to False, it was impossible to know if a card
was removed or not, thus observers weren't notified.
  • Loading branch information
lburg committed Oct 5, 2016
commit 6b262f03bc98be083d9b8c381cdf986b7b75f748
7 changes: 3 additions & 4 deletions smartcard/CardMonitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ def run(self):

addedcards = []
for card in currentcards:
if not self.cards.__contains__(card):
# Always add cards as new if newcardonly is False
if not self.cards.__contains__(card) or not self.newcardonly:
addedcards.append(card)

removedcards = []
Expand All @@ -172,9 +173,7 @@ def run(self):
removedcards.append(card)

if addedcards != [] or removedcards != []:
if self.newcardonly:
# Record seen cards to skip them
self.cards = currentcards
self.cards = currentcards
self.observable.setChanged()
self.observable.notifyObservers(
(addedcards, removedcards))
Expand Down