From 0c4f3e0dc0d1c41cda746e8d3ea23183389ddc64 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Mon, 15 Feb 2021 14:00:52 +0200 Subject: [PATCH] Move desktop plugin initialization to updateStartOnLogon(); Fixes: #1735 --- src/bitmessageqt/__init__.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 38bed4f2..eb140fb9 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -849,8 +849,7 @@ class MyForm(settingsmixin.SMainWindow): """ startonlogon = BMConfigParser().safeGetBoolean( 'bitmessagesettings', 'startonlogon') - if 'win32' in sys.platform or 'win64' in sys.platform: - # Auto-startup for Windows + if sys.platform.startswith('win'): # Auto-startup for Windows RUN_PATH = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run" settings = QtCore.QSettings( RUN_PATH, QtCore.QSettings.NativeFormat) @@ -860,8 +859,12 @@ class MyForm(settingsmixin.SMainWindow): settings.setValue("PyBitmessage", sys.argv[0]) else: settings.remove("PyBitmessage") - elif self.desktop: - self.desktop.adjust_startonlogon(startonlogon) + else: + try: # get desktop plugin if any + self.desktop = get_plugin('desktop')() + self.desktop.adjust_startonlogon(startonlogon) + except (NameError, TypeError): + self.desktop = False def updateTTL(self, sliderPosition): TTL = int(sliderPosition ** 3.199 + 3600) @@ -1429,13 +1432,6 @@ class MyForm(settingsmixin.SMainWindow): def _noop_update(*args, **kwargs): pass - # get desktop plugin if any - if 'win' not in sys.platform: - try: - self.desktop = get_plugin('desktop')() - except TypeError: - self.desktop = False - try: self.indicatorUpdate = get_plugin('indicator')(self) except (NameError, TypeError):