@@ -274,25 +274,27 @@ def GetSectionList(self, configSet, configType):
274274 return cfgParser .sections ()
275275
276276 def GetHighlight (self , theme , element , fgBg = None ):
277- """Return individual highlighting theme elements .
277+ """Return individual theme element highlight color(s) .
278278
279- fgBg - string ('fg'or'bg') or None, if None return a dictionary
280- containing fg and bg colours (appropriate for passing to Tkinter in,
281- e.g., a tag_config call), otherwise fg or bg colour only as specified.
279+ fgBg - string ('fg' or 'bg') or None.
280+ If None, return a dictionary containing fg and bg colors with
281+ keys 'foreground' and 'background'. Otherwise, only return
282+ fg or bg color, as specified. Colors are intended to be
283+ appropriate for passing to Tkinter in, e.g., a tag_config call).
282284 """
283285 if self .defaultCfg ['highlight' ].has_section (theme ):
284286 themeDict = self .GetThemeDict ('default' , theme )
285287 else :
286288 themeDict = self .GetThemeDict ('user' , theme )
287289 fore = themeDict [element + '-foreground' ]
288- if element == 'cursor' : #there is no config value for cursor bg
290+ if element == 'cursor' : # There is no config value for cursor bg
289291 back = themeDict ['normal-background' ]
290292 else :
291293 back = themeDict [element + '-background' ]
292294 highlight = {"foreground" : fore , "background" : back }
293- if not fgBg : #return dict of both colours
295+ if not fgBg : # Return dict of both colors
294296 return highlight
295- else : #return specified colour only
297+ else : # Return specified color only
296298 if fgBg == 'fg' :
297299 return highlight ["foreground" ]
298300 if fgBg == 'bg' :
@@ -314,11 +316,11 @@ def GetThemeDict(self, type, themeName):
314316 cfgParser = self .defaultCfg ['highlight' ]
315317 else :
316318 raise InvalidTheme ('Invalid theme type specified' )
317- #foreground and background values are provded for each theme element
318- #(apart from cursor) even though all these values are not yet used
319- #by idle, to allow for their use in the future. Default values are
320- #generally black and white.
321- # TODO make theme, a constant, a module or class attribute
319+ # Provide foreground and background colors for each theme
320+ # element (other than cursor) even though some values are not
321+ # yet used by idle, to allow for their use in the future.
322+ # Default values are generally black and white.
323+ # TODO copy theme from a class attribute.
322324 theme = {'normal-foreground' :'#000000' ,
323325 'normal-background' :'#ffffff' ,
324326 'keyword-foreground' :'#000000' ,
@@ -350,18 +352,18 @@ def GetThemeDict(self, type, themeName):
350352 'console-background' :'#ffffff' }
351353 for element in theme :
352354 if not cfgParser .has_option (themeName , element ):
353- #we are going to return a default, print warning
354- warning = ('\n Warning: configHandler.py - IdleConf.GetThemeDict'
355+ # Print warning that will return a default color
356+ warning = ('\n Warning: configHandler.IdleConf.GetThemeDict'
355357 ' -\n problem retrieving theme element %r'
356358 '\n from theme %r.\n '
357- ' returning default value : %r' %
359+ ' returning default color : %r' %
358360 (element , themeName , theme [element ]))
359361 try :
360362 print (warning , file = sys .stderr )
361363 except OSError :
362364 pass
363- colour = cfgParser .Get (themeName , element , default = theme [ element ])
364- theme [element ] = colour
365+ theme [ element ] = cfgParser .Get (
366+ themeName , element , default = theme [element ])
365367 return theme
366368
367369 def CurrentTheme (self ):
0 commit comments