642 |
642 |
643 Otherwise default to the default renderer. |
643 Otherwise default to the default renderer. |
644 """ |
644 """ |
645 |
645 |
646 for row in range(self.GetNumberRows()): |
646 for row in range(self.GetNumberRows()): |
|
647 row_highlights = self.Highlights.get(row, {}) |
647 for col in range(self.GetNumberCols()): |
648 for col in range(self.GetNumberCols()): |
648 editor = None |
649 editor = None |
649 renderer = None |
650 renderer = None |
650 colname = self.GetColLabelValue(col, False) |
651 colname = self.GetColLabelValue(col, False) |
651 |
652 |
654 editor = editortype(self, row, col) |
655 editor = editortype(self, row, col) |
655 |
656 |
656 grid.SetCellEditor(row, col, editor) |
657 grid.SetCellEditor(row, col, editor) |
657 grid.SetCellRenderer(row, col, renderer) |
658 grid.SetCellRenderer(row, col, renderer) |
658 |
659 |
659 grid.SetCellBackgroundColour(row, col, wx.WHITE) |
660 highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1] |
|
661 grid.SetCellBackgroundColour(row, col, highlight_colours[0]) |
|
662 grid.SetCellTextColour(row, col, highlight_colours[1]) |
660 self.ResizeRow(grid, row) |
663 self.ResizeRow(grid, row) |
661 |
664 |
662 |
665 |
663 class VariablesEditor(wx.Panel): |
666 class VariablesEditor(wx.Panel): |
664 |
667 |
857 dragSource.SetData(data) |
860 dragSource.SetData(data) |
858 dragSource.DoDragDrop() |
861 dragSource.DoDragDrop() |
859 return |
862 return |
860 event.Skip() |
863 event.Skip() |
861 |
864 |
|
865 def AddVariableHighlight(self, infos, highlight_type): |
|
866 self.Table.AddHighlight(infos, highlight_type) |
|
867 cell_visible = infos[0] |
|
868 colnames = [colname.lower() for colname in self.Table.colnames] |
|
869 self.VariablesGrid.MakeCellVisible(cell_visible, colnames.index(infos[1])) |
|
870 self.Table.ResetView(self.VariablesGrid) |
|
871 |
|
872 def RemoveVariableHighlight(self, infos, highlight_type): |
|
873 self.Table.RemoveHighlight(infos, highlight_type) |
|
874 self.Table.ResetView(self.VariablesGrid) |
|
875 |
|
876 def ClearHighlights(self, highlight_type=None): |
|
877 self.Table.ClearHighlights(highlight_type) |
|
878 self.Table.ResetView(self.VariablesGrid) |
862 |
879 |
863 # ------------------------------------------------------------------------------- |
880 # ------------------------------------------------------------------------------- |
864 # CodeFileEditor Main Frame Class |
881 # CodeFileEditor Main Frame Class |
865 # ------------------------------------------------------------------------------- |
882 # ------------------------------------------------------------------------------- |
866 |
883 |
912 self.VariablesPanel.RefreshView() |
929 self.VariablesPanel.RefreshView() |
913 self.CodeEditor.RefreshView() |
930 self.CodeEditor.RefreshView() |
914 |
931 |
915 def Find(self, direction, search_params): |
932 def Find(self, direction, search_params): |
916 self.CodeEditor.Find(direction, search_params) |
933 self.CodeEditor.Find(direction, search_params) |
|
934 |
|
935 def AddHighlight(self, infos, start, end, highlight_type): |
|
936 if self.VariablesPanel is not None and infos[0] == "var_inout": |
|
937 self.VariablesPanel.AddVariableHighlight(infos[1:], highlight_type) |
|
938 else: |
|
939 self.CodeEditor.AddHighlight(infos, start, end, highlight_type) |
|
940 |
|
941 def RemoveHighlight(self, infos, start, end, highlight_type): |
|
942 if self.VariablesPanel is not None and infos[0] == "var_inout": |
|
943 self.VariablesPanel.RemoveVariableHighlight(infos[1:], highlight_type) |
|
944 else: |
|
945 self.CodeEditor.RemoveHighlight(infos, start, end, highlight_type) |
|
946 |
|
947 def ClearHighlights(self, highlight_type=None): |
|
948 if self.VariablesPanel is not None: |
|
949 self.VariablesPanel.ClearHighlights(highlight_type) |
|
950 else: |
|
951 self.CodeEditor.ClearHighlights(highlight_type) |