def get_value(self, vlog=None): val = self._ctrl.GetValue().strip() # noinspection PyBroadException try: # must be seconds if it is a number return float(val) except: pass try: return dhms_to_seconds(*str_to_dhms(val)) except Exception, e: if vlog: vlog.error('invalid duration: %s (%s)', val, e) return None
def convert(self, val): if isinstance(val, (unicode, str)): return dhms_to_seconds(*str_to_dhms(val)) return AttrType.convert(self, val)