Label Link widget instead of setting every label individually
parent
bdc9270ba8
commit
e8ffff4739
|
@ -5,6 +5,7 @@ import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from tape_editor_widgets import *
|
from tape_editor_widgets import *
|
||||||
|
from widgets import LabelWebLink
|
||||||
from deploy import download_ffmpeg, get_ffmpeg_version, download_git
|
from deploy import download_ffmpeg, get_ffmpeg_version, download_git
|
||||||
|
|
||||||
from PIL import ImageGrab
|
from PIL import ImageGrab
|
||||||
|
@ -364,19 +365,14 @@ class UpdateWidget(QWidget):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
hr_html_string = "<hr style=\"background-color:gray;\">"
|
hr_html_string = "<hr style=\"background-color:gray;\">"
|
||||||
download_link = ("https://github.com/git-for-windows/git/releases/download/"
|
|
||||||
"v2.46.2.windows.1/PortableGit-2.46.2-64-bit.7z.exe")
|
|
||||||
|
|
||||||
self.grid = QGridLayout()
|
self.grid = QGridLayout()
|
||||||
|
|
||||||
self.git_checkbox = QCheckBox()
|
self.git_checkbox = QCheckBox()
|
||||||
self.git_checkbox.setDisabled(True)
|
self.git_checkbox.setDisabled(True)
|
||||||
self.git_label = QLabel("Download and unpack git")
|
self.git_label = QLabel("Download and unpack git")
|
||||||
self.git_label_link = QLabel(f"<a href=\"{download_link}\">"
|
self.git_label_link = LabelWebLink("https://github.com/git-for-windows/git/releases/download/"
|
||||||
f"{download_link.replace('https://', '').replace('download/', 'download/<br>')}</a>")
|
"v2.46.2.windows.1/PortableGit-2.46.2-64-bit.7z.exe")
|
||||||
self.git_label_link.setTextInteractionFlags(Qt.TextInteractionFlag.TextBrowserInteraction)
|
self.git_label_link.break_at("download")
|
||||||
self.git_label_link.setTextInteractionFlags(Qt.TextInteractionFlag.LinksAccessibleByMouse)
|
|
||||||
self.git_label_link.setOpenExternalLinks(True)
|
|
||||||
self.git_pushbutton = QPushButton("Download")
|
self.git_pushbutton = QPushButton("Download")
|
||||||
self.git_pushbutton.clicked.connect(self.download_git_action)
|
self.git_pushbutton.clicked.connect(self.download_git_action)
|
||||||
self.git_dir = DirWidget("./utils")
|
self.git_dir = DirWidget("./utils")
|
||||||
|
@ -389,11 +385,7 @@ class UpdateWidget(QWidget):
|
||||||
self.git_update_checkbox = QCheckBox()
|
self.git_update_checkbox = QCheckBox()
|
||||||
self.git_update_checkbox.setDisabled(True)
|
self.git_update_checkbox.setDisabled(True)
|
||||||
self.git_update_label = QLabel("Download update from git")
|
self.git_update_label = QLabel("Download update from git")
|
||||||
self.git_update_label_link = QLabel("<a href=\"https://git.kompot.si/jaka/barotrauma-sunken-tapes\">"
|
self.git_update_label_link = LabelWebLink("https://git.kompot.si/jaka/barotrauma-sunken-tapes")
|
||||||
"git.kompot.si/jaka/barotrauma-sunken-tapes</a>")
|
|
||||||
self.git_update_label_link.setTextInteractionFlags(Qt.TextInteractionFlag.TextBrowserInteraction)
|
|
||||||
self.git_update_label_link.setTextInteractionFlags(Qt.TextInteractionFlag.LinksAccessibleByMouse)
|
|
||||||
self.git_update_label_link.setOpenExternalLinks(True)
|
|
||||||
self.git_update_pushbutton = QPushButton("Update")
|
self.git_update_pushbutton = QPushButton("Update")
|
||||||
self.grid.addWidget(self.git_update_checkbox, 10, 0)
|
self.grid.addWidget(self.git_update_checkbox, 10, 0)
|
||||||
self.grid.addWidget(self.git_update_label, 10, 1)
|
self.grid.addWidget(self.git_update_label, 10, 1)
|
||||||
|
@ -432,16 +424,11 @@ class InstallWidget(QWidget):
|
||||||
self.grid = QGridLayout()
|
self.grid = QGridLayout()
|
||||||
|
|
||||||
hr_html_string = "<hr style=\"background-color:gray;\">"
|
hr_html_string = "<hr style=\"background-color:gray;\">"
|
||||||
download_link = "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z"
|
|
||||||
|
|
||||||
self.ffmpeg_checkbox = QCheckBox()
|
self.ffmpeg_checkbox = QCheckBox()
|
||||||
self.ffmpeg_checkbox.setDisabled(True)
|
self.ffmpeg_checkbox.setDisabled(True)
|
||||||
self.ffmpeg_label = QLabel("Download and unpack ffmpeg")
|
self.ffmpeg_label = QLabel("Download and unpack ffmpeg")
|
||||||
self.ffmpeg_label_link = QLabel(f"<a href=\"{download_link}\">"
|
self.ffmpeg_label_link = LabelWebLink("https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z")
|
||||||
f"{download_link.replace('https://', '')}</a>")
|
|
||||||
self.ffmpeg_label_link.setTextInteractionFlags(Qt.TextInteractionFlag.TextBrowserInteraction)
|
|
||||||
self.ffmpeg_label_link.setTextInteractionFlags(Qt.TextInteractionFlag.LinksAccessibleByMouse)
|
|
||||||
self.ffmpeg_label_link.setOpenExternalLinks(True)
|
|
||||||
self.ffmpeg_pushbutton = QPushButton("Download")
|
self.ffmpeg_pushbutton = QPushButton("Download")
|
||||||
self.ffmpeg_pushbutton.clicked.connect(self.download_ffmpeg_action)
|
self.ffmpeg_pushbutton.clicked.connect(self.download_ffmpeg_action)
|
||||||
self.ffmpeg_dir = DirWidget("./utils")
|
self.ffmpeg_dir = DirWidget("./utils")
|
||||||
|
|
|
@ -10,6 +10,19 @@ import datetime
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
|
class LabelWebLink(QLabel):
|
||||||
|
def __init__(self, text):
|
||||||
|
text = f"<a href=\"{text}\">{text.replace('https://', '')}</a>"
|
||||||
|
super().__init__(text)
|
||||||
|
self.setTextInteractionFlags(Qt.TextInteractionFlag.TextBrowserInteraction)
|
||||||
|
self.setTextInteractionFlags(Qt.TextInteractionFlag.LinksAccessibleByMouse)
|
||||||
|
self.setOpenExternalLinks(True)
|
||||||
|
|
||||||
|
def break_at(self, string):
|
||||||
|
self.setText(self.text().replace(f'{string}/', f'{string}/<br>'))
|
||||||
|
|
||||||
|
|
||||||
class LineNumberArea(QWidget):
|
class LineNumberArea(QWidget):
|
||||||
|
|
Loading…
Reference in New Issue