fixed refreshing data

This commit is contained in:
UpstreamData
2022-05-26 16:19:15 -06:00
parent 89cfde28f5
commit e86c93e287
3 changed files with 30 additions and 24 deletions

View File

@@ -5,7 +5,7 @@ from miners.miner_factory import MinerFactory
from tools.cfg_util.decorators import disable_buttons
from tools.cfg_util.layout import TABLE_KEYS
from tools.cfg_util.layout import window, update_prog_bar
from tools.cfg_util.tables import TableManager
from tools.cfg_util.tables import TableManager, DATA_HEADER_MAP
progress_bar_len = 0
@@ -81,10 +81,15 @@ async def update_miners_data(miners: list):
)
for all_data in data_generator:
data = await all_data
TableManager().update_item(data.asdict())
TableManager().update_item(data)
progress_bar_len += 1
await update_prog_bar(progress_bar_len)
async def _get_data(miner):
return await miner.get_data()
_data = (await miner.get_data()).asdict()
data = {}
for item in _data.keys():
if item in DATA_HEADER_MAP.keys():
data[DATA_HEADER_MAP[item]] = _data[item]
return data

View File

@@ -4,30 +4,10 @@ from miners.miner_factory import MinerFactory
from network import MinerNetwork
from tools.cfg_util.decorators import disable_buttons
from tools.cfg_util.layout import window, update_prog_bar, TABLE_HEADERS
from tools.cfg_util.tables import clear_tables, TableManager
from tools.cfg_util.tables import clear_tables, TableManager, DATA_HEADER_MAP
progress_bar_len = 0
DATA_HEADER_MAP = {
"ip": "IP",
"model": "Model",
"hostname": "Hostname",
"hashrate": "Hashrate",
"temperature_avg": "Temp",
"wattage": "Wattage",
"ideal_chips": "Ideal",
"left_chips": "Left Board",
"center_chips": "Center Board",
"right_chips": "Right Board",
"total_chips": "Total",
"nominal": "Nominal",
"pool_split": "Split",
"pool_1_url": "Pool 1",
"pool_1_user": "Pool 1 User",
"pool_2_url": "Pool 2",
"pool_2_user": "Pool 2 User",
"percent_ideal": "Chip %",
}
DEFAULT_DATA = set()

View File

@@ -9,6 +9,27 @@ from tools.cfg_util.imgs import TkImages, LIGHT, FAULT_LIGHT
import PySimpleGUI as sg
import ipaddress
DATA_HEADER_MAP = {
"ip": "IP",
"model": "Model",
"hostname": "Hostname",
"hashrate": "Hashrate",
"temperature_avg": "Temp",
"wattage": "Wattage",
"ideal_chips": "Ideal",
"left_chips": "Left Board",
"center_chips": "Center Board",
"right_chips": "Right Board",
"total_chips": "Total",
"nominal": "Nominal",
"pool_split": "Split",
"pool_1_url": "Pool 1",
"pool_1_user": "Pool 1 User",
"pool_2_url": "Pool 2",
"pool_2_user": "Pool 2 User",
"percent_ideal": "Chip %",
}
def update_miner_count(count):
for button in MINER_COUNT_BUTTONS: