show version in settings window
This commit is contained in:
@@ -19,7 +19,7 @@ class Ui_Dialog(object):
|
|||||||
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||||
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Apply|QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Ok)
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Apply|QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Ok)
|
||||||
self.buttonBox.setObjectName("buttonBox")
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1)
|
self.gridLayout.addWidget(self.buttonBox, 1, 4, 1, 1)
|
||||||
self.tabWidget = QtWidgets.QTabWidget(parent=Dialog)
|
self.tabWidget = QtWidgets.QTabWidget(parent=Dialog)
|
||||||
self.tabWidget.setObjectName("tabWidget")
|
self.tabWidget.setObjectName("tabWidget")
|
||||||
self.tab_general = QtWidgets.QWidget()
|
self.tab_general = QtWidgets.QWidget()
|
||||||
@@ -227,7 +227,23 @@ class Ui_Dialog(object):
|
|||||||
spacerItem8 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
|
spacerItem8 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||||
self.verticalLayout.addItem(spacerItem8)
|
self.verticalLayout.addItem(spacerItem8)
|
||||||
self.tabWidget.addTab(self.tab_advanced, "")
|
self.tabWidget.addTab(self.tab_advanced, "")
|
||||||
self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
|
self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 5)
|
||||||
|
self.label_qt_icon = QtWidgets.QLabel(parent=Dialog)
|
||||||
|
self.label_qt_icon.setText("")
|
||||||
|
self.label_qt_icon.setObjectName("label_qt_icon")
|
||||||
|
self.gridLayout.addWidget(self.label_qt_icon, 1, 2, 1, 1)
|
||||||
|
self.label_app_version = QtWidgets.QLabel(parent=Dialog)
|
||||||
|
self.label_app_version.setText("")
|
||||||
|
self.label_app_version.setObjectName("label_app_version")
|
||||||
|
self.gridLayout.addWidget(self.label_app_version, 1, 1, 1, 1)
|
||||||
|
self.label_app_icon = QtWidgets.QLabel(parent=Dialog)
|
||||||
|
self.label_app_icon.setText("")
|
||||||
|
self.label_app_icon.setObjectName("label_app_icon")
|
||||||
|
self.gridLayout.addWidget(self.label_app_icon, 1, 0, 1, 1)
|
||||||
|
self.label_qt_version = QtWidgets.QLabel(parent=Dialog)
|
||||||
|
self.label_qt_version.setText("")
|
||||||
|
self.label_qt_version.setObjectName("label_qt_version")
|
||||||
|
self.gridLayout.addWidget(self.label_qt_version, 1, 3, 1, 1)
|
||||||
|
|
||||||
self.retranslateUi(Dialog)
|
self.retranslateUi(Dialog)
|
||||||
self.tabWidget.setCurrentIndex(0)
|
self.tabWidget.setCurrentIndex(0)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="1" column="0">
|
<item row="1" column="4">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0" colspan="5">
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -559,6 +559,34 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="label_qt_icon">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="label_app_version">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_app_icon">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QLabel" name="label_qt_version">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
|||||||
BIN
gotify_tray/gui/images/qt.png
Normal file
BIN
gotify_tray/gui/images/qt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 729 B |
@@ -6,7 +6,7 @@ from ..models.MessagesModel import MessageItemDataRole, MessagesModelItem
|
|||||||
from ..designs.widget_message import Ui_Form
|
from ..designs.widget_message import Ui_Form
|
||||||
from gotify_tray.database import Downloader
|
from gotify_tray.database import Downloader
|
||||||
from gotify_tray.database import Settings
|
from gotify_tray.database import Settings
|
||||||
from gotify_tray.utils import convert_links, get_image, update_widget_property
|
from gotify_tray.utils import convert_links, extract_image, update_widget_property
|
||||||
from gotify_tray.gui.themes import get_theme_file
|
from gotify_tray.gui.themes import get_theme_file
|
||||||
from gotify_tray.gotify.models import GotifyMessageModel
|
from gotify_tray.gotify.models import GotifyMessageModel
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ class MessageWidget(QtWidgets.QWidget, Ui_Form):
|
|||||||
|
|
||||||
# If the message is only an image URL, then instead of showing the message,
|
# If the message is only an image URL, then instead of showing the message,
|
||||||
# download the image and show it in the message label
|
# download the image and show it in the message label
|
||||||
if image_url := get_image(message.message):
|
if image_url := extract_image(message.message):
|
||||||
downloader = Downloader()
|
downloader = Downloader()
|
||||||
filename = downloader.get_filename(image_url)
|
filename = downloader.get_filename(image_url)
|
||||||
self.set_message_image(filename)
|
self.set_message_image(filename)
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ import logging
|
|||||||
import platform
|
import platform
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from gotify_tray.__version__ import __version__
|
||||||
from gotify_tray.database import Cache, Settings
|
from gotify_tray.database import Cache, Settings
|
||||||
from gotify_tray.gotify import GotifyMessageModel
|
from gotify_tray.gotify import GotifyMessageModel
|
||||||
from gotify_tray.gui.models import MessagesModelItem
|
from gotify_tray.gui.models import MessagesModelItem
|
||||||
from . import MessageWidget
|
from . import MessageWidget
|
||||||
from gotify_tray.utils import get_icon, verify_server, open_file
|
from gotify_tray.utils import get_image, get_icon, verify_server, open_file
|
||||||
from gotify_tray.tasks import (
|
from gotify_tray.tasks import (
|
||||||
ExportSettingsTask,
|
ExportSettingsTask,
|
||||||
ImportSettingsTask,
|
ImportSettingsTask,
|
||||||
@@ -87,6 +88,11 @@ class SettingsDialog(QtWidgets.QDialog, Ui_Dialog):
|
|||||||
self.groupbox_watchdog.setChecked(settings.value("watchdog/enabled", type=bool))
|
self.groupbox_watchdog.setChecked(settings.value("watchdog/enabled", type=bool))
|
||||||
self.spin_watchdog_interval.setValue(settings.value("watchdog/interval/s", type=int))
|
self.spin_watchdog_interval.setValue(settings.value("watchdog/interval/s", type=int))
|
||||||
|
|
||||||
|
self.label_app_version.setText(__version__)
|
||||||
|
self.label_qt_version.setText(QtCore.QT_VERSION_STR)
|
||||||
|
self.label_app_icon.setPixmap(QtGui.QIcon(get_image("logo.ico")).pixmap(22,22))
|
||||||
|
self.label_qt_icon.setPixmap(QtGui.QIcon(get_image("qt.png")).pixmap(22,22))
|
||||||
|
|
||||||
def add_message_widget(self):
|
def add_message_widget(self):
|
||||||
self.message_widget = MessageWidget(
|
self.message_widget = MessageWidget(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ def verify_server(force_new: bool = False, enable_import: bool = True) -> bool:
|
|||||||
def process_messages(messages: list[gotify.GotifyMessageModel]) -> Iterator[gotify.GotifyMessageModel]:
|
def process_messages(messages: list[gotify.GotifyMessageModel]) -> Iterator[gotify.GotifyMessageModel]:
|
||||||
downloader = Downloader()
|
downloader = Downloader()
|
||||||
for message in messages:
|
for message in messages:
|
||||||
if image_url := get_image(message.message):
|
if image_url := extract_image(message.message):
|
||||||
downloader.get_filename(image_url)
|
downloader.get_filename(image_url)
|
||||||
yield message
|
yield message
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ def convert_links(text):
|
|||||||
return _link.sub(replace, text)
|
return _link.sub(replace, text)
|
||||||
|
|
||||||
|
|
||||||
def get_image(s: str) -> str | None:
|
def extract_image(s: str) -> str | None:
|
||||||
"""If `s` contains only an image URL, this function returns that URL.
|
"""If `s` contains only an image URL, this function returns that URL.
|
||||||
This function also extracts a URL in the `` markdown image format.
|
This function also extracts a URL in the `` markdown image format.
|
||||||
"""
|
"""
|
||||||
@@ -91,6 +91,10 @@ def open_file(filename: str):
|
|||||||
subprocess.call(["open", filename])
|
subprocess.call(["open", filename])
|
||||||
|
|
||||||
|
|
||||||
|
def get_image(name: str) -> str:
|
||||||
|
return get_abs_path(f"gotify_tray/gui/images/{name}")
|
||||||
|
|
||||||
|
|
||||||
def get_icon(name: str) -> str:
|
def get_icon(name: str) -> str:
|
||||||
if platform.system() == "Darwin":
|
if platform.system() == "Darwin":
|
||||||
name += "-macos"
|
name += "-macos"
|
||||||
|
|||||||
Reference in New Issue
Block a user