def on_device_to_add_selected(self, index):
# Selection was canceled, just return
if index == -1:
return
model = self.env.tmp_model
device_id = self.env.tmp_device_ids[index]
response, code = HTTP.put(self.env.project_manager.get_build_api_key(),
PL_BUILD_API_URL_V4 + "devices/" + device_id,
'{"model_id": "' + model.get("id") + '"}')
if not HTTP.is_response_code_valid(code):
sublime.message_dialog(STR_MODEL_ADDING_DEVICE_FAILED)
# Once the device is registered, select this device
self.on_device_selected(index)
sublime.message_dialog(STR_MODEL_IMP_REGISTERED)
self.env.tmp_model = None
self.env.tmp_device_ids = None
评论列表
文章目录