remove 'Updated file...' and 'Saving file...' from extension

pull/1160/head
LeonOstrez 3 years ago
parent 53a84fafeb
commit 96a37c8eaf

@ -386,7 +386,8 @@ class Project:
development_step, created = DevelopmentSteps.get_or_create(id=development_step_id)
for file in files:
print(color_cyan(f'Saving file {file["full_path"]}'))
if not self.check_ipc():
print(color_cyan(f'Saving file {file["full_path"]}'))
# TODO this can be optimized so we don't go to the db each time
file_in_db, created = File.get_or_create(
app=self.app,
@ -447,15 +448,18 @@ class Project:
raise e
def log(self, text, message_type):
if self.ipc_client_instance is None or self.ipc_client_instance.client is None:
print(text)
else:
if self.check_ipc():
self.ipc_client_instance.send({
'type': MESSAGE_TYPE[message_type],
'content': str(text),
})
if message_type == MESSAGE_TYPE['user_input_request']:
return self.ipc_client_instance.listen()
else:
print(text)
def check_ipc(self):
return self.ipc_client_instance is not None and self.ipc_client_instance.client is not None
def finish_loading(self):
print('', type='loadingFinished')

@ -223,10 +223,10 @@ class Developer(Agent):
self.get_run_command(convo)
if self.run_command:
if (self.project.ipc_client_instance is None or self.project.ipc_client_instance.client is None):
human_intervention_description += color_yellow_bold('\n\nIf you want to run the app, just type "r" and press ENTER and that will run `' + self.run_command + '`')
else:
if self.project.check_ipc():
print(self.run_command, type='run_command')
else:
human_intervention_description += color_yellow_bold('\n\nIf you want to run the app, just type "r" and press ENTER and that will run `' + self.run_command + '`')
response = self.project.ask_for_human_intervention('I need human intervention:',
human_intervention_description,
@ -465,11 +465,11 @@ class Developer(Agent):
user_description = 'Can you check if the app works please? ' + user_description
if self.run_command:
if self.project.ipc_client_instance is None or self.project.ipc_client_instance.client is None:
if self.project.check_ipc():
print(self.run_command, type='run_command')
else:
user_description += color_yellow_bold(
'\n\nIf you want to run the app, just type "r" and press ENTER and that will run `' + self.run_command + '`')
else:
print(self.run_command, type='run_command')
# continue_description = ''
# TODO: Wait for a specific string in the output or timeout?

@ -29,9 +29,11 @@ def update_file(path: str, new_content: Union[str, bytes], project=None):
with open(path, file_mode, encoding=encoding) as file:
file.write(new_content)
if project is not None and not project.skip_steps:
print({"path": path, "line": None}, type='openFile')
print(color_green(f"Updated file {path}"))
if project is not None: # project can be None only in tests
if not project.skip_steps:
print({"path": path, "line": None}, type='openFile')
if not project.check_ipc():
print(color_green(f"Updated file {path}"))
def get_file_contents(

@ -28,14 +28,14 @@ def styled_text(project, question, ignore_user_input_count=False, style=None, hi
print(color_yellow_bold(f'{user_input.user_input}'))
return user_input.user_input
if project.ipc_client_instance is None or project.ipc_client_instance.client is None:
if project.check_ipc():
response = print(question, type='user_input_request')
print(response)
else:
used_style = style if style is not None else style_config.get_style()
question = remove_ansi_codes(question) # Colorama and questionary are not compatible and styling doesn't work
flush_input()
response = questionary.text(question, style=used_style).unsafe_ask() # .ask() is included here
else:
response = print(question, type='user_input_request')
print(response)
if not ignore_user_input_count:
save_user_input(project, question, response, hint)

Loading…
Cancel
Save