mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-10-05 21:37:56 +03:00
Add traffic statistics tooltips
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
Vendored
+32
@@ -2282,5 +2282,37 @@ TRANSLATION = {
|
||||
"RU": "Все журналы",
|
||||
"ZH": "全部日志",
|
||||
"isReviewed": "True"
|
||||
},
|
||||
"Upload Speed": {
|
||||
"source": [
|
||||
"Furious.Window.MainWindow"
|
||||
],
|
||||
"RU": "Скорость отдачи",
|
||||
"ZH": "上传速度",
|
||||
"isReviewed": "True"
|
||||
},
|
||||
"Download Speed": {
|
||||
"source": [
|
||||
"Furious.Window.MainWindow"
|
||||
],
|
||||
"RU": "Скорость загрузки",
|
||||
"ZH": "下载速度",
|
||||
"isReviewed": "True"
|
||||
},
|
||||
"Upload Traffic Usage": {
|
||||
"source": [
|
||||
"Furious.Window.MainWindow"
|
||||
],
|
||||
"RU": "Объём исходящего трафика",
|
||||
"ZH": "上传流量",
|
||||
"isReviewed": "True"
|
||||
},
|
||||
"Download Traffic Usage": {
|
||||
"source": [
|
||||
"Furious.Window.MainWindow"
|
||||
],
|
||||
"RU": "Объём входящего трафика",
|
||||
"ZH": "下载流量",
|
||||
"isReviewed": "True"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ class NetworkStateBadge(Mixins.QTranslatable, Mixins.ThemeAware, QWidget):
|
||||
self.updateStatusText()
|
||||
|
||||
|
||||
class TrafficStatsBadge(Mixins.ThemeAware, QWidget):
|
||||
class TrafficStatsBadge(Mixins.QTranslatable, Mixins.ThemeAware, QWidget):
|
||||
"""Display independently updated traffic speeds and usage."""
|
||||
|
||||
UploadIconFileName = 'cloud-upload.svg'
|
||||
@@ -295,12 +295,30 @@ class TrafficStatsBadge(Mixins.ThemeAware, QWidget):
|
||||
self._layout.addWidget(self.downloadUsageLabel)
|
||||
|
||||
self.setIconByTheme(APP().theme())
|
||||
self.updateToolTips()
|
||||
|
||||
def updateToolTips(self):
|
||||
"""Apply translated descriptions to each traffic statistic."""
|
||||
uploadSpeed, downloadSpeed, uploadUsage, downloadUsage = (
|
||||
_('Upload Speed'),
|
||||
_('Download Speed'),
|
||||
_('Upload Traffic Usage'),
|
||||
_('Download Traffic Usage'),
|
||||
)
|
||||
|
||||
self.uploadIconLabel.setToolTip(uploadSpeed)
|
||||
self.uploadTextLabel.setToolTip(uploadSpeed)
|
||||
self.uploadUsageLabel.setToolTip(uploadUsage)
|
||||
self.downloadIconLabel.setToolTip(downloadSpeed)
|
||||
self.downloadTextLabel.setToolTip(downloadSpeed)
|
||||
self.downloadUsageLabel.setToolTip(downloadUsage)
|
||||
|
||||
def setIconByTheme(self, theme: str):
|
||||
"""Apply theme-appropriate upload and download icons."""
|
||||
iconFactory = (
|
||||
bootstrapIconWhite if theme == AppStyleSheet.Dark else bootstrapIcon
|
||||
)
|
||||
|
||||
self.uploadIconLabel.setPixmap(
|
||||
iconFactory(self.UploadIconFileName).pixmap(self.IconSize)
|
||||
)
|
||||
@@ -335,6 +353,10 @@ class TrafficStatsBadge(Mixins.ThemeAware, QWidget):
|
||||
"""Refresh traffic-direction icons after a theme change."""
|
||||
self.setIconByTheme(theme)
|
||||
|
||||
def retranslate(self):
|
||||
"""Refresh translated traffic-statistic tooltips."""
|
||||
self.updateToolTips()
|
||||
|
||||
|
||||
class ConnectionStatusWidget(QWidget):
|
||||
"""Compose network state and traffic speed as one permanent status item."""
|
||||
|
||||
Reference in New Issue
Block a user