[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 13/13] python/aqmp-tui: Allow copying message from TUI
|
From: |
G S Niteesh Babu |
|
Subject: |
[PATCH v3 13/13] python/aqmp-tui: Allow copying message from TUI |
|
Date: |
Sat, 31 Jul 2021 01:48:46 +0530 |
This commit adds a feature that enables use to copy
messages from the TUI after highlighting the message
in the history box using up/down arrow keys and pressing
alt-c.
Signed-off-by: G S Niteesh Babu <niteesh.gs@gmail.com>
---
python/qemu/aqmp/aqmp_tui.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/python/qemu/aqmp/aqmp_tui.py b/python/qemu/aqmp/aqmp_tui.py
index 4bae0d4e89..434f431a35 100644
--- a/python/qemu/aqmp/aqmp_tui.py
+++ b/python/qemu/aqmp/aqmp_tui.py
@@ -21,6 +21,7 @@
from pygments import lexers
from pygments import token as Token
+import pyperclip
import urwid
import urwid_readline
@@ -390,6 +391,14 @@ def keypress(self, size: Tuple[int, int], key: str) ->
Optional[str]:
self._update_highlighting()
self.change_focus(size, self.highlighting)
return None
+ if key == 'meta c':
+ if self.highlighting == -1:
+ return None
+ widget = self.history[self.highlighting].original_widget
+ text = widget.get_text()[0]
+ LOGGER.info('Text is %s', text)
+ pyperclip.copy(text)
+ return None
# Remove highlighting if someother key is pressed
if self.highlighting != -1:
--
2.17.1
- [PATCH v3 03/13] python: Add dependencies for AQMP TUI, (continued)
- [PATCH v3 03/13] python: Add dependencies for AQMP TUI, G S Niteesh Babu, 2021/07/30
- [PATCH v3 04/13] python/aqmp-tui: Add AQMP TUI draft, G S Niteesh Babu, 2021/07/30
- [PATCH v3 05/13] python: add entry point for aqmp-tui, G S Niteesh Babu, 2021/07/30
- [PATCH v3 06/13] python/aqmp-tui: Added type annotations for aqmp-tui, G S Niteesh Babu, 2021/07/30
- [PATCH v3 07/13] python: add optional pygments dependency, G S Niteesh Babu, 2021/07/30
- [PATCH v3 08/13] python/aqmp-tui: add syntax highlighting, G S Niteesh Babu, 2021/07/30
- [PATCH v3 09/13] python/aqmp-tui: Add QMP connection manager, G S Niteesh Babu, 2021/07/30
- [PATCH v3 10/13] python/aqmp-tui: Add scrolling to history box, G S Niteesh Babu, 2021/07/30
- [PATCH v3 11/13] python/aqmp-tui: Add ability to highlight messages, G S Niteesh Babu, 2021/07/30
- [PATCH v3 12/13] python/aqmp-tui: Add pyperclip dependency, G S Niteesh Babu, 2021/07/30
- [PATCH v3 13/13] python/aqmp-tui: Allow copying message from TUI,
G S Niteesh Babu <=