Skip to content

Commit b436569

Browse files
Fix missing color editor for keywords in Text Editor (#2573)
1 parent e910342 commit b436569

File tree

5 files changed

+26
-21
lines changed

5 files changed

+26
-21
lines changed

CHANGELOG.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni
1010

1111
== Fixed
1212

13+
-- Fixed missing color definition for keyword call in Text Editor
14+
1315
-- Fixed clearing or emptying fixtures (Setups, Teardowns), now removes headers and synchronizes Text Editor
1416

1517
-- Fixed selection and persistance of colors in File Explorer and Project Tree panels

src/robotide/contrib/testrunner/testrunnerplugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
from robotide.widgets import Label, ImageProvider, RIDEDialog
7979
from robotide.robotapi import LOG_LEVELS
8080
from robotide.utils import robottime
81-
from robotide.preferences.editors import ReadFonts
81+
from robotide.preferences.editors import read_fonts
8282
from sys import getfilesystemencoding, platform
8383
from robotide.lib.robot.utils.encodingsniffer import (get_console_encoding,
8484
get_system_encoding)
@@ -1347,7 +1347,7 @@ def _get_style_string(back, fore, size, face):
13471347
def _ensure_default_font_is_valid(self):
13481348
"""Checks if default font is installed"""
13491349
default_font = self.settings.get(FONT_FACE)
1350-
if default_font not in ReadFonts():
1350+
if default_font not in read_fonts():
13511351
sys_font = wx.SystemSettings.GetFont(wx.SYS_ANSI_FIXED_FONT)
13521352
self.settings[FONT_FACE] = sys_font.GetFaceName()
13531353

src/robotide/editor/texteditor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from ..pluginapi import Plugin, TreeAwarePluginMixin
3131
from ..publish.messages import (RideSaving, RideTreeSelection, RideNotebookTabChanging, RideDataChanged, RideOpenSuite,
3232
RideDataChangedToDirty)
33-
from ..preferences.editors import ReadFonts
33+
from ..preferences.editors import read_fonts
3434
from ..publish import RideSettingsChanged, PUBLISHER
3535
from ..publish.messages import RideMessage
3636
from ..widgets import TextField, Label, HtmlDialog
@@ -1643,7 +1643,7 @@ def _get_style_string(self, back='#FFFFFF', fore='#000000', bold='', underline='
16431643
def _ensure_default_font_is_valid(self):
16441644
"""Checks if default font is installed"""
16451645
default_font = self._font_face()
1646-
if default_font not in ReadFonts():
1646+
if default_font not in read_fonts():
16471647
sys_font = wx.SystemSettings.GetFont(wx.SYS_ANSI_FIXED_FONT)
16481648
self.settings[PLUGIN_NAME]['font face'] = sys_font.GetFaceName()
16491649

src/robotide/preferences/editors.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from wx import Colour
2020
from wx.lib.masked import NumCtrl
2121

22-
# from .. import widgets
2322
from ..ui.preferences_dialogs import (PreferencesPanel, SpinChoiceEditor, IntegerChoiceEditor, boolean_editor,
2423
StringChoiceEditor, PreferencesColorPicker)
2524
from ..widgets import Label
@@ -36,10 +35,13 @@
3635
ID_LOAD = 5551
3736
ID_SAVE = 5552
3837
ID_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'),

src/robotide/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
# limitations under the License.
1515
#
1616
# Automatically generated by `tasks.py`.
17-
VERSION = '2.0.1.dev3'
17+
VERSION = '2.0.1.dev4'
1818

0 commit comments

Comments
 (0)