Skip to content

Commit 57a2d8e

Browse files
committed
Adding translations to context menus on about / credits dialogs. Added context menu to contributors dialog, for copying email and viewing websites.
1 parent c1f13f4 commit 57a2d8e

File tree

2 files changed

+45
-9
lines changed

2 files changed

+45
-9
lines changed

src/windows/views/changelog_treeview.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def refresh_view(self, filter=None):
5959

6060
def contextMenuEvent(self, event):
6161
log.info('contextMenuEvent')
62+
_ = get_app()._tr
6263

6364
# Get data model and selection
6465
model = self.changelog_model.model
@@ -67,9 +68,9 @@ def contextMenuEvent(self, event):
6768
selected_hash = model.item(row, 0).text()
6869

6970
menu = QMenu(self)
70-
copy_action = menu.addAction("Copy Hash")
71+
copy_action = menu.addAction(_("Copy Hash"))
7172
copy_action.triggered.connect(partial(self.CopyHashMenuTriggered, selected_hash))
72-
github_action = menu.addAction("View on GitHub")
73+
github_action = menu.addAction(_("View on GitHub"))
7374
github_action.triggered.connect(partial(self.ChangelogMenuTriggered, selected_hash))
7475
menu.popup(QCursor.pos())
7576

src/windows/views/credits_treeview.py

+42-7
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,39 @@
1-
"""
1+
"""
22
@file
33
@brief This file contains the credits treeview, used by the about window
44
@author Noah Figg <[email protected]>
55
@author Jonathan Thomas <[email protected]>
6-
6+
77
@section LICENSE
8-
8+
99
Copyright (c) 2008-2018 OpenShot Studios, LLC
1010
(http://www.openshotstudios.com). This file is part of
1111
OpenShot Video Editor (http://www.openshot.org), an open-source project
1212
dedicated to delivering high quality video editing and animation solutions
1313
to the world.
14-
14+
1515
OpenShot Video Editor is free software: you can redistribute it and/or modify
1616
it under the terms of the GNU General Public License as published by
1717
the Free Software Foundation, either version 3 of the License, or
1818
(at your option) any later version.
19-
19+
2020
OpenShot Video Editor is distributed in the hope that it will be useful,
2121
but WITHOUT ANY WARRANTY; without even the implied warranty of
2222
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2323
GNU General Public License for more details.
24-
24+
2525
You should have received a copy of the GNU General Public License
2626
along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
2727
"""
2828

2929
import os
3030
from urllib.parse import urlparse
3131

32+
import webbrowser
3233
from PyQt5.QtCore import QSize, Qt, QPoint
33-
from PyQt5.QtWidgets import QListView, QTreeView, QMessageBox, QAbstractItemView, QMenu, QSizePolicy, QHeaderView
34+
from PyQt5.QtWidgets import QListView, QTreeView, QMessageBox, QAbstractItemView, QMenu, QSizePolicy, QHeaderView, QApplication
35+
from PyQt5.QtGui import QCursor
36+
from functools import partial
3437

3538
from classes.logger import log
3639
from classes.app import get_app
@@ -61,6 +64,38 @@ def refresh_view(self, filter=None):
6164
if "website" not in self.columns:
6265
self.setColumnHidden(4, True)
6366

67+
def contextMenuEvent(self, event):
68+
log.info('contextMenuEvent')
69+
_ = get_app()._tr
70+
71+
# Get data model and selection
72+
model = self.credits_model.model
73+
row = self.indexAt(event.pos()).row()
74+
if row != -1:
75+
email = model.item(row, 3).text()
76+
website = model.item(row, 4).text()
77+
78+
menu = QMenu(self)
79+
if email:
80+
copy_action = menu.addAction(_("Copy E-mail"))
81+
copy_action.triggered.connect(partial(self.CopyEmailTriggered, email))
82+
if website:
83+
github_action = menu.addAction(_("View Website"))
84+
github_action.triggered.connect(partial(self.ViewWebsite, website))
85+
menu.popup(QCursor.pos())
86+
87+
def CopyEmailTriggered(self, email=""):
88+
log.info("CopyEmailTriggered")
89+
clipboard = QApplication.clipboard()
90+
clipboard.setText(email)
91+
92+
def ViewWebsite(self, website=""):
93+
log.info("ViewWebsite")
94+
try:
95+
webbrowser.open(website)
96+
except:
97+
log.warning('Failed to launch web browser to %s' % website)
98+
6499
def __init__(self, credits, columns, *args):
65100
# Invoke parent init
66101
QListView.__init__(self, *args)

0 commit comments

Comments
 (0)