mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 09:16:38 -04:00
add switch in prefs for new timezone handling code; bump sync version
AD devs: before updating the sync version to 10, please make sure the new timezone code has been ported over. The core change to the scheduler is in _updateCutoff():9736e4a970/pylib/anki/schedv2.py (L1357)
with the following supporting Python functions:9736e4a970/pylib/anki/schedv2.py (L1410)
_timing_today() is calculated in Rust (lines up to 92, the rest are tests):9736e4a970/rslib/src/sched/cutoff.rs (L20)
The change went through a few iterations before stabilising, so it's probably easier to refer to the above code than the patches that got us to that point.
This commit is contained in:
parent
9736e4a970
commit
131d37dca5
3 changed files with 21 additions and 2 deletions
|
@ -71,7 +71,7 @@ SCHEMA_VERSION = 11
|
|||
SYNC_ZIP_SIZE = int(2.5 * 1024 * 1024)
|
||||
SYNC_ZIP_COUNT = 25
|
||||
SYNC_BASE = "https://sync%s.ankiweb.net/"
|
||||
SYNC_VER = 9
|
||||
SYNC_VER = 10
|
||||
|
||||
HELP_SITE = "https://apps.ankiweb.net/docs/manual.html"
|
||||
|
||||
|
|
|
@ -92,8 +92,10 @@ class Preferences(QDialog):
|
|||
f.dayLearnFirst.setChecked(qc.get("dayLearnFirst", False))
|
||||
if self.mw.col.schedVer() != 2:
|
||||
f.dayLearnFirst.setVisible(False)
|
||||
f.new_timezone.setVisible(False)
|
||||
else:
|
||||
f.newSched.setChecked(True)
|
||||
f.new_timezone.setChecked(self.mw.col.sched._new_timezone_enabled())
|
||||
|
||||
def updateCollection(self):
|
||||
f = self.form
|
||||
|
@ -118,6 +120,14 @@ class Preferences(QDialog):
|
|||
qc["addToCur"] = not f.useCurrent.currentIndex()
|
||||
qc["dayLearnFirst"] = f.dayLearnFirst.isChecked()
|
||||
self._updateDayCutoff()
|
||||
if self.mw.col.schedVer() != 1:
|
||||
was_enabled = self.mw.col.sched._new_timezone_enabled()
|
||||
is_enabled = f.new_timezone.isChecked()
|
||||
if was_enabled != is_enabled:
|
||||
if is_enabled:
|
||||
self.mw.col.sched.set_creation_offset()
|
||||
else:
|
||||
self.mw.col.sched.clear_creation_offset()
|
||||
self._updateSchedVer(f.newSched.isChecked())
|
||||
d.setMod()
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>422</width>
|
||||
<height>611</height>
|
||||
<height>636</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -136,6 +136,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="new_timezone">
|
||||
<property name="text">
|
||||
<string notr="true">New timezone handling (not yet supported by AnkiDroid)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="useCurrent">
|
||||
<item>
|
||||
|
@ -559,6 +566,7 @@
|
|||
<tabstop>nightMode</tabstop>
|
||||
<tabstop>dayLearnFirst</tabstop>
|
||||
<tabstop>newSched</tabstop>
|
||||
<tabstop>new_timezone</tabstop>
|
||||
<tabstop>useCurrent</tabstop>
|
||||
<tabstop>newSpread</tabstop>
|
||||
<tabstop>uiScale</tabstop>
|
||||
|
@ -571,6 +579,7 @@
|
|||
<tabstop>syncOnProgramOpen</tabstop>
|
||||
<tabstop>fullSync</tabstop>
|
||||
<tabstop>syncDeauth</tabstop>
|
||||
<tabstop>media_log</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
|
Loading…
Reference in a new issue