Fixes for webgui and more native gui development
This commit is contained in:
+6
-6
@@ -27,25 +27,25 @@ class View:
|
||||
self.topwidget = builder.get_object("topobject")
|
||||
gtkutils.init_named_controls(self, builder)
|
||||
|
||||
def format_int(self, ival, separator=True, suffix=None):
|
||||
def format_int(self, ival, separator=True, suffix=None, default=''):
|
||||
if ival is None:
|
||||
return ''
|
||||
return default
|
||||
formatted = locale.format_string("%d", ival, separator)
|
||||
if suffix:
|
||||
formatted += f"\u00A0{suffix}"
|
||||
return formatted
|
||||
|
||||
def format_float(self, fval, digits=2, grouping=True, suffix=None):
|
||||
def format_float(self, fval, digits=2, grouping=True, suffix=None, default=''):
|
||||
if fval is None:
|
||||
return ''
|
||||
return default
|
||||
formatted = locale.format_string(f"%.{digits}f", fval, grouping)
|
||||
if suffix:
|
||||
formatted += f"\u00A0{suffix}"
|
||||
return formatted
|
||||
|
||||
def format_date(self, dval):
|
||||
def format_date(self, dval, default=''):
|
||||
if dval is None:
|
||||
return ''
|
||||
return default
|
||||
return dval.strftime(self.context.datefmt)
|
||||
|
||||
def on_textview_keypress(self, widget, event):
|
||||
|
||||
Reference in New Issue
Block a user