From 2d12291075d8226b7adf3fcdd46d139dff2b0d34 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Mon, 31 Jan 2022 21:39:51 +0100 Subject: [PATCH] Using some qt method instead of helper when possible --- LogarithmPlotter/helper.py | 5 ----- .../qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml | 6 +++--- .../qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml | 2 +- .../qml/eu/ad5001/LogarithmPlotter/Popup/About.qml | 4 ++-- .../qml/eu/ad5001/LogarithmPlotter/Popup/Changelog.qml | 2 +- .../qml/eu/ad5001/LogarithmPlotter/Popup/GreetScreen.qml | 7 ++----- .../qml/eu/ad5001/LogarithmPlotter/js/history/name.js | 2 +- 7 files changed, 10 insertions(+), 18 deletions(-) diff --git a/LogarithmPlotter/helper.py b/LogarithmPlotter/helper.py index 8f6732b..164cd16 100644 --- a/LogarithmPlotter/helper.py +++ b/LogarithmPlotter/helper.py @@ -24,7 +24,6 @@ from PySide2 import __version__ as PySide2_version from os import chdir, path from json import loads -from webbrowser import open as openWeb from sys import version as sys_version from urllib.request import urlopen from urllib.error import HTTPError, URLError @@ -142,10 +141,6 @@ class Helper(QObject): """ return QCoreApplication.translate('main',"Built with PySide2 (Qt) v{} and python v{}").format(PySide2_version, sys_version.split("\n")[0]) - @Slot(str) - def openUrl(self, url): - openWeb(url) - @Slot() def fetchChangelog(self): changelog_cache_path = path.join(path.dirname(path.realpath(__file__)), "CHANGELOG.md") diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml index a50ecc5..fd09af4 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/AppMenuBar.qml @@ -146,12 +146,12 @@ MenuBar { Action { text: qsTr("&Source code") icon.name: 'software-sources' - onTriggered: Helper.openUrl("https://git.ad5001.eu/Ad5001/LogarithmPlotter/issues") + onTriggered: Qt.openUrlExternally("https://git.ad5001.eu/Ad5001/LogarithmPlotter/issues") } Action { text: qsTr("&Report a bug") icon.name: 'tools-report-bug' - onTriggered: Helper.openUrl("https://git.ad5001.eu/Ad5001/LogarithmPlotter/issues") + onTriggered: Qt.openUrlExternally("https://git.ad5001.eu/Ad5001/LogarithmPlotter/issues") } Action { text: qsTr("&Changelog") @@ -161,7 +161,7 @@ MenuBar { Action { text: qsTr("&Help translating!") icon.name: 'translator' - onTriggered: Helper.openUrl("https://hosted.weblate.org/engage/logarithmplotter/") + onTriggered: Qt.openUrlExternally("https://hosted.weblate.org/engage/logarithmplotter/") } MenuSeparator { } Action { diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml index c030d8d..023b0a0 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml @@ -334,7 +334,7 @@ ApplicationWindow { Action { text: qsTr("&Update LogarithmPlotter") icon.name: 'update' - onTriggered: Helper.openUrl("https://dev.apps.ad5001.eu/logarithmplotter") + onTriggered: Qt.openUrlExternally("https://dev.apps.ad5001.eu/logarithmplotter") } } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/About.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/About.qml index 6a75152..9fe9145 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/About.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/About.qml @@ -98,7 +98,7 @@ This program is free software: you can redistribute it and/or modify it under th This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/." - onLinkActivated: Helper.openUrl(link) + onLinkActivated: Qt.openUrlExternally(link) } Button { @@ -108,6 +108,6 @@ You should have received a copy of the GNU General Public License along with thi anchors.topMargin: 10 text: qsTr('Report a bug') icon.name: 'bug' - onClicked: Helper.openUrl('https://git.ad5001.eu/Ad5001/LogarithmPlotter') + onClicked: Qt.openUrlExternally('https://git.ad5001.eu/Ad5001/LogarithmPlotter') } } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/Changelog.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/Changelog.qml index 41864d4..b3743d2 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/Changelog.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/Changelog.qml @@ -69,7 +69,7 @@ Popup { textFormat: TextEdit.MarkdownText text: qsTr("Fetching changelog...") - onLinkActivated: Helper.openUrl(link) + onLinkActivated: Qt.openUrlExternally(link) } } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/GreetScreen.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/GreetScreen.qml index f7010a5..b8f5593 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/GreetScreen.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Popup/GreetScreen.qml @@ -137,11 +137,8 @@ Popup { } } - Timer { - running: Helper.getSetting("last_install_greet") != Helper.getVersion() - repeat: false - interval: 50 - onTriggered: greetingPopup.open() + Component.onCompleted: if(Helper.getSetting("last_install_greet") != Helper.getVersion()) { + greetingPopup.open() } onClosed: Helper.setSetting("last_install_greet", Helper.getVersion()) diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/history/name.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/history/name.js index 4ad78c6..5c2b114 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/history/name.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/history/name.js @@ -48,7 +48,7 @@ class NameChanged extends EP.EditedProperty { } getReadableString() { - return qsTr('Name of %1 %2 changed to %3.') + return qsTr('%1 %2 renamed to %3.') .arg(Objects.types[this.targetType].displayType()) .arg(this.targetName).arg(this.newValue) }