support changing time offset

This commit is contained in:
Damien Elmes 2008-10-12 04:01:36 +09:00
parent b9db00e668
commit ec932d6f39
4 changed files with 49 additions and 4 deletions

View file

@ -77,6 +77,9 @@ class DeckProperties(QDialog):
self.drawSourcesTable()
# models
self.updateModelsList()
# hour shift
self.dialog.timeOffset.setText(str(
(self.d.utcOffset - time.timezone) / 60.0 / 60.0))
def drawSourcesTable(self):
self.dialog.sourcesTable.clear()
@ -227,6 +230,13 @@ class DeckProperties(QDialog):
self.updateField(self.d, 'newCardsPerDay', v)
except ValueError:
pass
# hour shift
try:
self.updateField(self.d, 'utcOffset',
float(str(self.dialog.timeOffset.text()))
*60*60 + time.timezone)
except:
pass
self.updateField(self.d, 'collapseTime',
self.dialog.collapse.isChecked() and 1 or 0)
self.updateField(self.d,

View file

@ -251,6 +251,7 @@ class AnkiQt(QMainWindow):
if self.state == "deckFinished":
# don't try refresh if the deck is closed during a sync
if self.deck:
self.deck.checkDailyStats()
self.deck.markExpiredCardsDue()
self.moveToState("getQuestion")
if self.state != "deckFinished":

View file

@ -24,7 +24,7 @@ class LatestVersionFinder(QThread):
# calculate stats before we start a new thread
if self.main.deck != None:
deckSize = self.main.deck.cardCount()
stats = anki.stats.globalStats(self.main.deck.s)
stats = anki.stats.globalStats(self.main.deck)
deckRecall = "%0.2f" % (
(stats.matureEase3 + stats.matureEase4) /
float(stats.matureEase0 +

View file

@ -8,7 +8,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>388</width>
<width>389</width>
<height>408</height>
</rect>
</property>
@ -29,7 +29,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>372</width>
<width>373</width>
<height>342</height>
</rect>
</property>
@ -446,7 +446,7 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>372</width>
<width>373</width>
<height>342</height>
</rect>
</property>
@ -615,6 +615,40 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_25" >
<property name="text" >
<string>&lt;h1>Day Rollover&lt;/h1></string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QLabel" name="label_29" >
<property name="text" >
<string>Hours to shift midnight</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="timeOffset" />
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer" >
<property name="orientation" >