ui v1.1
This commit is contained in:
BIN
ui/app.ico
Normal file
BIN
ui/app.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
37
ui/editor.py
37
ui/editor.py
@@ -1,10 +1,19 @@
|
||||
# v3.0.0 editor.py
|
||||
# v4.1.0 editor-link-click-fix-v1
|
||||
import re
|
||||
import webbrowser
|
||||
|
||||
from PyQt6.QtCore import Qt, QUrl
|
||||
from PyQt6.QtGui import QDesktopServices
|
||||
from PyQt6.QtWidgets import QTextEdit
|
||||
from PyQt6.QtCore import (
|
||||
Qt,
|
||||
QUrl,
|
||||
)
|
||||
|
||||
from PyQt6.QtGui import (
|
||||
QDesktopServices,
|
||||
)
|
||||
|
||||
from PyQt6.QtWidgets import (
|
||||
QTextEdit,
|
||||
)
|
||||
|
||||
|
||||
URL_PATTERN = re.compile(
|
||||
@@ -15,9 +24,14 @@ URL_PATTERN = re.compile(
|
||||
|
||||
class LinkTextEdit(QTextEdit):
|
||||
|
||||
def mouseReleaseEvent(self, event) -> None:
|
||||
def mouseReleaseEvent(
|
||||
self,
|
||||
event,
|
||||
) -> None:
|
||||
if (
|
||||
event.modifiers()
|
||||
event.button()
|
||||
== Qt.MouseButton.LeftButton
|
||||
and event.modifiers()
|
||||
& Qt.KeyboardModifier.ControlModifier
|
||||
):
|
||||
cursor = self.cursorForPosition(
|
||||
@@ -47,14 +61,19 @@ class LinkTextEdit(QTextEdit):
|
||||
)
|
||||
|
||||
try:
|
||||
webbrowser.open(target)
|
||||
webbrowser.open(
|
||||
target
|
||||
)
|
||||
|
||||
except Exception:
|
||||
QDesktopServices.openUrl(
|
||||
QUrl(target)
|
||||
)
|
||||
|
||||
event.accept()
|
||||
|
||||
return
|
||||
|
||||
super().mouseReleaseEvent(event)
|
||||
|
||||
super().mouseReleaseEvent(
|
||||
event
|
||||
)
|
||||
@@ -28,7 +28,7 @@ def build_stylesheet(
|
||||
QWidget#container {{
|
||||
background: {background};
|
||||
border: 1px solid {border};
|
||||
border-radius: 16px;
|
||||
border-radius: 7px;
|
||||
}}
|
||||
|
||||
QWidget#container:hover {{
|
||||
|
||||
Reference in New Issue
Block a user