@@ -379,6 +379,7 @@ def setup(self, stdscr):
379379 else :
380380 self ._theme_name = ret_theme_name
381381 self ._cnf .theme_not_supported = True
382+ self ._cnf .theme_has_error = True if ret == - 1 else False
382383
383384 self .log = Log ()
384385 # For the time being, supported players are mpv, mplayer and vlc.
@@ -1315,7 +1316,18 @@ def closeHistoryEmptyNotification(self):
13151316 def _show_theme_not_supported (self ):
13161317 if self ._cnf .theme_not_supported_notification_shown :
13171318 return
1318- txt = 'Error loading selected theme!\n ____Using fallback theme.'
1319+ if self ._cnf .theme_has_error :
1320+ txt = '|Error loading selected theme!|\n ____Using |fallback| theme.'
1321+ else :
1322+ tmp = ['' , '' , '' ]
1323+ tmp [0 ] = '|Theme not supported!|'
1324+ tmp [1 ] = 'This terminal supports up to |{}| colors...' .format (curses .COLORS )
1325+ tmp [2 ] = 'Using |fallback| theme.'
1326+ while len (tmp [0 ]) < len (tmp [1 ]) - 2 :
1327+ tmp [0 ] = '_' + tmp [0 ] + '_'
1328+ while len (tmp [2 ]) < len (tmp [1 ]):
1329+ tmp [2 ] = '_' + tmp [2 ] + '_'
1330+ txt = '\n ' .join (tmp )
13191331 self ._show_help (txt , mode_to_set = self .ws .operation_mode , caption = '' ,
13201332 prompt = '' , is_message = True )
13211333 # start 1750 ms counter
@@ -2723,8 +2735,8 @@ def to_time(secs):
27232735 return str (hour ) + ':' + str (min )
27242736
27252737 check_days = 10
2726- if logger .isEnabledFor (logging .DEBUG ):
2727- logger .debug ('detectUpdateThread: starting ...' )
2738+ if logger .isEnabledFor (logging .INFO ):
2739+ logger .info ('detectUpdateThread: Starting ...' )
27282740 ##################
27292741 #delay(5, stop)
27302742 from pyradio import version as my_version , app_state as my_app_state
@@ -2734,8 +2746,8 @@ def to_time(secs):
27342746 this_version = my_version + '-' + my_app_state
27352747 connection_fail_count = 0
27362748 ran = random .randint (25 , 45 )
2737- if logger .isEnabledFor (logging .DEBUG ):
2738- logger .debug ('detectUpdateThread: Will check in {} seconds' .format (ran ))
2749+ if logger .isEnabledFor (logging .INFO ):
2750+ logger .info ('detectUpdateThread: Will check in {} seconds' .format (ran ))
27392751 delay (ran , stop )
27402752 if stop ():
27412753 if logger .isEnabledFor (logging .DEBUG ):
@@ -2757,15 +2769,15 @@ def to_time(secs):
27572769 #delta=check_days
27582770 if delta < check_days :
27592771 clean_date_files (files )
2760- if logger .isEnabledFor (logging .DEBUG ):
2772+ if logger .isEnabledFor (logging .INFO ):
27612773 if check_days - delta == 1 :
2762- logger .debug ('detectUpdateThread: Will check again tomorrow...' )
2774+ logger .info ('detectUpdateThread: Will check again tomorrow...' )
27632775 else :
2764- logger .debug ('detectUpdateThread: Will check again in {} days...' .format (check_days - delta ))
2776+ logger .info ('detectUpdateThread: Will check again in {} days...' .format (check_days - delta ))
27652777 return
27662778
2767- if logger .isEnabledFor (logging .DEBUG ):
2768- logger .debug ('detectUpdateThread: checking for updates' )
2779+ if logger .isEnabledFor (logging .INFO ):
2780+ logger .info ('detectUpdateThread: Checking for updates' )
27692781 url = 'https://api.github.com/repos/coderholic/pyradio/tags'
27702782 while True :
27712783 if stop ():
@@ -2795,13 +2807,13 @@ def to_time(secs):
27952807 # PROGRAM DEBUG: set last github tag's version
27962808 # to check display functionality
27972809 #last_tag = '0.8.8-RC1'
2798- if logger .isEnabledFor (logging .DEBUG ):
2799- logger .debug ('detectUpdateThread: Upstream version found: {}' .format (last_tag ))
2810+ if logger .isEnabledFor (logging .INFO ):
2811+ logger .info ('detectUpdateThread: Upstream version found: {}' .format (last_tag ))
28002812 if this_version == last_tag :
28012813 clean_date_files (files , - 1 )
28022814 create_tadays_date_file (a_path )
2803- if logger .isEnabledFor (logging .DEBUG ):
2804- logger .debug ('detectUpdateThread: No update found. Will check again in {} days. Exiting...' .format (check_days ))
2815+ if logger .isEnabledFor (logging .INFO ):
2816+ logger .info ('detectUpdateThread: No update found. Will check again in {} days. Exiting...' .format (check_days ))
28052817 break
28062818 else :
28072819 # PROGRAM DEBUG: set program's version
@@ -2831,7 +2843,7 @@ def to_time(secs):
28312843 logger .info ('detectUpdateThread: Update available: {}' .format (last_tag ))
28322844 a_lock .acquire ()
28332845 if logger .isEnabledFor (logging .DEBUG ):
2834- logger .debug ('notification sent!!!' )
2846+ logger .debug ('detectUpdateThread: Update notification sent!!!' )
28352847 self ._update_version = last_tag
28362848 a_lock .release ()
28372849 while True :
@@ -2861,12 +2873,12 @@ def to_time(secs):
28612873 break
28622874
28632875 else :
2864- if logger .isEnabledFor (logging .DEBUG ):
2865- logger .debug ('detectUpdateThread: Error: Cannot get upstream version!!!' )
2876+ if logger .isEnabledFor (logging .ERROR ):
2877+ logger .error ('detectUpdateThread: Error: Cannot get upstream version!!!' )
28662878 connection_fail_count += 1
28672879 if connection_fail_count > 4 :
2868- if logger .isEnabledFor (logging .DEBUG ):
2869- logger .debug ('detectUpdateThread: Error: Too many connection failures. Exiting...' )
2880+ if logger .isEnabledFor (logging .ERROR ):
2881+ logger .error ('detectUpdateThread: Error: Too many connection failures. Exiting...' )
28702882 break
28712883 delay (60 , stop )
28722884
@@ -3521,6 +3533,7 @@ def keypress(self, char):
35213533 self ._theme_name = self ._cnf .theme
35223534 else :
35233535 self ._theme_name = ret_theme_name
3536+ self ._cnf .theme_has_error = True if ret == - 1 else False
35243537 self ._cnf .theme_not_supported = True
35253538 curses .doupdate ()
35263539 # make sure config is not saved
@@ -3835,6 +3848,7 @@ def keypress(self, char):
38353848 char not in self ._chars_to_bypass and \
38363849 char not in self ._chars_to_bypass_for_search and \
38373850 char not in (ord ('T' ),)):
3851+ logger .error ('DE \n \n Exiting theme selector?\n \n ' )
38383852 theme_id , save_theme = self ._theme_selector .keypress (char )
38393853
38403854 #if self._cnf.theme_not_supported:
@@ -3867,9 +3881,10 @@ def keypress(self, char):
38673881 theme_path = self ._theme_selector ._themes [theme_id ][1 ])
38683882 if isinstance (ret , tuple ):
38693883 ret = ret [0 ]
3870- if ret == - 1 :
3884+ if ret < 0 :
38713885 self ._theme_name = ret_theme_name
38723886 self ._cnf .theme_not_supported = True
3887+ self ._cnf .theme_has_error = True if ret == - 1 else False
38733888 self ._cnf .theme_not_supported_notification_shown = False
38743889 self ._show_theme_not_supported ()
38753890 #self.refreshBody()
0 commit comments