mirror of
https://github.com/ankitects/anki.git
synced 2026-01-13 22:13:58 -05:00
Fix Python 3.9 compatibility and layout check
This commit is contained in:
parent
b9552f530f
commit
80e49e770f
2 changed files with 5 additions and 3 deletions
|
|
@ -1,7 +1,9 @@
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from typing import Dict
|
from typing import Dict, Union
|
||||||
from anki.collection import Collection
|
from anki.collection import Collection
|
||||||
def analyze_activity(col: Collection, days: int = 30) -> dict[str, int | float]:
|
|
||||||
|
def analyze_activity(col: Collection, days: int = 30) -> dict[str, Union[int, float]]:
|
||||||
|
|
||||||
day_cutoff = col.sched.day_cutoff
|
day_cutoff = col.sched.day_cutoff
|
||||||
start_time = day_cutoff - days * 86400
|
start_time = day_cutoff - days * 86400
|
||||||
start_ts = start_time * 1000 # ms
|
start_ts = start_time * 1000 # ms
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class Overview:
|
||||||
layout = self.web.layout()
|
layout = self.web.layout()
|
||||||
if layout is not None:
|
if layout is not None:
|
||||||
layout = self.web.layout()
|
layout = self.web.layout()
|
||||||
if hasattr(layout, "insertWidget"):
|
if layout is not None and hasattr(layout, "insertWidget"):
|
||||||
layout.insertWidget(0, streak_widget)
|
layout.insertWidget(0, streak_widget)
|
||||||
|
|
||||||
def show(self) -> None:
|
def show(self) -> None:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue