added sorting to the 3 main tables
This commit is contained in:
@@ -6,6 +6,7 @@ from tools.cfg_util.cfg_util_qt.scan import btn_scan
|
|||||||
from tools.cfg_util.cfg_util_qt.commands import btn_light
|
from tools.cfg_util.cfg_util_qt.commands import btn_light
|
||||||
from tools.cfg_util.cfg_util_qt.layout import window
|
from tools.cfg_util.cfg_util_qt.layout import window
|
||||||
from tools.cfg_util.cfg_util_qt.general import btn_all
|
from tools.cfg_util.cfg_util_qt.general import btn_all
|
||||||
|
from tools.cfg_util.cfg_util_qt.tables import TableManager
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
|
||||||
sg.set_options(font=("Liberation Mono", 10))
|
sg.set_options(font=("Liberation Mono", 10))
|
||||||
@@ -22,6 +23,16 @@ async def main():
|
|||||||
event, value = window.read(0)
|
event, value = window.read(0)
|
||||||
if event in (None, "Close", sg.WIN_CLOSED):
|
if event in (None, "Close", sg.WIN_CLOSED):
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
if isinstance(event, tuple):
|
||||||
|
if len(window["scan_table"].Values) > 0:
|
||||||
|
if event[0].endswith("_table"):
|
||||||
|
if event[2][0] == -1:
|
||||||
|
mgr = TableManager()
|
||||||
|
table = window[event[0]].Widget
|
||||||
|
mgr.sort_key = table.heading(event[2][1])["text"]
|
||||||
|
mgr.update_tables()
|
||||||
|
|
||||||
# scan tab
|
# scan tab
|
||||||
if event == "scan_all":
|
if event == "scan_all":
|
||||||
_table = "scan_table"
|
_table = "scan_table"
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ def get_command_layout():
|
|||||||
expand_y=True,
|
expand_y=True,
|
||||||
col0_heading="Light",
|
col0_heading="Light",
|
||||||
col0_width=IMAGE_COL_WIDTH,
|
col0_width=IMAGE_COL_WIDTH,
|
||||||
|
enable_events=True,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ async def _scan_miners(network: MinerNetwork):
|
|||||||
MinerFactory().clear_cached_miners()
|
MinerFactory().clear_cached_miners()
|
||||||
|
|
||||||
global progress_bar_len
|
global progress_bar_len
|
||||||
|
progress_bar_len = 0
|
||||||
|
|
||||||
network_size = len(network)
|
network_size = len(network)
|
||||||
await update_prog_bar(progress_bar_len, max=(3 * network_size))
|
await update_prog_bar(progress_bar_len, max=(3 * network_size))
|
||||||
|
|||||||
@@ -73,9 +73,12 @@ class TableManager(metaclass=Singleton):
|
|||||||
"POOLS": [["" for _ in TABLE_HEADERS["POOLS"]] for _ in self.data],
|
"POOLS": [["" for _ in TABLE_HEADERS["POOLS"]] for _ in self.data],
|
||||||
"CONFIG": [["" for _ in TABLE_HEADERS["CONFIG"]] for _ in self.data],
|
"CONFIG": [["" for _ in TABLE_HEADERS["CONFIG"]] for _ in self.data],
|
||||||
}
|
}
|
||||||
for data_idx, key in enumerate(
|
sorted_keys = sorted(self.data.keys(), key=lambda x: self._get_sort(x))
|
||||||
sorted(self.data.keys(), key=lambda x: self._get_sort(x))
|
if sorted_keys == list(self.data.keys()):
|
||||||
):
|
sorted_keys = sorted(
|
||||||
|
self.data.keys(), key=lambda x: ipaddress.ip_address(x)
|
||||||
|
)
|
||||||
|
for data_idx, key in enumerate(sorted_keys):
|
||||||
item = self.data[key]
|
item = self.data[key]
|
||||||
keys = item.keys()
|
keys = item.keys()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user