mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-02 08:18:25 +02:00
Copy selected node's content to the clipboard when Ctrl+C is pressed
When Ctrl+C is pressed while a node selected, its content is formatted to JSON and copied to the system's clipboard.
This commit is contained in:
parent
92e77e77a9
commit
751bad96c6
2 changed files with 31 additions and 4 deletions
|
@ -3,6 +3,7 @@
|
|||
import logging
|
||||
import os
|
||||
import time
|
||||
import json
|
||||
from enum import Enum
|
||||
from threading import Thread, Event, Lock
|
||||
from multiprocessing.pool import ThreadPool
|
||||
|
@ -753,6 +754,18 @@ class UIGraph(QObject):
|
|||
""" Reset currently hovered node to None. """
|
||||
self.hoveredNode = None
|
||||
|
||||
@Slot(result=str)
|
||||
def getSelectedNodeContent(self):
|
||||
"""
|
||||
Return the content of the currently selected node in a string, formatted to JSON.
|
||||
If no node is currently selected, an empty string is returned.
|
||||
"""
|
||||
if self._selectedNode:
|
||||
d = self._graph.toDict()
|
||||
node = d[self._selectedNode.name]
|
||||
return json.dumps(node, indent=4)
|
||||
return ''
|
||||
|
||||
undoStack = Property(QObject, lambda self: self._undoStack, constant=True)
|
||||
graphChanged = Signal()
|
||||
graph = Property(Graph, lambda self: self._graph, notify=graphChanged)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue