Exemplo n.º 1
0
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self._stats = None
     self.type = PERIOD_MONTH
     self.width = 600
     self.height = 200
     self.wholeCollection = False
Exemplo n.º 2
0
    def __init__(self, col: anki.storage._Collection, server=None) -> None:
        self.col = col.weakref()
        self.server = server

        # these are set later; provide dummy values for type checking
        self.lnewer = False
        self.maxUsn = 0
        self.tablesLeft: List[str] = []
Exemplo n.º 3
0
 def __init__(self, col: anki.storage._Collection, id: Optional[int] = None) -> None:
     self.col = col.weakref()
     self.timerStarted = None
     self._render_output: Optional[anki.template.TemplateRenderOutput] = None
     if id:
         # existing card
         self.id = id
         self.load()
     else:
         # new card with defaults
         self._load_from_backend_card(BackendCard())
Exemplo n.º 4
0
 def __init__(  # pylint: disable=super-init-not-called
         self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self.queueLimit = 50
     self.reportLimit = 1000
     self.dynReportLimit = 99999
     self.reps = 0
     self.lrnCount = 0
     self.revCount = 0
     self.newCount = 0
     self.today: Optional[int] = None
     self._haveQueues = False
     self._updateCutoff()
Exemplo n.º 5
0
Arquivo: media.py Projeto: venhow/anki
 def __init__(self, col: anki.storage._Collection, server: bool) -> None:
     self.col = col.weakref()
     if server:
         self._dir = None
         return
     # media directory
     self._dir = media_paths_from_col_path(self.col.path)[0]
     if not os.path.exists(self._dir):
         os.makedirs(self._dir)
     try:
         self._oldcwd = os.getcwd()
     except OSError:
         # cwd doesn't exist
         self._oldcwd = None
     try:
         os.chdir(self._dir)
     except OSError:
         raise Exception("invalidTempFolder")
Exemplo n.º 6
0
    def __init__(
        self,
        col: anki.storage._Collection,
        model: Optional[NoteType] = None,
        id: Optional[int] = None,
    ) -> None:
        assert not (model and id)
        self.col = col.weakref()
        # self.newlyAdded = False

        if id:
            # existing note
            self.id = id
            self.load()
        else:
            # new note for provided notetype
            self._load_from_backend_note(self.col.backend.new_note(
                model["id"]))
Exemplo n.º 7
0
 def __init__(
     self,
     col: anki.storage._Collection,
     model: Optional[NoteType] = None,
     id: Optional[int] = None,
 ) -> None:
     assert not (model and id)
     self.col = col.weakref()
     self.newlyAdded = False
     if id:
         self.id = id
         self.load()
     else:
         self.id = timestampID(col.db, "notes")
         self.guid = guid64()
         self._model = model
         self.mid = model["id"]
         self.tags = []
         self.fields = [""] * len(self._model["flds"])
         self.flags = 0
         self.data = ""
         self._fmap = self.col.models.fieldMap(self._model)
         self.scm = self.col.scm
Exemplo n.º 8
0
    def __init__(
        self,
        col: anki.storage._Collection,
        card: Card,
        note: Note,
        browser: bool = False,
        notetype: NoteType = None,
        template: Optional[Dict] = None,
        fill_empty: bool = False,
    ) -> None:
        self._col = col.weakref()
        self._card = card
        self._note = note
        self._browser = browser
        self._template = template
        self._fill_empty = fill_empty
        if not notetype:
            self._note_type = note.model()
        else:
            self._note_type = notetype

        # if you need to store extra state to share amongst rendering
        # hooks, you can insert it into this dictionary
        self.extra_state: Dict[str, Any] = {}
Exemplo n.º 9
0
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self.models = ModelsDictProxy(col)
     # do not access this directly!
     self._cache = {}
Exemplo n.º 10
0
 def __init__(self, col: anki.storage._Collection):
     self._col = col.weakref()
Exemplo n.º 11
0
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
Exemplo n.º 12
0
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self.decks = {}
     self.dconf = {}
Exemplo n.º 13
0
 def __init__(self, col: anki.storage._Collection,
              card: anki.cards.Card) -> None:
     if col:
         self.col = col.weakref()
     self.card = card
     self.txt = ""
Exemplo n.º 14
0
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self.decks = {}
     self._dconf_cache: Optional[Dict[int, Dict[str, Any]]] = None
Exemplo n.º 15
0
Arquivo: decks.py Projeto: venhow/anki
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self.decks = DecksDictProxy(col)
Exemplo n.º 16
0
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self.models = {}
     self.changed = False
Exemplo n.º 17
0
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self.tags: Dict[str, int] = {}