mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit Meta information dialog now displays dates in the local timezone, like the main book view. Fixes #3288 (Published Date issue)
This commit is contained in:
parent
a5bc1ad251
commit
91df0ad326
@ -10,7 +10,7 @@ import os
|
||||
import re
|
||||
import time
|
||||
import traceback
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from PyQt4.QtCore import SIGNAL, QObject, QCoreApplication, Qt, QTimer, QThread, QDate
|
||||
from PyQt4.QtGui import QPixmap, QListWidgetItem, QErrorMessage, QDialog
|
||||
@ -325,9 +325,12 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
||||
self.comments.setPlainText(comments if comments else '')
|
||||
cover = self.db.cover(row)
|
||||
pubdate = db.pubdate(self.id, index_is_id=True)
|
||||
self.local_timezone_offset = timedelta(seconds=time.timezone) - timedelta(hours=time.daylight)
|
||||
pubdate = pubdate - self.local_timezone_offset
|
||||
self.pubdate.setDate(QDate(pubdate.year, pubdate.month,
|
||||
pubdate.day))
|
||||
timestamp = db.timestamp(self.id, index_is_id=True)
|
||||
timestamp = timestamp - self.local_timezone_offset
|
||||
self.date.setDate(QDate(timestamp.year, timestamp.month,
|
||||
timestamp.day))
|
||||
|
||||
@ -523,6 +526,7 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
||||
if book.isbn: self.isbn.setText(book.isbn)
|
||||
if book.pubdate:
|
||||
d = book.pubdate
|
||||
d = d - self.local_timezone_offset
|
||||
self.pubdate.setDate(QDate(d.year, d.month, d.day))
|
||||
summ = book.comments
|
||||
if summ:
|
||||
@ -571,9 +575,13 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
|
||||
self.db.set_series_index(self.id, self.series_index.value(), notify=False)
|
||||
self.db.set_comment(self.id, qstring_to_unicode(self.comments.toPlainText()), notify=False)
|
||||
d = self.pubdate.date()
|
||||
self.db.set_pubdate(self.id, datetime(d.year(), d.month(), d.day()))
|
||||
d = datetime(d.year(), d.month(), d.day())
|
||||
d = d + self.local_timezone_offset
|
||||
self.db.set_pubdate(self.id, d)
|
||||
d = self.date.date()
|
||||
self.db.set_timestamp(self.id, datetime(d.year(), d.month(), d.day()))
|
||||
d = datetime(d.year(), d.month(), d.day())
|
||||
d = d + self.local_timezone_offset
|
||||
self.db.set_timestamp(self.id, d)
|
||||
|
||||
if self.cover_changed and self.cover_data is not None:
|
||||
self.db.set_cover(self.id, self.cover_data)
|
||||
|
@ -378,7 +378,7 @@
|
||||
<item row="9" column="1" colspan="2">
|
||||
<widget class="QDateEdit" name="date">
|
||||
<property name="displayFormat">
|
||||
<string>MMM yyyy</string>
|
||||
<string>dd MMM yyyy</string>
|
||||
</property>
|
||||
<property name="calendarPopup">
|
||||
<bool>true</bool>
|
||||
|
Loading…
x
Reference in New Issue
Block a user