mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -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): # {{{
|
||||
|
||||
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):
|
||||
d = val.toDateTime()
|
||||
if d <= UNDEFINED_QDATETIME:
|
||||
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)
|
||||
|
||||
def createEditor(self, parent, option, index):
|
||||
|
Loading…
x
Reference in New Issue
Block a user