Skip to content

Commit

Permalink
Double-click to copy row value
Browse files Browse the repository at this point in the history
  • Loading branch information
LightArrowsEXE committed Sep 8, 2024
1 parent 9eed86d commit b6c51b1
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions vspreview/plugins/builtins/frame_props.ppy
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import annotations

from typing import Any

from PyQt6.QtWidgets import QLabel, QTableView, QWidget, QHeaderView
from vapoursynth import FrameProps
from vstools import ChromaLocation, ColorRange, FieldBased, Matrix, Primaries, PropEnum, Transfer
from PyQt6.QtCore import QModelIndex
from PyQt6.QtWidgets import QApplication, QHeaderView, QLabel, QTableView, QWidget

from vapoursynth import FrameProps
from vspreview.core import Frame, HBoxLayout, Stretch, Switch, TableModel, VBoxLayout
from vspreview.plugins import AbstractPlugin, PluginConfig
from vstools import ChromaLocation, ColorRange, FieldBased, Matrix, Primaries, PropEnum, Transfer

__all__ = [
'FramePropsPlugin'
Expand Down Expand Up @@ -146,6 +148,8 @@ class FramePropsPlugin(AbstractPlugin, QWidget):
table.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Interactive)
table.verticalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Interactive)

table.doubleClicked.connect(self.copy_value_to_clipboard)

return table

def setup_raw_data_switch(self) -> None:
Expand Down Expand Up @@ -296,3 +300,10 @@ class FramePropsPlugin(AbstractPlugin, QWidget):
self.category_labels[category].setVisible(is_visible)

self.raw_data_table.setVisible(is_raw)

def copy_value_to_clipboard(self, index: QModelIndex) -> None:
"""Copy the value of the clicked cell to the clipboard."""

value = index.sibling(index.row(), 1).data()

QApplication.clipboard().setText(value)

0 comments on commit b6c51b1

Please sign in to comment.