def save(self, filename=None): _file_name = filename if filename else "track-%s.json" % track_common.today_str() # print(_file_name) _app_data = self._applications.__data__() with open(_file_name, 'w') as _file: json.dump(_app_data, _file, sort_keys=True) #, indent=4, separators=(',', ': ')) _test_model = active_applications_qtmodel(None) _test_model.from_dict(_app_data) assert self._applications == _test_model
def save(self, filename=None): _file_name = filename if filename else "track-%s.json" % track_common.today_str() # print(_file_name) _app_data = self._applications.__data__() with open(_file_name, 'w') as _file: json.dump(_app_data, _file, sort_keys=True) #, indent=4, separators=(',', ': ')) _test_model = track_qt.active_applications(None) _test_model.from_dict(_app_data) assert self._applications == _test_model
def load(self, filename=None): _file_name = filename if filename else "track-%s.json" % track_common.today_str() # print(_file_name) try: with open(_file_name) as _file: _struct = json.load(_file) except IOError: if filename is not None: logging.warn('file "%s" does not exist' % filename) return self._applications.from_dict(_struct)