added tags to board util bad miners, so when sorting they stay the same
This commit is contained in:
@@ -145,19 +145,19 @@ async def scan_and_get_data(network):
|
|||||||
if 0 in data_point["data"].keys():
|
if 0 in data_point["data"].keys():
|
||||||
board_left = " ".join([chain["chip_status"] for chain in data_point["data"][0]]).replace("o", "•")
|
board_left = " ".join([chain["chip_status"] for chain in data_point["data"][0]]).replace("o", "•")
|
||||||
else:
|
else:
|
||||||
row_colors.append((ip_table_index, "white", "red"))
|
row_colors.append((ip_table_index, "bad"))
|
||||||
if 1 in data_point["data"].keys():
|
if 1 in data_point["data"].keys():
|
||||||
board_center = " ".join([chain["chip_status"] for chain in data_point["data"][1]]).replace("o", "•")
|
board_center = " ".join([chain["chip_status"] for chain in data_point["data"][1]]).replace("o", "•")
|
||||||
else:
|
else:
|
||||||
row_colors.append((ip_table_index, "white", "red"))
|
row_colors.append((ip_table_index, "bad"))
|
||||||
if 2 in data_point["data"].keys():
|
if 2 in data_point["data"].keys():
|
||||||
board_right = " ".join([chain["chip_status"] for chain in data_point["data"][2]]).replace("o", "•")
|
board_right = " ".join([chain["chip_status"] for chain in data_point["data"][2]]).replace("o", "•")
|
||||||
else:
|
else:
|
||||||
row_colors.append((ip_table_index, "white", "red"))
|
row_colors.append((ip_table_index, "bad"))
|
||||||
if False in [chain["nominal"] for chain in [data_point["data"][key] for key in data_point["data"].keys()][0]]:
|
if False in [chain["nominal"] for chain in [data_point["data"][key] for key in data_point["data"].keys()][0]]:
|
||||||
row_colors.append((ip_table_index, "white", "red"))
|
row_colors.append((ip_table_index, "white", "red"))
|
||||||
else:
|
else:
|
||||||
row_colors.append((ip_table_index, "white", "red"))
|
row_colors.append((ip_table_index, "bad"))
|
||||||
board_left_chips = "\n".join(split_chips(board_left, 3))
|
board_left_chips = "\n".join(split_chips(board_left, 3))
|
||||||
board_center_chips = "\n".join(split_chips(board_center, 3))
|
board_center_chips = "\n".join(split_chips(board_center, 3))
|
||||||
board_right_chips = "\n".join(split_chips(board_right, 3))
|
board_right_chips = "\n".join(split_chips(board_right, 3))
|
||||||
@@ -173,7 +173,11 @@ async def scan_and_get_data(network):
|
|||||||
board_right_chips
|
board_right_chips
|
||||||
]
|
]
|
||||||
ip_table_data[ip_table_index] = data
|
ip_table_data[ip_table_index] = data
|
||||||
window["ip_table"].update(ip_table_data, row_colors=row_colors)
|
window["ip_table"].update(ip_table_data)
|
||||||
|
table = window["ip_table"].Widget
|
||||||
|
table.tag_configure("bad", foreground="white", background="red")
|
||||||
|
for row in row_colors:
|
||||||
|
table.item(row[0] + 1, tags=row[1])
|
||||||
progress_bar_len += 1
|
progress_bar_len += 1
|
||||||
asyncio.create_task(update_prog_bar(progress_bar_len))
|
asyncio.create_task(update_prog_bar(progress_bar_len))
|
||||||
await update_ui_with_data("status", "")
|
await update_ui_with_data("status", "")
|
||||||
@@ -189,5 +193,5 @@ async def get_formatted_data(ip: ipaddress.ip_address):
|
|||||||
model = await miner.get_model()
|
model = await miner.get_model()
|
||||||
warnings.filterwarnings('ignore')
|
warnings.filterwarnings('ignore')
|
||||||
board_data = await miner.get_board_info()
|
board_data = await miner.get_board_info()
|
||||||
data = {"IP": str(ip), "model": model, "data": board_data}
|
data = {"IP": str(ip), "model": str(model), "data": board_data}
|
||||||
return data
|
return data
|
||||||
|
|||||||
@@ -51,31 +51,29 @@ async def set_progress_bar_len(amount):
|
|||||||
async def sort_data(index: int or str):
|
async def sort_data(index: int or str):
|
||||||
await update_ui_with_data("status", "Sorting Data")
|
await update_ui_with_data("status", "Sorting Data")
|
||||||
data_list = window['ip_table'].Values
|
data_list = window['ip_table'].Values
|
||||||
|
table = window["ip_table"].Widget
|
||||||
# wattage
|
all_data = []
|
||||||
if re.match("[0-9]* W", str(data_list[0][index])):
|
for idx, item in enumerate(data_list):
|
||||||
new_list = sorted(data_list, key=lambda x: int(x[index].replace(" W", "")))
|
all_data.append({"data": item, "tags": table.item(int(idx) + 1)["tags"]})
|
||||||
if data_list == new_list:
|
|
||||||
new_list = sorted(data_list, reverse=True, key=lambda x: int(x[index].replace(" W", "")))
|
|
||||||
|
|
||||||
# hashrate
|
|
||||||
elif re.match("[0-9]*\.?[0-9]* TH\/s", str(data_list[0][index])):
|
|
||||||
new_list = sorted(data_list, key=lambda x: float(x[index].replace(" TH/s", "")))
|
|
||||||
if data_list == new_list:
|
|
||||||
new_list = sorted(data_list, reverse=True, key=lambda x: float(x[index].replace(" TH/s", "")))
|
|
||||||
|
|
||||||
# ip addresses
|
# ip addresses
|
||||||
elif re.match("^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",
|
if re.match("^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",
|
||||||
str(data_list[0][index])):
|
str(all_data[0]["data"][index])):
|
||||||
new_list = sorted(data_list, key=lambda x: ipaddress.ip_address(x[index]))
|
new_list = sorted(all_data, key=lambda x: ipaddress.ip_address(x["data"][index]))
|
||||||
if data_list == new_list:
|
if all_data == new_list:
|
||||||
new_list = sorted(data_list, reverse=True, key=lambda x: ipaddress.ip_address(x[index]))
|
new_list = sorted(all_data, reverse=True, key=lambda x: ipaddress.ip_address(x["data"][index]))
|
||||||
|
|
||||||
# everything else, hostname, temp, and user
|
# everything else, model, chips
|
||||||
else:
|
else:
|
||||||
new_list = sorted(data_list, key=lambda x: x[index])
|
new_list = sorted(all_data, key=lambda x: x["data"][index])
|
||||||
if data_list == new_list:
|
if all_data == new_list:
|
||||||
new_list = sorted(data_list, reverse=True, key=lambda x: x[index])
|
new_list = sorted(all_data, reverse=True, key=lambda x: x["data"][index])
|
||||||
|
|
||||||
|
new_data = []
|
||||||
|
for item in new_list:
|
||||||
|
new_data.append(item["data"])
|
||||||
|
|
||||||
|
await update_ui_with_data("ip_table", new_data)
|
||||||
|
for idx, item in enumerate(new_list):
|
||||||
|
table.item(idx + 1, tags=item["tags"])
|
||||||
|
|
||||||
await update_ui_with_data("ip_table", new_list)
|
|
||||||
await update_ui_with_data("status", "")
|
await update_ui_with_data("status", "")
|
||||||
|
|||||||
@@ -4,19 +4,19 @@ icon_of_window = b'iVBORw0KGgoAAAANSUhEUgAAAF4AAABeCAYAAACq0qNuAAAAAXNSR0IArs4c6
|
|||||||
|
|
||||||
layout = [
|
layout = [
|
||||||
[sg.Text("", key="status", size=(9, 1)),
|
[sg.Text("", key="status", size=(9, 1)),
|
||||||
sg.ProgressBar(1000, key="progress", size=(74, 20), orientation='h'),
|
sg.ProgressBar(1000, key="progress", size=(83, 20), orientation='h'),
|
||||||
sg.Text("", key="progress_percent", size=(9, 1)),
|
sg.Text("", key="progress_percent", size=(9, 1)),
|
||||||
],
|
],
|
||||||
|
|
||||||
[sg.Text("", size=(100, 1))],
|
[sg.Text("", size=(100, 1))],
|
||||||
|
|
||||||
[sg.Text('Network IP:', size=(9, 1)),
|
[sg.Text('Network IP:', size=(9, 1)),
|
||||||
sg.InputText(key='miner_network', do_not_clear=True, size=(103, 1)),
|
sg.InputText(key='miner_network', do_not_clear=True, size=(113, 1)),
|
||||||
sg.Button('Scan', key='scan'),
|
sg.Button('Scan', key='scan'),
|
||||||
],
|
],
|
||||||
|
|
||||||
[sg.Text('IP List File:', size=(9, 1)),
|
[sg.Text('IP List File:', size=(9, 1)),
|
||||||
sg.Input(key="file_iplist", do_not_clear=True, size=(103, 1)),
|
sg.Input(key="file_iplist", do_not_clear=True, size=(113, 1)),
|
||||||
sg.FileBrowse(),
|
sg.FileBrowse(),
|
||||||
sg.Button('Import', key="import_iplist"),
|
sg.Button('Import', key="import_iplist"),
|
||||||
sg.Button('Export', key="export_iplist"),
|
sg.Button('Export', key="export_iplist"),
|
||||||
@@ -47,10 +47,10 @@ layout = [
|
|||||||
max_col_width=15,
|
max_col_width=15,
|
||||||
justification="center",
|
justification="center",
|
||||||
key="ip_table",
|
key="ip_table",
|
||||||
col_widths=[11, 7, 7, 30, 7, 30, 7, 30],
|
col_widths=[14, 7, 7, 30, 7, 30, 7, 30],
|
||||||
background_color="white",
|
background_color="white",
|
||||||
text_color="black",
|
text_color="black",
|
||||||
size=(100, 8),
|
size=(110, 8),
|
||||||
expand_x=True,
|
expand_x=True,
|
||||||
enable_click_events=True,
|
enable_click_events=True,
|
||||||
)]
|
)]
|
||||||
|
|||||||
Reference in New Issue
Block a user