~russo79/mnemosyne-proj/force-matplotlib-pyqt4-backend

« back to all changes in this revision

Viewing changes to mnemosyne/mnemosyne/libmnemosyne/controllers/default_controller.py

  • Committer: Peter.Bienstman at UGent
  • Date: 2014-05-23 19:12:59 UTC
  • Revision ID: peter.bienstman@ugent.be-20140523191259-n787nf6vw2vnc6il
Fix overzealous warning about sister cards with different tags.

Show diffs side-by-side

added added

removed removed

Lines of Context:
319
319
        db = self.database()
320
320
        sch = self.scheduler()
321
321
        assert new_card_type.is_fact_data_valid(new_fact_data)
 
322
        # Determine the current tags in use for the sister cards. This
 
323
        # needs to be done before e.g. editing a cloze card creates new
 
324
        # cards which are as yet untagged.
 
325
        fact = db.fact(card.fact._id, is_id_internal=True)
 
326
        current_sister_cards = self.database().cards_from_fact(fact)
 
327
        current_tag_strings = set([sister_card.tag_string() \
 
328
            for sister_card in current_sister_cards])        
322
329
        # Change the card type if needed. This does not take into account
323
330
        # changes to fact yet, which will come just afterwards.
324
331
        result = self._change_card_type(card.fact, card.card_type,
350
357
        # entry for each sister card, which is needed when syncing with a
351
358
        # partner that does not have the concept of facts.
352
359
        tag_for_current_card_only = False
353
 
        sister_cards = self.database().cards_from_fact(fact)
354
 
        current_tag_strings = set(\
355
 
            [sister_card.tag_string() for sister_card in sister_cards])
356
360
        if len(current_tag_strings) > 1:
357
361
            tag_for_current_card_only = bool(self.main_widget().show_question(
358
362
            _("This card has different tags than its sister cards. Update tags for current card only or for all sister cards?"),
360
364
        old_tags = set()
361
365
        tags = db.get_or_create_tags_with_names(new_tag_names)
362
366
        modification_time = int(time.time())
363
 
        for sister_card in sister_cards:
 
367
        for sister_card in self.database().cards_from_fact(fact):
364
368
            sister_card.modification_time = modification_time
365
369
            if sister_card == card or not tag_for_current_card_only:
366
370
                old_tags = old_tags.union(sister_card.tags)