added CTRL+A select all binding to cfg util and board util tables

This commit is contained in:
UpstreamData
2022-03-17 16:10:12 -06:00
parent d452ca36b7
commit 134b5fe0ff
4 changed files with 20 additions and 2 deletions

View File

@@ -6,6 +6,14 @@ from tools.bad_board_util.layout import window
import pyperclip
def table_select_all():
window["ip_table"].update(
select_rows=(
[row for row in range(len(window["ip_table"].Values))]
)
)
def copy_from_table(table):
selection = table.selection()
copy_values = []

View File

@@ -5,7 +5,7 @@ import PySimpleGUI as sg
from tools.bad_board_util.layout import window
from tools.bad_board_util.func.miners import refresh_data, scan_and_get_data
from tools.bad_board_util.func.files import import_iplist, export_iplist
from tools.bad_board_util.func.ui import sort_data, copy_from_table
from tools.bad_board_util.func.ui import sort_data, copy_from_table, table_select_all
from network import MinerNetwork
@@ -16,6 +16,7 @@ async def ui():
window.read(timeout=0)
table = window["ip_table"].Widget
table.bind("<Control-Key-c>", lambda x: copy_from_table(table))
table.bind("<Control-Key-a>", lambda x: table_select_all())
while True:
event, value = window.read(timeout=0)
if event in (None, 'Close', sg.WIN_CLOSED):

View File

@@ -6,6 +6,14 @@ from tools.cfg_util.cfg_util_sg.layout import window
import pyperclip
def table_select_all():
window["ip_table"].update(
select_rows=(
[row for row in range(len(window["ip_table"].Values))]
)
)
def copy_from_table(table):
selection = table.selection()
copy_values = []

View File

@@ -9,7 +9,7 @@ from tools.cfg_util.cfg_util_sg.func.miners import send_config, miner_light, ref
from tools.cfg_util.cfg_util_sg.func.files import import_iplist, \
import_config_file, export_iplist, export_config_file, export_csv
from tools.cfg_util.cfg_util_sg.func.decorators import disable_buttons
from tools.cfg_util.cfg_util_sg.func.ui import sort_data, copy_from_table, copy_from_ssh_table
from tools.cfg_util.cfg_util_sg.func.ui import sort_data, copy_from_table, table_select_all, copy_from_ssh_table
from network import MinerNetwork
@@ -20,6 +20,7 @@ async def ui():
window.read(timeout=0)
table = window["ip_table"].Widget
table.bind("<Control-Key-c>", lambda x: copy_from_table(table))
table.bind("<Control-Key-a>", lambda x: table_select_all())
# light tag shows red row for fault lights
table.tag_configure("light", foreground="white", background="red")
# left justify the hostnames