コード例 #1
0
ファイル: stats.py プロジェクト: zenogantner/anki
 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
コード例 #2
0
ファイル: sync.py プロジェクト: xiaowenhuman/anki
    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] = []
コード例 #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())
コード例 #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()
コード例 #5
0
ファイル: media.py プロジェクト: 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")
コード例 #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"]))
コード例 #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
コード例 #8
0
ファイル: template.py プロジェクト: venhow/anki
    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] = {}
コード例 #9
0
ファイル: models.py プロジェクト: venhow/anki
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self.models = ModelsDictProxy(col)
     # do not access this directly!
     self._cache = {}
コード例 #10
0
ファイル: models.py プロジェクト: venhow/anki
 def __init__(self, col: anki.storage._Collection):
     self._col = col.weakref()
コード例 #11
0
ファイル: tags.py プロジェクト: vigneshraghunathan/anki
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
コード例 #12
0
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self.decks = {}
     self.dconf = {}
コード例 #13
0
ファイル: stats.py プロジェクト: zenogantner/anki
 def __init__(self, col: anki.storage._Collection,
              card: anki.cards.Card) -> None:
     if col:
         self.col = col.weakref()
     self.card = card
     self.txt = ""
コード例 #14
0
ファイル: decks.py プロジェクト: thanhturin/anki
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self.decks = {}
     self._dconf_cache: Optional[Dict[int, Dict[str, Any]]] = None
コード例 #15
0
ファイル: decks.py プロジェクト: venhow/anki
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self.decks = DecksDictProxy(col)
コード例 #16
0
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self.models = {}
     self.changed = False
コード例 #17
0
ファイル: tags.py プロジェクト: xiaowenhuman/anki
 def __init__(self, col: anki.storage._Collection) -> None:
     self.col = col.weakref()
     self.tags: Dict[str, int] = {}