fixed formatting on hashrate
This commit is contained in:
@@ -163,7 +163,7 @@ class BMMiner(BaseMiner):
|
||||
for item in ["temp2", "temp1", "temp3"]:
|
||||
temperature = temp[1].get(item)
|
||||
if temperature and not temperature == 0.0:
|
||||
data["Temperature"] = temperature
|
||||
data["Temperature"] = round(temperature)
|
||||
|
||||
if pools:
|
||||
pool_1 = None
|
||||
|
||||
@@ -272,7 +272,7 @@ class BOSMiner(BaseMiner):
|
||||
if len(temp) > 0:
|
||||
temp = temp[0].get("Chip")
|
||||
if temp:
|
||||
data["Temperature"] = round(temp, 2)
|
||||
data["Temperature"] = round(temp)
|
||||
|
||||
if pools:
|
||||
pool_1 = None
|
||||
|
||||
@@ -122,7 +122,7 @@ class BTMiner(BaseMiner):
|
||||
for board in temp_data:
|
||||
temp = board.get("Chip Temp Avg")
|
||||
if temp and not temp == 0.0:
|
||||
data["Temperature"] = temp
|
||||
data["Temperature"] = round(temp)
|
||||
break
|
||||
|
||||
if pools:
|
||||
|
||||
@@ -138,7 +138,7 @@ class CGMiner(BaseMiner):
|
||||
for item in ["temp2", "temp1", "temp3"]:
|
||||
temperature = temp[1].get(item)
|
||||
if temperature and not temperature == 0.0:
|
||||
data["Temperature"] = temperature
|
||||
data["Temperature"] = round(temperature)
|
||||
|
||||
if pools:
|
||||
pool_1 = None
|
||||
|
||||
@@ -28,6 +28,14 @@ TABLE_KEYS = {
|
||||
"table": ["scan_table", "pools_table", "cfg_table"],
|
||||
"tree": ["cmd_table"],
|
||||
}
|
||||
|
||||
MINER_COUNT_BUTTONS = [
|
||||
"scan_miner_count",
|
||||
"cmd_miner_count",
|
||||
"cfg_miner_count",
|
||||
"pools_miner_count",
|
||||
]
|
||||
|
||||
BUTTON_KEYS = [
|
||||
"btn_scan",
|
||||
"btn_cmd",
|
||||
@@ -58,7 +66,7 @@ HASHRATE_COL_WIDTH = 12
|
||||
TEMP_COL_WIDTH = 12
|
||||
USER_COL_WIDTH = 31
|
||||
WATTAGE_COL_WIDTH = 8
|
||||
SPLIT_COL_WIDTH = 10
|
||||
SPLIT_COL_WIDTH = 6
|
||||
SCAN_COL_WIDTHS = [
|
||||
IP_COL_WIDTH,
|
||||
MODEL_COL_WIDTH,
|
||||
@@ -92,10 +100,11 @@ def get_scan_layout():
|
||||
sg.Button("Scan", key="btn_scan"),
|
||||
sg.Push(),
|
||||
sg.Button(
|
||||
"Scan",
|
||||
"Miners: 0",
|
||||
disabled=True,
|
||||
button_color=("black", "white smoke"),
|
||||
disabled_button_color=("black", "white smoke"),
|
||||
key="scan_miner_count",
|
||||
),
|
||||
],
|
||||
[
|
||||
@@ -140,10 +149,11 @@ def get_command_layout():
|
||||
sg.Button("Send Command", key="btn_cmd"),
|
||||
sg.Push(),
|
||||
sg.Button(
|
||||
"Command",
|
||||
"Miners: 0",
|
||||
disabled=True,
|
||||
button_color=("black", "white smoke"),
|
||||
disabled_button_color=("black", "white smoke"),
|
||||
key="cmd_miner_count",
|
||||
),
|
||||
],
|
||||
[
|
||||
@@ -190,10 +200,11 @@ def get_pools_layout():
|
||||
[
|
||||
sg.Push(),
|
||||
sg.Button(
|
||||
"Pools",
|
||||
"Miners: 0",
|
||||
disabled=True,
|
||||
button_color=("black", "white smoke"),
|
||||
disabled_button_color=("black", "white smoke"),
|
||||
key="pools_miner_count",
|
||||
),
|
||||
],
|
||||
[
|
||||
@@ -229,10 +240,11 @@ def get_config_layout():
|
||||
sg.Button("GENERATE", key="cfg_generate"),
|
||||
sg.Push(),
|
||||
sg.Button(
|
||||
"Configure",
|
||||
"Miners: 0",
|
||||
disabled=True,
|
||||
button_color=("black", "white smoke"),
|
||||
disabled_button_color=("black", "white smoke"),
|
||||
key="cfg_miner_count",
|
||||
),
|
||||
],
|
||||
[
|
||||
|
||||
@@ -41,7 +41,8 @@ async def scan_miners(network: MinerNetwork):
|
||||
update_tables([{"IP": str(miner.ip)} for miner in resolved_miners])
|
||||
progress_bar_len += 1
|
||||
await update_prog_bar(progress_bar_len)
|
||||
await update_prog_bar(network_size - len(resolved_miners))
|
||||
progress_bar_len += network_size - len(resolved_miners)
|
||||
await update_prog_bar(progress_bar_len)
|
||||
await get_miners_data(resolved_miners)
|
||||
|
||||
|
||||
@@ -58,7 +59,6 @@ async def get_miners_data(miners: list):
|
||||
update_tables(miner_data)
|
||||
progress_bar_len += 1
|
||||
await update_prog_bar(progress_bar_len)
|
||||
print("Done")
|
||||
|
||||
|
||||
async def _get_data(miner):
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
from tools.cfg_util.cfg_util_qt.layout import TABLE_KEYS, TABLE_HEADERS, window
|
||||
from tools.cfg_util.cfg_util_qt.layout import (
|
||||
MINER_COUNT_BUTTONS,
|
||||
TABLE_KEYS,
|
||||
TABLE_HEADERS,
|
||||
window,
|
||||
)
|
||||
from tools.cfg_util.cfg_util_qt.imgs import LIGHT
|
||||
import PySimpleGUI as sg
|
||||
|
||||
@@ -8,6 +13,12 @@ def clear_tables():
|
||||
window[table].update([])
|
||||
for tree in TABLE_KEYS["tree"]:
|
||||
window[tree].update(sg.TreeData())
|
||||
update_miner_count(0)
|
||||
|
||||
|
||||
def update_miner_count(count):
|
||||
for button in MINER_COUNT_BUTTONS:
|
||||
window[button].update(f"Miners: {count}")
|
||||
|
||||
|
||||
def update_tables(data: list):
|
||||
@@ -18,7 +29,13 @@ def update_tables(data: list):
|
||||
"CONFIG": [["" for _ in TABLE_HEADERS["CONFIG"]] for _ in data],
|
||||
}
|
||||
for data_idx, item in enumerate(data):
|
||||
for key in item.keys():
|
||||
keys = item.keys()
|
||||
if "Hashrate" in keys:
|
||||
if not isinstance(item["Hashrate"], str):
|
||||
item[
|
||||
"Hashrate"
|
||||
] = f"{format(float(item['Hashrate']), '.2f').rjust(6, ' ')} TH/s"
|
||||
for key in keys:
|
||||
for table in TABLE_HEADERS.keys():
|
||||
for idx, header in enumerate(TABLE_HEADERS[table]):
|
||||
if key == header:
|
||||
@@ -33,3 +50,5 @@ def update_tables(data: list):
|
||||
treedata.insert("", idx, "", item, icon=LIGHT)
|
||||
|
||||
window["cmd_table"].update(treedata)
|
||||
|
||||
update_miner_count(len(data))
|
||||
|
||||
Reference in New Issue
Block a user