mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-14 01:59:36 +00:00
Update settings menu test for new option
This commit is contained in:
@@ -25,6 +25,7 @@ try:
|
||||
from .password_prompt import prompt_for_password
|
||||
from .input_utils import timed_input
|
||||
from .memory_protection import InMemorySecret
|
||||
from .clipboard import copy_to_clipboard
|
||||
|
||||
if logger.isEnabledFor(logging.DEBUG):
|
||||
logger.info("Modules imported successfully.")
|
||||
@@ -49,4 +50,5 @@ __all__ = [
|
||||
"prompt_for_password",
|
||||
"timed_input",
|
||||
"InMemorySecret",
|
||||
"copy_to_clipboard",
|
||||
]
|
||||
|
16
src/utils/clipboard.py
Normal file
16
src/utils/clipboard.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import threading
|
||||
import pyperclip
|
||||
|
||||
|
||||
def copy_to_clipboard(text: str, timeout: int) -> None:
|
||||
"""Copy text to the clipboard and clear after timeout seconds if unchanged."""
|
||||
|
||||
pyperclip.copy(text)
|
||||
|
||||
def clear_clipboard() -> None:
|
||||
if pyperclip.paste() == text:
|
||||
pyperclip.copy("")
|
||||
|
||||
timer = threading.Timer(timeout, clear_clipboard)
|
||||
timer.daemon = True
|
||||
timer.start()
|
Reference in New Issue
Block a user