Using some qt method instead of helper when possible

This commit is contained in:
Adsooi 2022-01-31 21:39:51 +01:00
parent 3119c3f9dc
commit 2d12291075
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
7 changed files with 10 additions and 18 deletions

View file

@ -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")

View file

@ -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 {

View file

@ -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")
}
}

View file

@ -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.<br>
<br>
You should have received a copy of the GNU General Public License along with this program. If not, see <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a>."
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')
}
}

View file

@ -69,7 +69,7 @@ Popup {
textFormat: TextEdit.MarkdownText
text: qsTr("Fetching changelog...")
onLinkActivated: Helper.openUrl(link)
onLinkActivated: Qt.openUrlExternally(link)
}
}

View file

@ -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())

View file

@ -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)
}