mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Fix an error when editing date in the main book list and all visible dates are blank. Fixes #1098675 (Except not considered)
This commit is contained in:
parent
dcc5a87238
commit
ad831700ea
@ -88,13 +88,16 @@ class DateDelegate(QStyledItemDelegate): # {{{
|
|||||||
|
|
||||||
class PubDateDelegate(QStyledItemDelegate): # {{{
|
class PubDateDelegate(QStyledItemDelegate): # {{{
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
QStyledItemDelegate.__init__(self, *args, **kwargs)
|
||||||
|
self.format = tweaks['gui_pubdate_display_format']
|
||||||
|
if self.format is None:
|
||||||
|
self.format = 'MMM yyyy'
|
||||||
|
|
||||||
def displayText(self, val, locale):
|
def displayText(self, val, locale):
|
||||||
d = val.toDateTime()
|
d = val.toDateTime()
|
||||||
if d <= UNDEFINED_QDATETIME:
|
if d <= UNDEFINED_QDATETIME:
|
||||||
return ''
|
return ''
|
||||||
self.format = tweaks['gui_pubdate_display_format']
|
|
||||||
if self.format is None:
|
|
||||||
self.format = 'MMM yyyy'
|
|
||||||
return format_date(qt_to_dt(d, as_utc=False), self.format)
|
return format_date(qt_to_dt(d, as_utc=False), self.format)
|
||||||
|
|
||||||
def createEditor(self, parent, option, index):
|
def createEditor(self, parent, option, index):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user