mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-30 10:12:01 +03:00
Catch any errors getting the clipboard data
I haven't run into this, but since we've got a nice localized string for it...
This commit is contained in:
parent
a20f2c05d7
commit
d8d0871729
@ -2131,8 +2131,12 @@ class PaintApp(App[None]):
|
||||
|
||||
def action_paste(self) -> None:
|
||||
"""Paste the clipboard as a selection."""
|
||||
import pyperclip
|
||||
text: str = pyperclip.paste()
|
||||
try:
|
||||
import pyperclip
|
||||
text: str = pyperclip.paste()
|
||||
except Exception as e:
|
||||
self.warning_message_box(_("Paint"), _("Error getting the Clipboard Data!") + "\n\n" + repr(e), "ok")
|
||||
return
|
||||
if not text:
|
||||
return
|
||||
if self.image.selection and self.image.selection.textbox_mode:
|
||||
|
Loading…
Reference in New Issue
Block a user