22#
33# Picard, the next-generation MusicBrainz tagger
44#
5- # Copyright (C) 2019-2023 Philipp Wolfer
5+ # Copyright (C) 2019-2023, 2026 Philipp Wolfer
66# Copyright (C) 2020 Julius Michaelis
77# Copyright (C) 2020-2021, 2023-2024 Laurent Monin
88# Copyright (C) 2021 Gabriel Ferreira
2020# You should have received a copy of the GNU General Public License
2121# along with this program; if not, see <https://www.gnu.org/licenses/>.
2222
23+ import os
24+
2325from PyQt6 .QtCore import (
2426 QObject ,
2527 pyqtClassInfo ,
3032 QDBusConnection ,
3133 QDBusMessage ,
3234)
35+ from PyQt6 .QtWidgets import QMainWindow
3336
3437from picard import PICARD_DESKTOP_NAME
3538
3639from . import AbstractProgressStatusIndicator
3740
3841
3942DBUS_INTERFACE = 'com.canonical.Unity.LauncherEntry'
43+ APP_ID = PICARD_DESKTOP_NAME if not os .getenv ('SNAP' ) else 'picard_picard.desktop'
4044
4145
4246class UnityLauncherEntryService (QObject ):
43- def __init__ (self , bus , app_id ):
47+ def __init__ (self , bus : QDBusConnection , app_id : str ):
4448 super ().__init__ ()
4549 self ._bus = bus
4650 self ._app_uri = 'application://' + app_id
@@ -61,7 +65,7 @@ def current_progress(self):
6165 def is_available (self ):
6266 return self ._available
6367
64- def update (self , progress , visible = True ):
68+ def update (self , progress : float , visible : bool = True ) -> None :
6569 self ._progress = progress
6670 self ._visible = visible
6771 # Automatic forwarding of Qt signals does not work in this case
@@ -101,10 +105,10 @@ def query(self):
101105
102106
103107class UnityLauncherEntryStatusIndicator (AbstractProgressStatusIndicator ):
104- def __init__ (self , window ):
108+ def __init__ (self , window : QMainWindow ):
105109 super ().__init__ ()
106110 bus = QDBusConnection .sessionBus ()
107- self ._service = UnityLauncherEntryService (bus , PICARD_DESKTOP_NAME )
111+ self ._service = UnityLauncherEntryService (bus , APP_ID )
108112
109113 @property
110114 def is_available (self ):
0 commit comments