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 __init__(self, parent): self._idle_current = 0 self._current_minute = 0 # does not need to be highest minute index self._current_app_title = "" self._current_process_exe = "" self._user_is_active = True self._active_day = track_common.today_int() # -- persist self._applications = active_applications_qtmodel(parent) self._rules = rules_model_qt(parent) self._rules.modified_rules.connect(self.update_categories)