Skip to content

Commit

Permalink
Adding option to copy transcription source from transcription table (c…
Browse files Browse the repository at this point in the history
  • Loading branch information
raivisdejus authored and mriamnobody committed Nov 22, 2024
1 parent 1d4d9d6 commit de222a4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions buzz/widgets/transcription_tasks_table_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
from PyQt6.QtCore import Qt
from PyQt6.QtCore import pyqtSignal, QModelIndex
from PyQt6.QtSql import QSqlTableModel, QSqlRecord
from PyQt6.QtGui import QKeySequence
from PyQt6.QtWidgets import (
QApplication,
QWidget,
QMenu,
QHeaderView,
Expand Down Expand Up @@ -262,9 +264,26 @@ def save_column_visibility(self):
)
self.settings.end_group()

def copy_selected_fields(self):
selected_text = ""
for row in self.selectionModel().selectedRows():
row_index = row.row()
file_name = self.model().data(self.model().index(row_index, 3))
url = self.model().data(self.model().index(row_index, 14))

selected_text += f"{file_name}{url}\n"

selected_text = selected_text.rstrip("\n")
QApplication.clipboard().setText(selected_text)

def keyPressEvent(self, event: QtGui.QKeyEvent) -> None:
if event.key() == Qt.Key.Key_Return:
self.return_clicked.emit()

if event.matches(QKeySequence.StandardKey.Copy):
self.copy_selected_fields()
return

super().keyPressEvent(event)

def selected_transcriptions(self) -> List[Transcription]:
Expand Down

0 comments on commit de222a4

Please sign in to comment.