Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Rationalise the message. First, split the string into a list of
# lines, preserving \n\n (but not a standalone \n)
line_list = msg.split('\n\n')
# In each line, convert any standalone \n characters to whitespace.
# Then add new newline characters, if required, to give a maximum
# length per line
mod_list = []
for line in line_list:
mod_list.append(utils.tidy_up_long_string(line, 40))
# Finally combine everything into a single string, as before
double = '\n\n'
msg = double.join(mod_list)
# ...and display the message dialogue
dialogue_win = MessageDialogue(
self,
msg,
msg_type,
button_type,
parent_win_obj,
response_dict,
)
dialogue_win.create_dialogue()
return dialogue_win