added export IPlist
This commit is contained in:
@@ -76,6 +76,23 @@ async def import_iplist(file_location):
|
|||||||
await update_ui_with_data("status", "")
|
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):
|
||||||
|
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(item) + "\n")
|
||||||
|
else:
|
||||||
|
async with aiofiles.open(file_location, mode='w') as file:
|
||||||
|
for item in window['ip_list'].Values:
|
||||||
|
await file.write(str(item) + "\n")
|
||||||
|
await update_ui_with_data("status", "")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def send_config(ips: list, config):
|
async def send_config(ips: list, config):
|
||||||
await update_ui_with_data("status", "Configuring")
|
await update_ui_with_data("status", "Configuring")
|
||||||
tasks = []
|
tasks = []
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ layout = [
|
|||||||
sg.Button('Scan', key='scan'),
|
sg.Button('Scan', key='scan'),
|
||||||
sg.Text("", key="status")],
|
sg.Text("", key="status")],
|
||||||
[sg.Text('IP List File: '), sg.Input(key="file_iplist", do_not_clear=True, size=(110, 1)), sg.FileBrowse(),
|
[sg.Text('IP List File: '), sg.Input(key="file_iplist", do_not_clear=True, size=(110, 1)), sg.FileBrowse(),
|
||||||
sg.Button('Import', key="import_iplist")],
|
sg.Button('Import', key="import_iplist"), sg.Button('Export', key="export_iplist")],
|
||||||
[sg.Text('Config File: '), sg.Input(key="file_config", do_not_clear=True, size=(110, 1)), sg.FileBrowse(),
|
[sg.Text('Config File: '), sg.Input(key="file_config", do_not_clear=True, size=(110, 1)), sg.FileBrowse(),
|
||||||
sg.Button('Import', key="import_file_config"), sg.Button('Export', key="export_file_config")],
|
sg.Button('Import', key="import_file_config"), sg.Button('Export', key="export_file_config")],
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import sys
|
|||||||
|
|
||||||
from cfg_util.layout import window
|
from cfg_util.layout import window
|
||||||
from cfg_util.func import scan_network, sort_data, send_config, miner_light, get_data, export_config_file, \
|
from cfg_util.func import scan_network, sort_data, send_config, miner_light, get_data, export_config_file, \
|
||||||
generate_config, import_config, import_iplist, import_config_file
|
generate_config, import_config, import_iplist, import_config_file, export_iplist
|
||||||
|
|
||||||
from network import MinerNetwork
|
from network import MinerNetwork
|
||||||
|
|
||||||
@@ -32,6 +32,8 @@ async def ui():
|
|||||||
asyncio.create_task(miner_light(value['ip_list']))
|
asyncio.create_task(miner_light(value['ip_list']))
|
||||||
if event == "import_iplist":
|
if event == "import_iplist":
|
||||||
asyncio.create_task(import_iplist(value["file_iplist"]))
|
asyncio.create_task(import_iplist(value["file_iplist"]))
|
||||||
|
if event == "export_iplist":
|
||||||
|
asyncio.create_task(export_iplist(value["file_iplist"], value['ip_list']))
|
||||||
if event == "send_config":
|
if event == "send_config":
|
||||||
asyncio.create_task(send_config(value['ip_list'], value['config']))
|
asyncio.create_task(send_config(value['ip_list'], value['config']))
|
||||||
if event == "import_file_config":
|
if event == "import_file_config":
|
||||||
|
|||||||
1
tests.py
1
tests.py
@@ -4,7 +4,6 @@ import asyncio
|
|||||||
from API.bosminer import BOSMinerAPI
|
from API.bosminer import BOSMinerAPI
|
||||||
from API.cgminer import CGMinerAPI
|
from API.cgminer import CGMinerAPI
|
||||||
import sys
|
import sys
|
||||||
from cfg_util.func.data import safe_parse_api_data
|
|
||||||
|
|
||||||
|
|
||||||
# Fix bug with some whatsminers and asyncio because of a socket not being shut down:
|
# Fix bug with some whatsminers and asyncio because of a socket not being shut down:
|
||||||
|
|||||||
Reference in New Issue
Block a user