added the ability to copy a list of IP addresses directly from the table.
This commit is contained in:
@@ -3,6 +3,22 @@ import re
|
|||||||
|
|
||||||
from cfg_util.layout import window
|
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):
|
async def update_ui_with_data(key, message, append=False):
|
||||||
if append:
|
if append:
|
||||||
|
|||||||
@@ -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, \
|
from cfg_util.func.miners import scan_network, send_config, miner_light, get_data, generate_config, import_config, \
|
||||||
scan_and_get_data
|
scan_and_get_data
|
||||||
from cfg_util.func.files import import_iplist, import_config_file, export_iplist, export_config_file
|
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
|
from network import MinerNetwork
|
||||||
|
|
||||||
@@ -14,6 +14,9 @@ import webbrowser
|
|||||||
|
|
||||||
|
|
||||||
async def ui():
|
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:
|
while True:
|
||||||
event, value = window.read(timeout=10)
|
event, value = window.read(timeout=10)
|
||||||
if event in (None, 'Close', sg.WIN_CLOSED):
|
if event in (None, 'Close', sg.WIN_CLOSED):
|
||||||
|
|||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Reference in New Issue
Block a user