added the ability to copy a list of IP addresses directly from the table.

This commit is contained in:
UpstreamData
2022-01-06 13:15:08 -07:00
parent 5d66c539d4
commit 3ecc27b3f9
3 changed files with 20 additions and 1 deletions

View File

@@ -3,6 +3,22 @@ import re
from cfg_util.layout import window
import pyperclip
def copy_from_table(table):
print("copy")
selection = table.selection()
copy_values = []
for each in selection:
try:
value = table.item(each)["values"][0]
copy_values.append(str(value))
except:
pass
copy_string = "\n".join(copy_values)
pyperclip.copy(copy_string)
async def update_ui_with_data(key, message, append=False):
if append:

View File

@@ -6,7 +6,7 @@ from cfg_util.layout import window, generate_config_layout
from cfg_util.func.miners import scan_network, send_config, miner_light, get_data, generate_config, import_config, \
scan_and_get_data
from cfg_util.func.files import import_iplist, import_config_file, export_iplist, export_config_file
from cfg_util.func.ui import sort_data
from cfg_util.func.ui import sort_data, copy_from_table
from network import MinerNetwork
@@ -14,6 +14,9 @@ import webbrowser
async def ui():
window.read(timeout=0)
table = window["ip_table"].Widget
table.bind("<Control-Key-c>", lambda x: copy_from_table(table))
while True:
event, value = window.read(timeout=10)
if event in (None, 'Close', sg.WIN_CLOSED):