mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement enhancement #6577 (Date format) created by chattympc
This commit is contained in:
parent
bce1ba60d2
commit
4afad85855
@ -44,7 +44,7 @@ bool_custom_columns_are_tristate = 'yes'
|
|||||||
# title within authors.
|
# title within authors.
|
||||||
sort_columns_at_startup = None
|
sort_columns_at_startup = None
|
||||||
|
|
||||||
# Format to be used for publication date
|
# Format to be used for publication date and the timestamp (date).
|
||||||
# A string controlling how the publication date is displayed in the GUI
|
# A string controlling how the publication date is displayed in the GUI
|
||||||
# d the day as number without a leading zero (1 to 31)
|
# d the day as number without a leading zero (1 to 31)
|
||||||
# dd the day as number with a leading zero (01 to 31)
|
# dd the day as number with a leading zero (01 to 31)
|
||||||
@ -59,8 +59,10 @@ sort_columns_at_startup = None
|
|||||||
# For example, given the date of 9 Jan 2010, the following formats show
|
# For example, given the date of 9 Jan 2010, the following formats show
|
||||||
# MMM yyyy ==> Jan 2010 yyyy ==> 2010 dd MMM yyyy ==> 09 Jan 2010
|
# MMM yyyy ==> Jan 2010 yyyy ==> 2010 dd MMM yyyy ==> 09 Jan 2010
|
||||||
# MM/yyyy ==> 01/2010 d/M/yy ==> 9/1/10 yy ==> 10
|
# MM/yyyy ==> 01/2010 d/M/yy ==> 9/1/10 yy ==> 10
|
||||||
# default if not set: MMM yyyy
|
# publication default if not set: MMM yyyy
|
||||||
|
# timestamp default if not set: dd MMM yyyy
|
||||||
gui_pubdate_display_format = 'MMM yyyy'
|
gui_pubdate_display_format = 'MMM yyyy'
|
||||||
|
gui_timestamp_display_format = 'dd MMM yyyy'
|
||||||
|
|
||||||
# Control title and series sorting in the library view.
|
# Control title and series sorting in the library view.
|
||||||
# If set to 'library_order', Leading articles such as The and A will be ignored.
|
# If set to 'library_order', Leading articles such as The and A will be ignored.
|
||||||
|
@ -98,14 +98,14 @@ class DateDelegate(QStyledItemDelegate): # {{{
|
|||||||
d = val.toDate()
|
d = val.toDate()
|
||||||
if d <= UNDEFINED_QDATE:
|
if d <= UNDEFINED_QDATE:
|
||||||
return ''
|
return ''
|
||||||
return format_date(d.toPyDate(), 'dd MMM yyyy')
|
format = tweaks['gui_timestamp_display_format']
|
||||||
|
if format is None:
|
||||||
|
format = 'dd MMM yyyy'
|
||||||
|
return format_date(d.toPyDate(), format)
|
||||||
|
|
||||||
def createEditor(self, parent, option, index):
|
def createEditor(self, parent, option, index):
|
||||||
qde = QStyledItemDelegate.createEditor(self, parent, option, index)
|
qde = QStyledItemDelegate.createEditor(self, parent, option, index)
|
||||||
stdformat = unicode(qde.displayFormat())
|
qde.setDisplayFormat('dd MMM yyyy')
|
||||||
if 'yyyy' not in stdformat:
|
|
||||||
stdformat = stdformat.replace('yy', 'yyyy')
|
|
||||||
qde.setDisplayFormat(stdformat)
|
|
||||||
qde.setMinimumDate(UNDEFINED_QDATE)
|
qde.setMinimumDate(UNDEFINED_QDATE)
|
||||||
qde.setSpecialValueText(_('Undefined'))
|
qde.setSpecialValueText(_('Undefined'))
|
||||||
qde.setCalendarPopup(True)
|
qde.setCalendarPopup(True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user