added export csv button to export all data from the tool
This commit is contained in:
@@ -30,6 +30,27 @@ async def import_iplist(file_location):
|
||||
await update_ui_with_data("status", "")
|
||||
|
||||
|
||||
async def export_csv(file_location, ip_list_selected):
|
||||
await update_ui_with_data("status", "Exporting")
|
||||
if not os.path.exists(file_location):
|
||||
return
|
||||
else:
|
||||
if ip_list_selected is not None and not ip_list_selected == []:
|
||||
async with aiofiles.open(file_location, mode='w') as file:
|
||||
for item in ip_list_selected:
|
||||
await file.write(str(
|
||||
", ".join([str(part) for part in item])
|
||||
) + "\n")
|
||||
else:
|
||||
async with aiofiles.open(file_location, mode='w') as file:
|
||||
for item in window['ip_table'].Values:
|
||||
await file.write(str(
|
||||
", ".join([str(part) for part in item])
|
||||
) + "\n")
|
||||
await update_ui_with_data("status", "")
|
||||
|
||||
|
||||
|
||||
async def export_iplist(file_location, ip_list_selected):
|
||||
await update_ui_with_data("status", "Exporting")
|
||||
if not os.path.exists(file_location):
|
||||
|
||||
Reference in New Issue
Block a user