~kevang/mnemosyne-proj/grade-shortcuts-improvements

« back to all changes in this revision

Viewing changes to mnemosyne/mnemosyne/libmnemosyne/scheduler.py

  • Committer: pbienst
  • Date: 2006-02-09 16:13:13 UTC
  • Revision ID: svn-v3-trunk0:e5e6b78b-db40-0410-9517-b98c64f8d2c1:trunk:2
Initial revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# scheduler.py <Peter.Bienstman@UGent.be>
3
 
#
4
 
 
5
 
from mnemosyne.libmnemosyne.component import Component
6
 
 
7
 
 
8
 
class Scheduler(Component):
9
 
 
10
 
    name = ""
11
 
    component_type = "scheduler"
12
 
 
13
 
    def reset(self):
14
 
 
15
 
        """Called when starting the scheduler for the first time."""
16
 
 
17
 
        raise NotImplementedError
18
 
 
19
 
    def heartbeat(self):
20
 
 
21
 
        """For code that needs to run periodically."""
22
 
 
23
 
        pass
24
 
 
25
 
    def set_initial_grade(self, cards, grade):
26
 
 
27
 
        """Sets the initial grades for a set of sister cards, making sure
28
 
        their next repetitions do no fall on the same day.
29
 
 
30
 
        Called when cards are given their initial grade outside of the
31
 
        review process, e.g. when the user gives an initial grade when
32
 
        adding a new card in the GUI. Therefore, 'unseen' is still left to
33
 
        True, as this card has not yet been seen in the interactive review
34
 
        process.
35
 
 
36
 
        Cards which don't have initial grade information available (e.g. for
37
 
        cards created during import or conversion from different card type),
38
 
        get their initial grade when they are encountered in the interactive
39
 
        review process for the first time.
40
 
 
41
 
        In both cases, this initial grading is seen as the first repetition.
42
 
 
43
 
        In this way, both types of cards are treated in the same way. (There
44
 
        is an ineffectual asymmetry left in the log messages they generate,
45
 
        but all the relevant information can still be parsed from them.)
46
 
 
47
 
        """
48
 
 
49
 
        raise NotImplementedError
50
 
 
51
 
    def avoid_sister_cards(self, card):
52
 
 
53
 
        """Change card.next_rep to make sure that the card is not scheduled
54
 
        on the same day as a sister card.
55
 
 
56
 
        Factored out here to allow this to be used by e.g. MnemoGogo.
57
 
 
58
 
        """
59
 
 
60
 
        raise NotImplementedError
61
 
 
62
 
    def rebuild_queue(self, learn_ahead=False):
63
 
 
64
 
        """Called by the rest of the library when an existing queue risks
65
 
        becoming invalid, e.g. when cards have been deleted in the GUI.
66
 
        'next_card' also makes use of this in certain implementations.
67
 
 
68
 
        """
69
 
 
70
 
        raise NotImplementedError
71
 
 
72
 
    def is_in_queue(self, card):
73
 
 
74
 
        """To check whether the queue needs to be rebuilt, e.g. if it contains
75
 
        a card that was deleted in the GUI.
76
 
 
77
 
        """
78
 
 
79
 
        raise NotImplementedError
80
 
 
81
 
    def remove_from_queue_if_present(self, card):
82
 
        raise NotImplementedError
83
 
 
84
 
    def next_card(self, learn_ahead=False):
85
 
        raise NotImplementedError
86
 
 
87
 
    def is_prefetch_allowed(self):
88
 
 
89
 
        """Can we display a new card before having processed the grading of
90
 
        the previous one?
91
 
 
92
 
        """
93
 
 
94
 
        raise NotImplementedError
95
 
 
96
 
    def grade_answer(self, card, new_grade, dry_run=False):
97
 
        raise NotImplementedError
98
 
 
99
 
    def scheduled_count(self):
100
 
        raise NotImplementedError
101
 
 
102
 
    def non_memorised_count(self):
103
 
        raise NotImplementedError
104
 
 
105
 
    def active_count(self):
106
 
        raise NotImplementedError
107
 
 
108
 
    def card_count_scheduled_n_days_from_now(self, n):
109
 
 
110
 
        """Yesterday: n=-1, today: n=0, tomorrow: n=1, ... .
111
 
 
112
 
        Is not implemented in the database, because this could need internal
113
 
        scheduler information.
114
 
        """
115
 
 
116
 
        raise NotImplementedError
117
 
 
118
 
    def next_rep_to_interval_string(self, next_rep, now=None):
119
 
 
120
 
        """Converts next_rep to a string like 'tomorrow', 'in 2 weeks', ...
121
 
 
122
 
        """
123
 
 
124
 
        raise NotImplementedError
125
 
 
126
 
    def last_rep_to_interval_string(self, last_rep, now=None):
127
 
 
128
 
        """Converts last_rep to a string like 'yesterday', '2 weeks ago', ...
129
 
 
130
 
        """
131
 
 
132
 
        raise NotImplementedError