Move desktop plugin initialization to updateStartOnLogon(); Fixes: #1735

This commit is contained in:
Dmitri Bogomolov 2021-02-15 14:00:52 +02:00
parent c51108e867
commit d35c284e13
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -849,8 +849,7 @@ class MyForm(settingsmixin.SMainWindow):
""" """
startonlogon = BMConfigParser().safeGetBoolean( startonlogon = BMConfigParser().safeGetBoolean(
'bitmessagesettings', 'startonlogon') 'bitmessagesettings', 'startonlogon')
if 'win32' in sys.platform or 'win64' in sys.platform: if sys.platform.startswith('win'): # Auto-startup for Windows
# Auto-startup for Windows
RUN_PATH = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run" RUN_PATH = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"
settings = QtCore.QSettings( settings = QtCore.QSettings(
RUN_PATH, QtCore.QSettings.NativeFormat) RUN_PATH, QtCore.QSettings.NativeFormat)
@ -860,8 +859,12 @@ class MyForm(settingsmixin.SMainWindow):
settings.setValue("PyBitmessage", sys.argv[0]) settings.setValue("PyBitmessage", sys.argv[0])
else: else:
settings.remove("PyBitmessage") settings.remove("PyBitmessage")
elif self.desktop: else:
try: # get desktop plugin if any
self.desktop = get_plugin('desktop')()
self.desktop.adjust_startonlogon(startonlogon) self.desktop.adjust_startonlogon(startonlogon)
except (NameError, TypeError):
self.desktop = False
def updateTTL(self, sliderPosition): def updateTTL(self, sliderPosition):
TTL = int(sliderPosition ** 3.199 + 3600) TTL = int(sliderPosition ** 3.199 + 3600)
@ -1429,13 +1432,6 @@ class MyForm(settingsmixin.SMainWindow):
def _noop_update(*args, **kwargs): def _noop_update(*args, **kwargs):
pass pass
# get desktop plugin if any
if 'win' not in sys.platform:
try:
self.desktop = get_plugin('desktop')()
except TypeError:
self.desktop = False
try: try:
self.indicatorUpdate = get_plugin('indicator')(self) self.indicatorUpdate = get_plugin('indicator')(self)
except (NameError, TypeError): except (NameError, TypeError):