mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 16:03:36 +02: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
1 changed files with 6 additions and 3 deletions
|
|
@ -88,13 +88,16 @@ def createEditor(self, parent, option, index):
|
||||||
|
|
||||||
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…
Reference in a new issue