18 from ..controller.cellinfo
import CellType
38 self.
_grid_grid =
None
42 if self.
_timer_timer
is None:
50 if row >= self.
_grid_grid.NumberRows:
51 self.
_grid_grid.ForceRefresh()
52 elif col < self.
_grid_grid.NumberCols:
54 wx.CallAfter(self.
_coloring_task_coloring_task, task_index, selection_content, row, col+1)
56 self.
_coloring_task_coloring_task(task_index, selection_content, row+1, 0)
59 cell_info = self.
_controller_controller.get_cell_info(row, col)
64 self.
_grid_grid.SetCellBackgroundColour(row, col, self.
_get_background_color_get_background_color(cell_info, selection_content))
65 self.
_grid_grid.SetCellFont(row, col, self.
_get_cell_font_get_cell_font(row, col, cell_info))
68 self.
_grid_grid.SetCellTextColour(row, col, self.
_colors_colors.DEFAULT_TEXT)
69 self.
_grid_grid.SetCellBackgroundColour(row, col, self.
_colors_colors.DEFAULT_BACKGROUND)
72 return self.
_colors_colors.get_text_color(cell_info.content_type)
75 if cell_info.matches(selection_content):
76 return self.
_colors_colors.get_highlight_color()
77 if cell_info.has_error():
78 return self.
_colors_colors.get_error_color()
79 return self.
_colors_colors.get_background_color(cell_info.cell_type)
82 font = self.
_grid_grid.GetCellFont(row, col)
83 font.SetWeight(self.
_get_weight_get_weight(cell_info))
87 if cell_info.cell_type == CellType.KEYWORD:
88 return wx.FONTWEIGHT_BOLD
89 return wx.FONTWEIGHT_NORMAL
95 DEFAULT_BACKGROUND =
''
103 return self.
_get_get(
'background %s' % type)
108 return self.
_get_get(
'text %s' % type)
117 return self.
_settings_settings[name.lower().replace(
'_',
' ')]
def get_background_color(self, type)
def get_text_color(self, type)
string DEFAULT_BACKGROUND
def get_highlight_color(self)
def get_error_color(self)
def __init__(self, settings=None)
def colorize(self, selection_content)
def _coloring_task(self, task_index, selection_content, row=0, col=0)
def _get_text_color(self, cell_info)
def __init__(self, grid, controller)
def _get_background_color(self, cell_info, selection_content)
def _get_cell_font(self, row, col, cell_info)
def _colorize_cell(self, row, col, selection_content)
def _set_default_colors(self, row, col)
def _get_weight(self, cell_info)