mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
geometry: Copy/Paste with system clipboard.
This commit is contained in:
1 parent
d610dfef7e
commit
012f7ce445
5 files changed
+115
-22
No files matched your search
@@ -116,3 +116,44 @@ class FileFormatError(ExeceptionWithMessageBox):
|
||||
_translate("Exception", "format because of") +
|
||||
f" '{self.reason}'"
|
||||
)
|
||||
|
||||
|
||||
class ClipboardFormatError(ExeceptionWithMessageBox):
|
||||
def __init__(self, mime=None, header=None, data=None):
|
||||
super(ClipboardFormatError, self).__init__(
|
||||
title = _translate("Exception", "Clipboard format error")
|
||||
)
|
||||
|
||||
self.mime = mime
|
||||
self.header = header
|
||||
self.data = data
|
||||
|
||||
if self.mime is not None:
|
||||
self.msg = f"Impossible to decode data to mime code '{self.mime}'"
|
||||
else:
|
||||
if len(self.header) == 0:
|
||||
msg = _translate("Exception", "without header")
|
||||
else:
|
||||
msg = (
|
||||
_translate("Exception", "with header") +
|
||||
f": {self.header}"
|
||||
)
|
||||
|
||||
self.msg = (
|
||||
_translate("Exception", "Invalid clipboard data format:") +
|
||||
f" '{self.data}' {msg}"
|
||||
)
|
||||
|
||||
self.alert()
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
||||
def header(self):
|
||||
return _translate("Exception", "Clipboard format error")
|
||||
|
||||
def short_message(self):
|
||||
return _translate("Exception", "Clipboard format unknown")
|
||||
|
||||
def message(self):
|
||||
return self.msg
|
||||
Reference in new issue
Block a user