Merged skvorl/beremiz into default
authorSergey Surkov <surkovsv93@gmail.com>
Mon, 06 Mar 2017 17:39:29 +0300
changeset 1655 a079b0322a48
parent 1654 f4696d85552a (diff)
parent 1651 f077f8fb9ba7 (current diff)
child 1656 bb5440697405
Merged skvorl/beremiz into default
--- a/controls/VariablePanel.py	Mon Mar 06 17:24:05 2017 +0500
+++ b/controls/VariablePanel.py	Mon Mar 06 17:39:29 2017 +0300
@@ -506,8 +506,9 @@
             c = wx.ALIGN_CENTER
 
             #                      Num  Name    Class   Type    Loc     Init    Option   Doc
-            self.ColSizes       = [40,  80,     70,     80,     80,     80,     100,     80]
+            self.ColSizes       = [40,  80,     100,    80,     110,     120,    100,     160]
             self.ColAlignements = [c,   l,      l,      l,      l,      l,      l,       l]
+            self.ColFixedSizeFlag=[True,False,  True,   False,  True,   True,   True,    False]
 
         else:
             # this is an element that cannot have located variables
@@ -527,8 +528,9 @@
             c = wx.ALIGN_CENTER
 
             #                      Num  Name    Class   Type    Init    Option   Doc
-            self.ColSizes       = [40,  80,     70,     80,     80,     100,     160]
+            self.ColSizes       = [40,  80,     100,    80,     120,    100,     160]
             self.ColAlignements = [c,   l,      l,      l,      l,      l,       l]
+            self.ColFixedSizeFlag=[True,False,  True,   False,  True,   True,    False]
 
         self.ElementType = element_type
         self.BodyType = None
@@ -636,13 +638,23 @@
                 self.DownButton.Enable(not self.Debug and (table_length > 0 and row < table_length - 1 and self.Filter == "All"))
         setattr(self.VariablesGrid, "RefreshButtons", _RefreshButtons)
 
+        stretch_cols_width = window.Parent.ScreenRect.Width - 35
+        stretch_cols_sum = 0
+        for col  in range(len(self.ColFixedSizeFlag)):
+            if self.ColFixedSizeFlag[col]:
+                stretch_cols_width -= self.ColSizes[col]
+            else:
+                stretch_cols_sum += self.ColSizes[col]
         self.VariablesGrid.SetRowLabelSize(0)
         for col in range(self.Table.GetNumberCols()):
             attr = wx.grid.GridCellAttr()
             attr.SetAlignment(self.ColAlignements[col], wx.ALIGN_CENTRE)
             self.VariablesGrid.SetColAttr(col, attr)
             self.VariablesGrid.SetColMinimalWidth(col, self.ColSizes[col])
-            self.VariablesGrid.AutoSizeColumn(col, False)
+            if not self.ColFixedSizeFlag[col]:
+                self.VariablesGrid.SetColSize(col, int((float(self.ColSizes[col])/stretch_cols_sum)*stretch_cols_width))
+            else:
+                self.VariablesGrid.SetColSize(col, self.ColSizes[col])
 
     def __del__(self):
         self.RefreshHighlightsTimer.Stop()
--- a/graphics/SFC_Objects.py	Mon Mar 06 17:24:05 2017 +0500
+++ b/graphics/SFC_Objects.py	Mon Mar 06 17:39:29 2017 +0300
@@ -70,7 +70,7 @@
         if self.Output is not None:
             self.Output.Flush()
             self.Output = None
-        if self.Output is not None:
+        if self.Action is not None:
             self.Action.Flush()
             self.Action = None
     
@@ -653,8 +653,10 @@
     # Returns the RedrawRect
     def GetRedrawRect(self, movex = 0, movey = 0):
         rect = Graphic_Element.GetRedrawRect(self, movex, movey)
-        rect = rect.Union(self.Input.GetRedrawRect(movex, movey))
-        rect = rect.Union(self.Output.GetRedrawRect(movex, movey))
+        if self.Input:
+            rect = rect.Union(self.Input.GetRedrawRect(movex, movey))
+        if self.Output:
+            rect = rect.Union(self.Output.GetRedrawRect(movex, movey))
         if movex != 0 or movey != 0:
             if self.Input.IsConnected():
                 rect = rect.Union(self.Input.GetConnectedRedrawRect(movex, movey))
@@ -1547,7 +1549,8 @@
     # Returns the RedrawRect
     def GetRedrawRect(self, movex = 0, movey = 0):
         rect = Graphic_Element.GetRedrawRect(self, movex, movey)
-        rect = rect.Union(self.Input.GetRedrawRect(movex, movey))
+        if self.Input:
+            rect = rect.Union(self.Input.GetRedrawRect(movex, movey))
         if movex != 0 or movey != 0:
             if self.Input.IsConnected():
                 rect = rect.Union(self.Input.GetConnectedRedrawRect(movex, movey))
@@ -1824,7 +1827,8 @@
     # Returns the RedrawRect
     def GetRedrawRect(self, movex = 0, movey = 0):
         rect = Graphic_Element.GetRedrawRect(self, movex, movey)
-        rect = rect.Union(self.Input.GetRedrawRect(movex, movey))
+        if self.Input:
+            rect = rect.Union(self.Input.GetRedrawRect(movex, movey))
         if movex != 0 or movey != 0:
             if self.Input.IsConnected():
                 rect = rect.Union(self.Input.GetConnectedRedrawRect(movex, movey))