controls/VariablePanel.py
changeset 1758 845ca626db09
parent 1755 624b9694cb0d
child 1760 ed2e2afb9573
equal deleted inserted replaced
1757:0de89da92ee0 1758:845ca626db09
   510                 self.FilterChoices = ["All",
   510                 self.FilterChoices = ["All",
   511                                         "Interface", "   Input", "   Output", "   InOut", "   External",
   511                                         "Interface", "   Input", "   Output", "   InOut", "   External",
   512                                         "Variables", "   Local", "   Temp"]  #,"Access"]
   512                                         "Variables", "   Local", "   Temp"]  #,"Access"]
   513 
   513 
   514             # these condense the ColAlignements list
   514             # these condense the ColAlignements list
   515             left =   wx.ALIGN_LEFT
   515             left = wx.ALIGN_LEFT
   516             center = wx.ALIGN_CENTER
   516             center = wx.ALIGN_CENTER
   517 
   517 
   518             #                        Num     Name    Class   Type    Loc     Init    Option   Doc
   518             #                        Num     Name    Class   Type    Loc     Init    Option   Doc
   519             self.ColSizes =         [40,     80,     100,    80,     110,    120,    100,     160]
   519             self.ColSettings = {
   520             self.ColAlignements =   [center, left,   left,   left,   left,   left,   left,    left]
   520                 "size":             [40,     80,     100,    80,     110,    120,    100,     160],
   521             self.ColFixedSizeFlag = [True,   False,  True,   False,  True,   True,   True,    False]
   521                 "alignement":       [center, left,   left,   left,   left,   left,   left,    left],
       
   522                 "fixed_size":       [True,   False,  True,   False,  True,   True,   True,    False],
       
   523             }
   522 
   524 
   523         else:
   525         else:
   524             # this is an element that cannot have located variables
   526             # this is an element that cannot have located variables
   525             self.Table = VariableTable(self, [], GetVariableTableColnames(False))
   527             self.Table = VariableTable(self, [], GetVariableTableColnames(False))
   526 
   528 
   531             else:
   533             else:
   532                 self.FilterChoices = ["All",
   534                 self.FilterChoices = ["All",
   533                                         "Interface", "   Input", "   Output", "   InOut", "   External",
   535                                         "Interface", "   Input", "   Output", "   InOut", "   External",
   534                                         "Variables", "   Local", "   Temp"]
   536                                         "Variables", "   Local", "   Temp"]
   535 
   537 
   536             # these condense the ColAlignements list
   538             # these condense the alignements list
   537             left =   wx.ALIGN_LEFT
   539             left = wx.ALIGN_LEFT
   538             center = wx.ALIGN_CENTER
   540             center = wx.ALIGN_CENTER
   539 
   541 
   540             #                        Num     Name    Class   Type    Init    Option   Doc
   542             #                        Num     Name    Class   Type    Init    Option   Doc
   541             self.ColSizes =         [40,     80,     100,    80,     120,    100,     160]
   543             self.ColSettings = {
   542             self.ColAlignements =   [center, left,   left,   left,   left,   left,    left]
   544                 "size":             [40,     80,     100,    80,     120,    100,     160],
   543             self.ColFixedSizeFlag = [True,   False,  True,   False,  True,   True,    False]
   545                 "alignement":       [center, left,   left,   left,   left,   left,    left],
   544 
   546                 "fixed_size":       [True,   False,  True,   False,  True,   True,    False],
   545         self.PanelWidthMin = sum(self.ColSizes)
   547             }
       
   548 
       
   549         self.PanelWidthMin = sum(self.ColSettings["size"])
   546 
   550 
   547         self.ElementType = element_type
   551         self.ElementType = element_type
   548         self.BodyType = None
   552         self.BodyType = None
   549 
   553 
   550         for choice in self.FilterChoices:
   554         for choice in self.FilterChoices:
   652 
   656 
   653         panel_width = window.Parent.ScreenRect.Width - 35
   657         panel_width = window.Parent.ScreenRect.Width - 35
   654         if panel_width > self.PanelWidthMin:
   658         if panel_width > self.PanelWidthMin:
   655             stretch_cols_width = panel_width
   659             stretch_cols_width = panel_width
   656             stretch_cols_sum = 0
   660             stretch_cols_sum = 0
   657             for col in range(len(self.ColFixedSizeFlag)):
   661             for col in range(len(self.ColSettings["fixed_size"])):
   658                 if self.ColFixedSizeFlag[col]:
   662                 if self.ColSettings["fixed_size"][col]:
   659                     stretch_cols_width -= self.ColSizes[col]
   663                     stretch_cols_width -= self.ColSettings["size"][col]
   660                 else:
   664                 else:
   661                     stretch_cols_sum += self.ColSizes[col]
   665                     stretch_cols_sum += self.ColSettings["size"][col]
   662 
   666 
   663         self.VariablesGrid.SetRowLabelSize(0)
   667         self.VariablesGrid.SetRowLabelSize(0)
   664         for col in range(self.Table.GetNumberCols()):
   668         for col in range(self.Table.GetNumberCols()):
   665             attr = wx.grid.GridCellAttr()
   669             attr = wx.grid.GridCellAttr()
   666             attr.SetAlignment(self.ColAlignements[col], wx.ALIGN_CENTRE)
   670             attr.SetAlignment(self.ColSettings["alignement"][col], wx.ALIGN_CENTRE)
   667             self.VariablesGrid.SetColAttr(col, attr)
   671             self.VariablesGrid.SetColAttr(col, attr)
   668             self.VariablesGrid.SetColMinimalWidth(col, self.ColSizes[col])
   672             self.VariablesGrid.SetColMinimalWidth(col, self.ColSettings["size"][col])
   669             if (panel_width > self.PanelWidthMin) and not self.ColFixedSizeFlag[col]:
   673             if (panel_width > self.PanelWidthMin) and not self.ColSettings["fixed_size"][col]:
   670                 self.VariablesGrid.SetColSize(col, int((float(self.ColSizes[col])/stretch_cols_sum)*stretch_cols_width))
   674                 self.VariablesGrid.SetColSize(col, int((float(self.ColSettings["size"][col])/stretch_cols_sum)*stretch_cols_width))
   671             else:
   675             else:
   672                 self.VariablesGrid.SetColSize(col, self.ColSizes[col])
   676                 self.VariablesGrid.SetColSize(col, self.ColSettings["size"][col])
   673 
   677 
   674     def __del__(self):
   678     def __del__(self):
   675         self.RefreshHighlightsTimer.Stop()
   679         self.RefreshHighlightsTimer.Stop()
   676 
   680 
   677     def SetTagName(self, tagname):
   681     def SetTagName(self, tagname):