1919from wx import Colour
2020from wx .lib .masked import NumCtrl
2121
22- # from .. import widgets
2322from ..ui .preferences_dialogs import (PreferencesPanel , SpinChoiceEditor , IntegerChoiceEditor , boolean_editor ,
2423 StringChoiceEditor , PreferencesColorPicker )
2524from ..widgets import Label
3635ID_LOAD = 5551
3736ID_SAVE = 5552
3837ID_CANCEL = - 1
38+ TEXT_BACKGROUND = 'Text background'
39+ LIGHT_GRAY = 'light gray'
40+ FIXED_FONT = 'fixed font'
3941
4042
4143@lru_cache (maxsize = 2 )
42- def ReadFonts (fixed = False ):
44+ def read_fonts (fixed = False ):
4345 """Returns list with fixed width fonts"""
4446 f = wx .FontEnumerator ()
4547 f .EnumerateFacenames ()
@@ -117,7 +119,7 @@ def _create_font_editor(self):
117119 [str (i ) for i in range (8 , 16 )])
118120 sizer = wx .FlexGridSizer (rows = 3 , cols = 2 , vgap = 10 , hgap = 30 )
119121 l_size = f .label (self )
120- background_color = Colour ("light gray" )
122+ background_color = Colour (LIGHT_GRAY )
121123 foreground_color = Colour ("black" )
122124 if IS_WINDOWS :
123125 set_colors (l_size , background_color , foreground_color )
@@ -130,14 +132,14 @@ def _create_font_editor(self):
130132 if IS_WINDOWS :
131133 set_colors (l_zoom , background_color , foreground_color )
132134 sizer .AddMany ([l_zoom , z .chooser (self )])
133- if 'fixed font' in self ._settings :
134- l_ff , editor = boolean_editor (self , self ._settings , 'fixed font' , 'Use fixed width font' )
135+ if FIXED_FONT in self ._settings :
136+ l_ff , editor = boolean_editor (self , self ._settings , FIXED_FONT , 'Use fixed width font' )
135137 if IS_WINDOWS :
136138 set_colors (l_ff , background_color , foreground_color )
137139 sizer .AddMany ([l_ff , editor ])
138- fixed_font = self ._settings ['fixed font' ]
140+ fixed_font = self ._settings [FIXED_FONT ]
139141 if 'font face' in self ._settings :
140- s = StringChoiceEditor (self ._settings , 'font face' , 'Font Face' , ReadFonts (fixed_font ))
142+ s = StringChoiceEditor (self ._settings , 'font face' , 'Font Face' , read_fonts (fixed_font ))
141143 l_font = s .label (self )
142144 if IS_WINDOWS :
143145 set_colors (l_font , background_color , foreground_color )
@@ -171,17 +173,18 @@ def create_colors_sizer(self):
171173 ('import' , 'Import foreground' ),
172174 ('variable' , 'Variable foreground' ),
173175 ('tc_kw_name' , 'Keyword definition foreground' ),
176+ ('keyword' , 'Keyword call foreground' ),
174177 ('separator' , 'Separator' ),
175178 ('setting' , 'Setting foreground' ),
176179 ('syntax' , 'Syntax characters' ),
177- ('background' , 'Text background' ),
180+ ('background' , TEXT_BACKGROUND ),
178181 )
179182 else :
180183 settings = (
181184 ('setting' , 'Text foreground' ),
182- ('background' , 'Text background' ),
185+ ('background' , TEXT_BACKGROUND ),
183186 )
184- background_color = Colour ("light gray" )
187+ background_color = Colour (LIGHT_GRAY )
185188 foreground_color = Colour ("black" )
186189 for settings_key , label_text in settings :
187190 if column == 4 :
@@ -231,7 +234,7 @@ def _create_grid_config_editor(self):
231234 settings = self ._settings
232235 sizer = wx .FlexGridSizer (rows = 6 , cols = 2 , vgap = 10 , hgap = 10 )
233236 l_col_size = self ._label_for ('Default column size' )
234- background_color = Colour ("light gray" )
237+ background_color = Colour (LIGHT_GRAY )
235238 foreground_color = Colour ("black" )
236239 if IS_WINDOWS :
237240 set_colors (l_col_size , background_color , foreground_color )
@@ -294,7 +297,7 @@ def _create_foreground_pickers(self, colors_sizer):
294297 ):
295298 lbl = wx .StaticText (self , wx .ID_ANY , label )
296299 if IS_WINDOWS :
297- background_color = Colour ("light gray" )
300+ background_color = Colour (LIGHT_GRAY )
298301 foreground_color = Colour ("black" )
299302 set_colors (lbl , background_color , foreground_color )
300303 btn = PreferencesColorPicker (
@@ -308,7 +311,7 @@ def _create_foreground_pickers(self, colors_sizer):
308311
309312 def _create_background_pickers (self , colors_sizer ):
310313 row = 0
311- background_color = Colour ("light gray" )
314+ background_color = Colour (LIGHT_GRAY )
312315 foreground_color = Colour ("black" )
313316 for key , label in (
314317 ('background assign' , 'Variable Background' ),
@@ -368,7 +371,7 @@ def _create_test_runner_config_editor(self):
368371 l_confirm , editor = boolean_editor (self , settings , 'confirm run' ,
369372 'Asks for confirmation to run all tests if none selected ' )
370373 if IS_WINDOWS :
371- background_color = Colour ("light gray" )
374+ background_color = Colour (LIGHT_GRAY )
372375 foreground_color = Colour ("black" )
373376 set_colors (l_confirm , background_color , foreground_color )
374377 set_colors (l_usecolor , background_color , foreground_color )
@@ -380,11 +383,11 @@ def create_colors_sizer(self):
380383 container = wx .GridBagSizer ()
381384 row = 0
382385 column = 0
383- background_color = Colour ("light gray" )
386+ background_color = Colour (LIGHT_GRAY )
384387 foreground_color = Colour ("black" )
385388 for settings_key , label_text in (
386389 ('foreground' , 'Text foreground' ),
387- ('background' , 'Text background' ),
390+ ('background' , TEXT_BACKGROUND ),
388391 ('error' , 'Error foreground' ),
389392 ('fail color' , 'Fail foreground' ),
390393 ('pass color' , 'Pass foreground' ),
0 commit comments