@@ -349,46 +349,52 @@ async def install(launch=False, latest=False):
349
349
# The code below will cache pixmaps of each themes showcase screenshots.
350
350
351
351
print (f"(11/{ steps_count } ) Caching pixmaps..." )
352
- if os .path .exists ('pix_cache.txt' ):
353
- os .remove ('pix_cache.txt' )
354
- open ('pix_cache.txt' , 'w' ).close ()
355
- globals .pix_cache .clear ()
352
+ try :
353
+ if os .path .exists ('pix_cache.txt' ):
354
+ os .remove ('pix_cache.txt' )
355
+ open ('pix_cache.txt' , 'w' ).close ()
356
+ globals .pix_cache .clear ()
356
357
357
- themes = utils .list_config_available ("themes" )
358
- backgrounds = utils .theme_images ()
359
- for theme in themes :
360
- background = str (backgrounds [themes .index (theme )])
361
- if background != "None" :
362
- Brightness = gui .brightness (background )
363
- pixmapByteArray = gui .buttonPixmap (bg = background , rounded = True , width = 284 , height = 160 , typing = "ByteArray" )
364
- globals .pix_cache [background ] = [pixmapByteArray , Brightness ]
365
- with open ('pix_cache.txt' , 'a' ) as f :
366
- f .write (f'{ background } : { str (pixmapByteArray .toBase64 ())} , { Brightness } \n ' )
358
+ themes = utils .list_config_available ("themes" )
359
+ backgrounds = utils .theme_images ()
360
+ for theme in themes :
361
+ background = str (backgrounds [themes .index (theme )])
362
+ if background != "None" :
363
+ Brightness = gui .brightness (background )
364
+ pixmapByteArray = gui .buttonPixmap (bg = background , rounded = True , width = 284 , height = 160 , typing = "ByteArray" )
365
+ globals .pix_cache [background ] = [pixmapByteArray , Brightness ]
366
+ with open ('pix_cache.txt' , 'a' ) as f :
367
+ f .write (f'{ background } : { str (pixmapByteArray .toBase64 ())} , { Brightness } \n ' )
368
+ except :
369
+ print ("Pixmaps could not be cached, this does not hinder your install.\n However customization page might take a second to load." )
367
370
print ("Finished caching pixmaps!\n " )
368
371
369
372
# >[Section 12]<
370
373
# The code below will cache descriptions of each extensions "//description" header.
371
374
372
375
print (f"(12/{ steps_count } ) Caching descriptions..." )
373
- if os .path .exists ('desc_cache.txt' ):
374
- os .remove ('desc_cache.txt' )
375
- else :
376
- open ('desc_cache.txt' , 'w' ).close ()
377
- globals .desc_cache .clear ()
376
+ try :
377
+ if os .path .exists ('desc_cache.txt' ):
378
+ os .remove ('desc_cache.txt' )
379
+ else :
380
+ open ('desc_cache.txt' , 'w' ).close ()
381
+ globals .desc_cache .clear ()
378
382
379
- extensions = []
380
- descriptions = utils .extension_descriptions ()
381
- for extension in utils .list_config_available ("extensions" ):
382
- if extension .lower ()[:- 3 ] not in [x .lower () for x in utils .list_config_available ("themes" )]:
383
- extensions .append (extension )
383
+ extensions = []
384
+ descriptions = utils .extension_descriptions ()
385
+ for extension in utils .list_config_available ("extensions" ):
386
+ if extension .lower ()[:- 3 ] not in [x .lower () for x in utils .list_config_available ("themes" )]:
387
+ extensions .append (extension )
384
388
385
- for extension in extensions :
386
- if extension [:- 3 ] not in globals .desc_cache :
387
- globals .desc_cache [extension [:- 3 ]] = descriptions [extensions .index (extension )]
388
- with open ("desc_cache.txt" , "a" ) as f :
389
- f .write (
390
- f'{ extension [:- 3 ]} : { descriptions [extensions .index (extension )]} \n '
389
+ for extension in extensions :
390
+ if extension [:- 3 ] not in globals .desc_cache :
391
+ globals .desc_cache [extension [:- 3 ]] = descriptions [extensions .index (extension )]
392
+ with open ("desc_cache.txt" , "a" ) as f :
393
+ f .write (
394
+ f'{ extension [:- 3 ]} : { descriptions [extensions .index (extension )]} \n '
391
395
)
396
+ except :
397
+ print ("Descriptions could not be cached, this does not hinder your install.\n However the extensions page may take a second to load." )
392
398
print ("Finished caching extension descriptions!\n " )
393
399
394
400
if latest :
@@ -694,47 +700,49 @@ async def update_addons(shipped=False):
694
700
695
701
else :
696
702
utils .verbose_print (f"{ unpacked_name } wasnt downloaded successfully..." )
697
- print ("Finished downloading 'custom' addons!\n " )
703
+ print ("Finished downloading 'custom' addons!\n " )
698
704
699
- print (f"(4/{ steps_count } ) Caching pixmaps..." )
700
- if os .path .exists ('pix_cache.txt' ):
701
- os .remove ('pix_cache.txt' )
702
- open ('pix_cache.txt' , 'w' ).close ()
703
- globals .pix_cache .clear ()
704
705
705
- themes = utils .list_config_available ("themes" )
706
- backgrounds = utils .theme_images ()
707
- for theme in themes :
708
- background = str (backgrounds [themes .index (theme )])
709
- if background != "None" :
710
- Brightness = gui .brightness (background )
711
- pixmapByteArray = gui .buttonPixmap (bg = background , rounded = True , width = 284 , height = 160 , typing = "ByteArray" )
712
- globals .pix_cache [background ] = [pixmapByteArray , Brightness ]
713
- with open ('pix_cache.txt' , 'a' ) as f :
714
- f .write (f'{ background } : { str (pixmapByteArray .toBase64 ())} , { Brightness } \n ' )
715
- print ("Finished caching pixmaps!\n " )
706
+ print (f"(4/{ steps_count } ) Caching pixmaps..." )
707
+ if os .path .exists ('pix_cache.txt' ):
708
+ os .remove ('pix_cache.txt' )
709
+ open ('pix_cache.txt' , 'w' ).close ()
710
+ globals .pix_cache .clear ()
716
711
717
- print (f"(5/{ steps_count } ) Caching descriptions..." )
718
- if os .path .exists ('desc_cache.txt' ):
719
- os .remove ('desc_cache.txt' )
720
- else :
721
- open ('desc_cache.txt' , 'w' ).close ()
722
- globals .desc_cache .clear ()
712
+ themes = utils .list_config_available ("themes" )
713
+ backgrounds = utils .theme_images ()
714
+ for theme in themes :
715
+ background = str (backgrounds [themes .index (theme )])
716
+ if background != "None" :
717
+ Brightness = gui .brightness (background )
718
+ pixmapByteArray = gui .buttonPixmap (bg = background , rounded = True , width = 284 , height = 160 , typing = "ByteArray" )
719
+ globals .pix_cache [background ] = [pixmapByteArray , Brightness ]
720
+ with open ('pix_cache.txt' , 'a' ) as f :
721
+ f .write (f'{ background } : { str (pixmapByteArray .toBase64 ())} , { Brightness } \n ' )
722
+ print ("Finished caching pixmaps!\n " )
723
723
724
- extensions = []
725
- descriptions = utils .extension_descriptions ()
726
- for extension in utils .list_config_available ("extensions" ):
727
- if extension .lower ()[:- 3 ] not in [x .lower () for x in utils .list_config_available ("themes" )]:
728
- extensions .append (extension )
724
+
725
+ print (f"(5/{ steps_count } ) Caching descriptions..." )
726
+ if os .path .exists ('desc_cache.txt' ):
727
+ os .remove ('desc_cache.txt' )
728
+ else :
729
+ open ('desc_cache.txt' , 'w' ).close ()
730
+ globals .desc_cache .clear ()
729
731
730
- for extension in extensions :
731
- if extension [:- 3 ] not in globals .desc_cache :
732
- globals .desc_cache [extension [:- 3 ]] = descriptions [extensions .index (extension )]
733
- with open ("desc_cache.txt" , "a" ) as f :
734
- f .write (
735
- f'{ extension [:- 3 ]} : { descriptions [extensions .index (extension )]} \n '
736
- )
737
- print ("Finished caching extension descriptions!\n " )
732
+ extensions = []
733
+ descriptions = utils .extension_descriptions ()
734
+ for extension in utils .list_config_available ("extensions" ):
735
+ if extension .lower ()[:- 3 ] not in [x .lower () for x in utils .list_config_available ("themes" )]:
736
+ extensions .append (extension )
737
+
738
+ for extension in extensions :
739
+ if extension [:- 3 ] not in globals .desc_cache :
740
+ globals .desc_cache [extension [:- 3 ]] = descriptions [extensions .index (extension )]
741
+ with open ("desc_cache.txt" , "a" ) as f :
742
+ f .write (
743
+ f'{ extension [:- 3 ]} : { descriptions [extensions .index (extension )]} \n '
744
+ )
745
+ print ("Finished caching extension descriptions!\n " )
738
746
739
747
740
748
async def update_app ():
0 commit comments