mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix bug #1217096
This commit is contained in:
parent
121469daa5
commit
c7d5ac84e7
@ -12,7 +12,7 @@ from PyQt4.Qt import (QComboBox, QLabel, QSpinBox, QDoubleSpinBox, QDateTimeEdit
|
|||||||
QSpacerItem, QIcon, QCheckBox, QWidget, QHBoxLayout, SIGNAL,
|
QSpacerItem, QIcon, QCheckBox, QWidget, QHBoxLayout, SIGNAL,
|
||||||
QPushButton, QMessageBox, QToolButton, Qt)
|
QPushButton, QMessageBox, QToolButton, Qt)
|
||||||
|
|
||||||
from calibre.utils.date import qt_to_dt, now
|
from calibre.utils.date import qt_to_dt, now, as_local_time, as_utc
|
||||||
from calibre.gui2.complete2 import EditWithComplete
|
from calibre.gui2.complete2 import EditWithComplete
|
||||||
from calibre.gui2.comments_editor import Editor as CommentsEditor
|
from calibre.gui2.comments_editor import Editor as CommentsEditor
|
||||||
from calibre.gui2 import UNDEFINED_QDATETIME, error_dialog
|
from calibre.gui2 import UNDEFINED_QDATETIME, error_dialog
|
||||||
@ -189,10 +189,10 @@ class DateTime(Base):
|
|||||||
l.addStretch(2)
|
l.addStretch(2)
|
||||||
|
|
||||||
w = self.widgets[1]
|
w = self.widgets[1]
|
||||||
format = cm['display'].get('date_format','')
|
format_ = cm['display'].get('date_format','')
|
||||||
if not format:
|
if not format_:
|
||||||
format = 'dd MMM yyyy hh:mm'
|
format_ = 'dd MMM yyyy hh:mm'
|
||||||
w.setDisplayFormat(format)
|
w.setDisplayFormat(format_)
|
||||||
w.setCalendarPopup(True)
|
w.setCalendarPopup(True)
|
||||||
w.setMinimumDateTime(UNDEFINED_QDATETIME)
|
w.setMinimumDateTime(UNDEFINED_QDATETIME)
|
||||||
w.setSpecialValueText(_('Undefined'))
|
w.setSpecialValueText(_('Undefined'))
|
||||||
@ -214,6 +214,12 @@ class DateTime(Base):
|
|||||||
val = qt_to_dt(val)
|
val = qt_to_dt(val)
|
||||||
return val
|
return val
|
||||||
|
|
||||||
|
def normalize_db_val(self, val):
|
||||||
|
return as_local_time(val) if val is not None else None
|
||||||
|
|
||||||
|
def normalize_ui_val(self, val):
|
||||||
|
return as_utc(val) if val is not None else None
|
||||||
|
|
||||||
class Comments(Base):
|
class Comments(Base):
|
||||||
|
|
||||||
def setup_ui(self, parent):
|
def setup_ui(self, parent):
|
||||||
@ -823,6 +829,12 @@ class BulkDateTime(BulkBase):
|
|||||||
val = qt_to_dt(val)
|
val = qt_to_dt(val)
|
||||||
return val
|
return val
|
||||||
|
|
||||||
|
def normalize_db_val(self, val):
|
||||||
|
return as_local_time(val) if val is not None else None
|
||||||
|
|
||||||
|
def normalize_ui_val(self, val):
|
||||||
|
return as_utc(val) if val is not None else None
|
||||||
|
|
||||||
class BulkSeries(BulkBase):
|
class BulkSeries(BulkBase):
|
||||||
|
|
||||||
def setup_ui(self, parent):
|
def setup_ui(self, parent):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user