diff --git a/src/calibre/gui2/preferences/create_custom_column.py b/src/calibre/gui2/preferences/create_custom_column.py index f3fe8f03a3..8eaa2dd7d9 100644 --- a/src/calibre/gui2/preferences/create_custom_column.py +++ b/src/calibre/gui2/preferences/create_custom_column.py @@ -182,6 +182,18 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn): getattr(self, 'enum_'+x).setVisible(col_type == 'enumeration') self.use_decorations.setVisible(col_type in ['text', 'composite', 'enumeration']) self.is_names.setVisible(col_type == '*text') + if col_type == 'int': + self.number_format_box.setToolTip('

' + + _('Examples: The format {0:0>4d} ' + 'gives a 4-digit number with leading zeros. The format ' + '{0:d} days prints the number then the word "days"')+ '

') + elif col_type == 'float': + self.number_format_box.setToolTip('

' + + _('Examples: The format {0:.1f} gives a floating ' + 'point number with 1 digit after the decimal point. The format ' + 'Price: $ {0:,.2f} prints ' + '"Price $ " then displays the number with 2 digits ' + 'after the decimal point and thousands separated by commas.') + '

') def accept(self): col = unicode(self.column_name_box.text()).strip() diff --git a/src/calibre/gui2/preferences/create_custom_column.ui b/src/calibre/gui2/preferences/create_custom_column.ui index 02daae988f..cedbfd72b8 100644 --- a/src/calibre/gui2/preferences/create_custom_column.ui +++ b/src/calibre/gui2/preferences/create_custom_column.ui @@ -179,10 +179,6 @@ Everything else will show nothing. 0 - - <p>Use 0 (a zero) for the field name. Example: {0:0>5.2f} gives a 5-digit floating point number, 2 digits after the decimal point, with leading zeros - - @@ -198,7 +194,9 @@ Everything else will show nothing. - <p>Example: ${0:,.2f} gives floating point number prefixed by a dollar sign, 2 digits after the decimal point, with thousands separated by commas + <p>The format specifier must begin with <code>{0:</code> +and end with <code>}</code> You can have text before and after the format specifier. + <p>Default: Not formatted. For format language details see <a href="http://docs.python.org/library/string.html#format-string-syntax">the python documentation</a>