Moving definition of grids fonts and colours into CustomGrid
authorlaurent
Fri, 16 Dec 2011 22:44:47 +0100
changeset 606 d65122c61eaf
parent 605 279c16d017f3
child 607 9c133d675b69
Moving definition of grids fonts and colours into CustomGrid
DataTypeEditor.py
PLCOpenEditor.py
RessourceEditor.py
controls/CustomGrid.py
controls/CustomTable.py
controls/VariablePanel.py
dialogs/ActionBlockDialog.py
--- a/DataTypeEditor.py	Wed Dec 14 15:18:32 2011 +0100
+++ b/DataTypeEditor.py	Fri Dec 16 22:44:47 2011 +0100
@@ -419,12 +419,6 @@
         self.StructureElementsGrid = CustomGrid(id=ID_DATATYPEEDITORSTRUCTUREELEMENTSGRID,
               name='StructureElementsGrid', parent=self.StructurePanel, pos=wx.Point(0, 0), 
               size=wx.Size(0, 150), style=wx.VSCROLL)
-        self.StructureElementsGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
-              'Sans'))
-        self.StructureElementsGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
-              False, 'Sans'))
-        self.StructureElementsGrid.SetSelectionBackground(wx.WHITE)
-        self.StructureElementsGrid.SetSelectionForeground(wx.BLACK)
         if wx.VERSION >= (2, 6, 0):
             self.StructureElementsGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnStructureElementsGridCellChange)
             self.StructureElementsGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN, self.OnStructureElementsGridEditorShown)
--- a/PLCOpenEditor.py	Wed Dec 14 15:18:32 2011 +0100
+++ b/PLCOpenEditor.py	Fri Dec 16 22:44:47 2011 +0100
@@ -3985,12 +3985,6 @@
         self.VariablesGrid = CustomGrid(id=ID_DEBUGVARIABLEPANELVARIABLESGRID,
               name='VariablesGrid', parent=self, pos=wx.Point(0, 0), 
               size=wx.Size(0, 150), style=wx.VSCROLL)
-        self.VariablesGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
-              'Sans'))
-        self.VariablesGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
-              False, 'Sans'))
-        self.VariablesGrid.SetSelectionBackground(wx.WHITE)
-        self.VariablesGrid.SetSelectionForeground(wx.BLACK)
         self.VariablesGrid.SetDropTarget(DebugVariableDropTarget(self))
         if wx.VERSION >= (2, 6, 0):
             self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.OnVariablesGridCellRightClick)
--- a/RessourceEditor.py	Wed Dec 14 15:18:32 2011 +0100
+++ b/RessourceEditor.py	Fri Dec 16 22:44:47 2011 +0100
@@ -281,10 +281,6 @@
         self.TasksGrid = CustomGrid(id=ID_RESOURCEEDITORTASKSGRID,
               name='TasksGrid', parent=self.Editor, pos=wx.Point(0, 0), 
               size=wx.Size(-1, -1), style=wx.VSCROLL)
-        self.TasksGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
-              'Sans'))
-        self.TasksGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
-              False, 'Sans'))
         if wx.VERSION >= (2, 6, 0):
             self.TasksGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnTasksGridCellChange)
         else:
@@ -313,10 +309,6 @@
         self.InstancesGrid = CustomGrid(id=ID_RESOURCEEDITORINSTANCESGRID,
               name='InstancesGrid', parent=self.Editor, pos=wx.Point(0, 0), 
               size=wx.Size(-1, -1), style=wx.VSCROLL)
-        self.InstancesGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
-              'Sans'))
-        self.InstancesGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
-              False, 'Sans'))
         if wx.VERSION >= (2, 6, 0):
             self.InstancesGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnInstancesGridCellChange)
         else:
--- a/controls/CustomGrid.py	Wed Dec 14 15:18:32 2011 +0100
+++ b/controls/CustomGrid.py	Fri Dec 16 22:44:47 2011 +0100
@@ -39,6 +39,16 @@
         
         self.Editable = True
         
+        self.AddButton = None
+        self.DeleteButton = None
+        self.UpButton = None
+        self.DownButton = None
+        
+        self.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False, 'Sans'))
+        self.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL, False, 'Sans'))
+        self.SetSelectionBackground(wx.WHITE)
+        self.SetSelectionForeground(wx.BLACK)
+        
         if wx.VERSION >= (2, 6, 0):
             self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnSelectCell)
         else:
--- a/controls/CustomTable.py	Wed Dec 14 15:18:32 2011 +0100
+++ b/controls/CustomTable.py	Fri Dec 16 22:44:47 2011 +0100
@@ -108,6 +108,8 @@
         for row in range(self.GetNumberRows()):
             row_highlights = self.Highlights.get(row, {})
             for col in range(self.GetNumberCols()):
+                colname = self.GetColLabelValue(col, False)
+                
                 grid.SetReadOnly(row, col, True)
                 grid.SetCellEditor(row, col, None)
                 grid.SetCellRenderer(row, col, None)
--- a/controls/VariablePanel.py	Wed Dec 14 15:18:32 2011 +0100
+++ b/controls/VariablePanel.py	Fri Dec 16 22:44:47 2011 +0100
@@ -337,12 +337,6 @@
         self.VariablesGrid = CustomGrid(id=ID_VARIABLEEDITORPANELVARIABLESGRID,
               name='VariablesGrid', parent=self, pos=wx.Point(0, 0), 
               size=wx.Size(0, 0), style=wx.VSCROLL)
-        self.VariablesGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
-              'Sans'))
-        self.VariablesGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
-              False, 'Sans'))
-        self.VariablesGrid.SetSelectionBackground(wx.WHITE)
-        self.VariablesGrid.SetSelectionForeground(wx.BLACK)
         self.VariablesGrid.SetDropTarget(VariableDropTarget(self))
         if wx.VERSION >= (2, 6, 0):
             self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnVariablesGridCellChange)
--- a/dialogs/ActionBlockDialog.py	Wed Dec 14 15:18:32 2011 +0100
+++ b/dialogs/ActionBlockDialog.py	Fri Dec 16 22:44:47 2011 +0100
@@ -171,10 +171,6 @@
         self.ActionsGrid = CustomGrid(id=ID_ACTIONBLOCKDIALOGVARIABLESGRID,
               name='ActionsGrid', parent=self, pos=wx.Point(0, 0), 
               size=wx.Size(0, 0), style=wx.VSCROLL)
-        self.ActionsGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False,
-              'Sans'))
-        self.ActionsGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL,
-              False, 'Sans'))
         self.ActionsGrid.DisableDragGridSize()
         self.ActionsGrid.EnableScrolling(False, True)
         if wx.VERSION >= (2, 6, 0):