@@ -289,36 +289,39 @@ def set_value(self, listItem):
289
289
290
290
@log .log_function ()
291
291
def set_release_channel (self , listItem ):
292
- if listItem :
293
- self .set_value (listItem )
292
+ if 'value' in self .struct ['update' ]['settings' ]['ReleaseChannel' ]:
293
+ old_release_channel = self .struct ['update' ]['settings' ]['ReleaseChannel' ]['value' ]
294
+ self .set_value (listItem )
294
295
release_channel = self .struct ['update' ]['settings' ]['ReleaseChannel' ]['value' ]
295
296
296
- # Show or hide menu elements based on selected channel
297
- if release_channel == 'stable' :
298
- # Automatic update only on stable releases
299
- if 'hidden' in self .struct ['update' ]['settings' ]['AutoUpdate' ]:
300
- del (self .struct ['update' ]['settings' ]['AutoUpdate' ]['hidden' ])
301
- # Only show manual update options if automatic update disabled
302
- if self .struct ['update' ]['settings' ]['AutoUpdate' ]['value' ] == '0' :
297
+ # Only do work if ReleaseChannel changed
298
+ if release_channel != old_release_channel :
299
+ # Show or hide menu elements based on selected channel
300
+ if release_channel == 'stable' :
301
+ # Automatic update only on stable releases
302
+ if 'hidden' in self .struct ['update' ]['settings' ]['AutoUpdate' ]:
303
+ del (self .struct ['update' ]['settings' ]['AutoUpdate' ]['hidden' ])
304
+ # Only show manual update options if automatic update disabled
305
+ if self .struct ['update' ]['settings' ]['AutoUpdate' ]['value' ] == '0' :
306
+ if 'hidden' in self .struct ['update' ]['settings' ]['Channel' ]:
307
+ del (self .struct ['update' ]['settings' ]['Channel' ]['hidden' ])
308
+ if 'hidden' in self .struct ['update' ]['settings' ]['Build' ]:
309
+ del (self .struct ['update' ]['settings' ]['Build' ]['hidden' ])
310
+ else :
311
+ self .struct ['update' ]['settings' ]['Channel' ]['hidden' ] = 'true'
312
+ self .struct ['update' ]['settings' ]['Build' ]['hidden' ] = 'true'
313
+ else :
314
+ # Hide automatic update and show manual update options
315
+ self .struct ['update' ]['settings' ]['AutoUpdate' ]['hidden' ] = 'true'
303
316
if 'hidden' in self .struct ['update' ]['settings' ]['Channel' ]:
304
317
del (self .struct ['update' ]['settings' ]['Channel' ]['hidden' ])
305
318
if 'hidden' in self .struct ['update' ]['settings' ]['Build' ]:
306
319
del (self .struct ['update' ]['settings' ]['Build' ]['hidden' ])
307
- else :
308
- self .struct ['update' ]['settings' ]['Channel' ]['hidden' ] = 'true'
309
- self .struct ['update' ]['settings' ]['Build' ]['hidden' ] = 'true'
310
- else :
311
- # Hide automatic update and show manual update options
312
- self .struct ['update' ]['settings' ]['AutoUpdate' ]['hidden' ] = 'true'
313
- if 'hidden' in self .struct ['update' ]['settings' ]['Channel' ]:
314
- del (self .struct ['update' ]['settings' ]['Channel' ]['hidden' ])
315
- if 'hidden' in self .struct ['update' ]['settings' ]['Build' ]:
316
- del (self .struct ['update' ]['settings' ]['Build' ]['hidden' ])
317
-
318
- # Refresh json and available build channels if ReleaseChannel is stable, testing or custom with a custom URL set
319
- if release_channel != 'custom' or (release_channel == 'custom' and self .struct ['update' ]['settings' ]['CustomChannel1' ]['value' ]):
320
- self .update_json = self .build_json ()
321
- self .struct ['update' ]['settings' ]['Channel' ]['values' ] = self .get_channels ()
320
+
321
+ # Refresh json for available build channels if ReleaseChannel is stable, testing, or custom with URL set
322
+ if release_channel != 'custom' or (release_channel == 'custom' and self .struct ['update' ]['settings' ]['CustomChannel1' ]['value' ]):
323
+ self .update_json = self .build_json ()
324
+ self .struct ['update' ]['settings' ]['Channel' ]['values' ] = self .get_channels ()
322
325
323
326
324
327
@log .log_function ()
0 commit comments