controls/VariablePanel.py
changeset 1654 f4696d85552a
parent 1581 2295fdc5c271
child 1658 ba6a6d6e989c
equal deleted inserted replaced
1653:d98cc9d19a5c 1654:f4696d85552a
   504             # these condense the ColAlignements list
   504             # these condense the ColAlignements list
   505             l = wx.ALIGN_LEFT
   505             l = wx.ALIGN_LEFT
   506             c = wx.ALIGN_CENTER
   506             c = wx.ALIGN_CENTER
   507 
   507 
   508             #                      Num  Name    Class   Type    Loc     Init    Option   Doc
   508             #                      Num  Name    Class   Type    Loc     Init    Option   Doc
   509             self.ColSizes       = [40,  80,     70,     80,     80,     80,     100,     80]
   509             self.ColSizes       = [40,  80,     100,    80,     110,     120,    100,     160]
   510             self.ColAlignements = [c,   l,      l,      l,      l,      l,      l,       l]
   510             self.ColAlignements = [c,   l,      l,      l,      l,      l,      l,       l]
       
   511             self.ColFixedSizeFlag=[True,False,  True,   False,  True,   True,   True,    False]
   511 
   512 
   512         else:
   513         else:
   513             # this is an element that cannot have located variables
   514             # this is an element that cannot have located variables
   514             self.Table = VariableTable(self, [], GetVariableTableColnames(False))
   515             self.Table = VariableTable(self, [], GetVariableTableColnames(False))
   515 
   516 
   525             # these condense the ColAlignements list
   526             # these condense the ColAlignements list
   526             l = wx.ALIGN_LEFT
   527             l = wx.ALIGN_LEFT
   527             c = wx.ALIGN_CENTER
   528             c = wx.ALIGN_CENTER
   528 
   529 
   529             #                      Num  Name    Class   Type    Init    Option   Doc
   530             #                      Num  Name    Class   Type    Init    Option   Doc
   530             self.ColSizes       = [40,  80,     70,     80,     80,     100,     160]
   531             self.ColSizes       = [40,  80,     100,    80,     120,    100,     160]
   531             self.ColAlignements = [c,   l,      l,      l,      l,      l,       l]
   532             self.ColAlignements = [c,   l,      l,      l,      l,      l,       l]
       
   533             self.ColFixedSizeFlag=[True,False,  True,   False,  True,   True,    False]
   532 
   534 
   533         self.ElementType = element_type
   535         self.ElementType = element_type
   534         self.BodyType = None
   536         self.BodyType = None
   535 
   537 
   536         for choice in self.FilterChoices:
   538         for choice in self.FilterChoices:
   634                 self.DeleteButton.Enable(not self.Debug and (table_length > 0 and row_edit))
   636                 self.DeleteButton.Enable(not self.Debug and (table_length > 0 and row_edit))
   635                 self.UpButton.Enable(not self.Debug and (table_length > 0 and row > 0 and self.Filter == "All"))
   637                 self.UpButton.Enable(not self.Debug and (table_length > 0 and row > 0 and self.Filter == "All"))
   636                 self.DownButton.Enable(not self.Debug and (table_length > 0 and row < table_length - 1 and self.Filter == "All"))
   638                 self.DownButton.Enable(not self.Debug and (table_length > 0 and row < table_length - 1 and self.Filter == "All"))
   637         setattr(self.VariablesGrid, "RefreshButtons", _RefreshButtons)
   639         setattr(self.VariablesGrid, "RefreshButtons", _RefreshButtons)
   638 
   640 
       
   641         stretch_cols_width = window.Parent.ScreenRect.Width - 35
       
   642         stretch_cols_sum = 0
       
   643         for col  in range(len(self.ColFixedSizeFlag)):
       
   644             if self.ColFixedSizeFlag[col]:
       
   645                 stretch_cols_width -= self.ColSizes[col]
       
   646             else:
       
   647                 stretch_cols_sum += self.ColSizes[col]
   639         self.VariablesGrid.SetRowLabelSize(0)
   648         self.VariablesGrid.SetRowLabelSize(0)
   640         for col in range(self.Table.GetNumberCols()):
   649         for col in range(self.Table.GetNumberCols()):
   641             attr = wx.grid.GridCellAttr()
   650             attr = wx.grid.GridCellAttr()
   642             attr.SetAlignment(self.ColAlignements[col], wx.ALIGN_CENTRE)
   651             attr.SetAlignment(self.ColAlignements[col], wx.ALIGN_CENTRE)
   643             self.VariablesGrid.SetColAttr(col, attr)
   652             self.VariablesGrid.SetColAttr(col, attr)
   644             self.VariablesGrid.SetColMinimalWidth(col, self.ColSizes[col])
   653             self.VariablesGrid.SetColMinimalWidth(col, self.ColSizes[col])
   645             self.VariablesGrid.AutoSizeColumn(col, False)
   654             if not self.ColFixedSizeFlag[col]:
       
   655                 self.VariablesGrid.SetColSize(col, int((float(self.ColSizes[col])/stretch_cols_sum)*stretch_cols_width))
       
   656             else:
       
   657                 self.VariablesGrid.SetColSize(col, self.ColSizes[col])
   646 
   658 
   647     def __del__(self):
   659     def __del__(self):
   648         self.RefreshHighlightsTimer.Stop()
   660         self.RefreshHighlightsTimer.Stop()
   649 
   661 
   650     def SetTagName(self, tagname):
   662     def SetTagName(self, tagname):