|
32 | 32 | from functools import partial
|
33 | 33 |
|
34 | 34 | from PyQt5.QtCore import Qt, pyqtSignal
|
35 |
| -from PyQt5.QtGui import QIcon |
36 | 35 | from PyQt5.QtWidgets import QDialog
|
37 | 36 |
|
38 | 37 | from classes import info, ui_util
|
|
41 | 40 | from classes.metrics import track_metric_screen
|
42 | 41 | from windows.views.credits_treeview import CreditsTreeView
|
43 | 42 | from windows.views.changelog_treeview import ChangelogTreeView
|
| 43 | +from windows.views.menu import StyledContextMenu |
44 | 44 |
|
45 | 45 | import requests
|
46 | 46 | import threading
|
@@ -132,14 +132,9 @@ def __init__(self):
|
132 | 132 | }
|
133 | 133 | about_html = '''
|
134 | 134 | <div align="center" style="">
|
135 |
| - <p style="font-size:11pt; font-weight: 300;"> |
136 |
| - <a href="https://www.openshot.org/%s?r=about-us" |
137 |
| - style="text-decoration:none; color: #ffffff;">%s</a> |
138 |
| - </p> |
| 135 | + <p style="font-size:11pt; font-weight: 300;">%s</p> |
139 | 136 | </div>
|
140 |
| - ''' % ( |
141 |
| - info.website_language(), |
142 |
| - description_text,) |
| 137 | + ''' % (description_text,) |
143 | 138 | company_html = '''
|
144 | 139 | <div style="font-weight:400;" align="right">
|
145 | 140 | %s<br>
|
@@ -168,6 +163,40 @@ def __init__(self):
|
168 | 163 | # Load release details from HTTP
|
169 | 164 | self.get_current_release()
|
170 | 165 |
|
| 166 | + def contextMenuEvent(self, event): |
| 167 | + """Handle right-click context menu.""" |
| 168 | + menu = StyledContextMenu(parent=self) |
| 169 | + |
| 170 | + # get translations |
| 171 | + self.app = get_app() |
| 172 | + _ = self.app._tr |
| 173 | + |
| 174 | + # Add "Copy Version Info" action |
| 175 | + copy_action = menu.addAction(_("Copy Version Info")) |
| 176 | + action = menu.exec_(event.globalPos()) |
| 177 | + |
| 178 | + if action == copy_action: |
| 179 | + self.copy_version_info() |
| 180 | + |
| 181 | + def copy_version_info(self): |
| 182 | + """Copy cleaned version info (without HTML <div> and unnecessary links) to clipboard.""" |
| 183 | + # Get the raw HTML text from txtversion |
| 184 | + raw_html = self.txtversion.text() |
| 185 | + |
| 186 | + # Step 1: Strip <div> tags |
| 187 | + clean_text = re.sub(r'<div[^>]*>|</div>', '', raw_html).strip() |
| 188 | + |
| 189 | + # Step 2: Replace <br/> with newline characters |
| 190 | + clean_text = clean_text.replace("<br/>", "\n") |
| 191 | + |
| 192 | + # Step 3: Remove the HTML link after 'Release Date: x-x-x |' |
| 193 | + # Matches "Release Date: YYYY-MM-DD | <a href=...>Release Notes</a>" and keeps only "Release Date: YYYY-MM-DD" |
| 194 | + clean_text = re.sub(r'(Release Date: \d{4}-\d{2}-\d{2}) \|.*', r'\1', clean_text) |
| 195 | + |
| 196 | + # Copy the cleaned text to the clipboard |
| 197 | + clipboard = get_app().clipboard() |
| 198 | + clipboard.setText(clean_text) |
| 199 | + |
171 | 200 | def display_release(self, version_text):
|
172 | 201 |
|
173 | 202 | version_html = '''
|
|
0 commit comments