def load_state(): with app.State(AppRPC.APPSTATE_PATH, lock=True) as state: storage = state.get("storage", {}) # base data caller_id = app.get_session_var("caller_id") storage['cid'] = app.get_cid() storage['coreVersion'] = __version__ storage['coreSystype'] = util.get_systype() storage['coreCaller'] = (str(caller_id).lower() if caller_id else None) storage['coreSettings'] = { name: { "description": data['description'], "default_value": data['value'], "value": app.get_setting(name) } for name, data in app.DEFAULT_SETTINGS.items() } storage['homeDir'] = expanduser("~") storage['projectsDir'] = storage['coreSettings']['projects_dir'][ 'value'] # skip non-existing recent projects storage['recentProjects'] = [ p for p in storage.get("recentProjects", []) if is_platformio_project(p) ] state['storage'] = storage return state.as_dict()
def load_state(): with app.State(AppRPC.APPSTATE_PATH, lock=True) as state: storage = state.get("storage", {}) # base data caller_id = app.get_session_var("caller_id") storage["cid"] = app.get_cid() storage["coreVersion"] = __version__ storage["coreSystype"] = util.get_systype() storage["coreCaller"] = str( caller_id).lower() if caller_id else None storage["coreSettings"] = { name: { "description": data["description"], "default_value": data["value"], "value": app.get_setting(name), } for name, data in app.DEFAULT_SETTINGS.items() } storage["homeDir"] = fs.expanduser("~") storage["projectsDir"] = storage["coreSettings"]["projects_dir"][ "value"] # skip non-existing recent projects storage["recentProjects"] = [ p for p in storage.get("recentProjects", []) if is_platformio_project(p) ] state["storage"] = storage state.modified = False # skip saving extra fields return state.as_dict()
def __init__(self): TelemetryBase.__init__(self) self['v'] = 1 self['tid'] = self.TID self['cid'] = app.get_cid() self['sr'] = "%dx%d" % click.get_terminal_size() self._prefill_screen_name() self._prefill_appinfo() self._prefill_custom_data()
def __init__(self): super(MeasurementProtocol, self).__init__() self['v'] = 1 self['tid'] = self.TID self['cid'] = app.get_cid() self['sr'] = "%dx%d" % click.get_terminal_size() self._prefill_screen_name() self._prefill_appinfo() self._prefill_custom_data()
def __init__(self): super(MeasurementProtocol, self).__init__() self['v'] = 1 self['tid'] = self.TID self['cid'] = app.get_cid() try: self['sr'] = "%dx%d" % click.get_terminal_size() except ValueError: pass self._prefill_screen_name() self._prefill_appinfo() self._prefill_custom_data()
def __init__(self): super(MeasurementProtocol, self).__init__() self["v"] = 1 self["tid"] = self.TID self["cid"] = app.get_cid() try: self["sr"] = "%dx%d" % click.get_terminal_size() except ValueError: pass self._prefill_screen_name() self._prefill_appinfo() self._prefill_custom_data()
def dump_run_environment(options): non_sensitive_data = [ "platform", "platform_packages", "framework", "board", "upload_protocol", "check_tool", "debug_tool", "monitor_filters", ] safe_options = { k: v for k, v in options.items() if k in non_sensitive_data } if is_platformio_project(os.getcwd()): phash = hashlib.sha1(hashlib_encode_data(app.get_cid())) safe_options["pid"] = phash.hexdigest() return json.dumps(safe_options, sort_keys=True, ensure_ascii=False)