def set_format(self, data, digits, scientific):
"""data: object with a dtype attribute"""
type = data.dtype.type
if type in (np.str, np.str_, np.bool_, np.bool, np.object_):
fmt = '%s'
else:
# XXX: use self.digits_spinbox.getValue() and instead?
# XXX: use self.digits_spinbox.getValue() instead?
format_letter = 'e' if scientific else 'f'
fmt = '%%.%d%s' % (digits, format_letter)
# this does not call model_data.reset() so it should be called by the caller
self.model_data._set_format(fmt)
评论列表
文章目录