def export_data_to(data_source, dest_file='notes.txt'): list_of_notes_str = convert_to_list_of_strigs_from(data_source) with open(dest_file, 'w') as destfile: for note in list_of_notes_str: destfile.write(','.join(note) + '\n') print(','.join(note)) ui.display_message(CONFIRM_COLOR, 'Meeting added')
def choose_options_menu(): user_choice = input('Your choice: ') if user_choice == 'd': operations.detect_broken_record(storage.open_wav_files_from()) elif user_choice == 'g': operations.save_waveforms_from(storage.open_wav_files_from()) elif user_choice == 'q': sys.exit() else: ui.display_message("There isn't such option")
def detect_broken_record_from(file_list): # variable for exemplary condition difference = abs(previous_sample_value - next_sample_value) for file in file_list: fs, data = wavfile.read(file) if round(difference) == previous_sample_value: # exemplary condition ui.display_message( f'{file} invalid {index_of_first_dropped_sample}') else: ui.display_message(f'{file} valid')
def cancel_meeting_in(meeting_list): while True: start_time = ui.start_time('Enter the start time: ') for meeting in meeting_list: if start_time == meeting[START_TIME]: meeting_list.remove(meeting) ui.display_message(CONFIRM_COLOR, 'Meeting canceled') break else: ui.display_error_message( 'There is no meeting starting at that time!') return
def choose_options(list): user_choice = input('Your choice: ') if user_choice == 'D': operations.add_new_note(list) elif user_choice == 'W': ui.display_all(sorted(list)) elif user_choice == 'P': ui.display_chosen(list) elif user_choice == 'U': operations.remove_note(list) elif user_choice == 'I': operations.count_notes(list) elif user_choice == 'Q': sys.exit() else: ui.display_message(ui.ORANGE, "Wybierz dostepna opcje")
def choose_options_menu(meeting_list): user_choice = input('Your choice: ') if user_choice == 's': modify.add_new_meeting_to(meeting_list) elif user_choice == 'c': modify.cancel_meeting_in(meeting_list) # storage.export_data_to(meeting_list, 'meetings.txt') elif user_choice == 'e': modify.edit_meeting_in(meeting_list) # storage.export_data_to(meeting_list, 'meetings.txt') elif user_choice == 't': operations.count_total_meetings_duration_in(meeting_list) elif user_choice == 'm': operations.compact(meeting_list) elif user_choice == 'q': sys.exit() else: ui.display_message(ui.ORANGE, "There isn't such option")
def remove_note(list): title = ui.title('Wprowadz tytul notatki: ') ui.remove(list, title) ui.display_message(ui.GREEN, 'Notatka zostala usunieta')
def count_total_meetings_duration_in(meeting_list): meeting_duration_list = [meeting[END_TIME] - meeting[START_TIME] for meeting in meeting_list] ui.display_message(MESSAGE_COLOR, f'Total meeting duration: {sum(meeting_duration_list)}')