Fixed refresh problem following 9c5f835b031e, 9622418ac28c, c67488bd8134 : force redraw only through EVT_PAINT event and use wxPaintDC, as described in wx documentation
--- a/dialogs/BlockPreviewDialog.py Thu Apr 11 08:40:17 2019 +0200
+++ b/dialogs/BlockPreviewDialog.py Thu Apr 11 11:26:47 2019 +0200
@@ -250,13 +250,17 @@
# Close dialog
self.EndModal(wx.ID_OK)
+ def RefreshPreview(self):
+ """Triggers EVT_PAINT event to refresh UI"""
+ self.Refresh()
+
def DrawPreview(self):
"""
Refresh preview panel of graphic element
May be overridden by inherited classes
"""
# Init preview panel paint device context
- dc = wx.ClientDC(self.Preview)
+ dc = wx.PaintDC(self.Preview)
dc.SetFont(self.Preview.GetFont())
dc.Clear()
--- a/dialogs/ConnectionDialog.py Thu Apr 11 08:40:17 2019 +0200
+++ b/dialogs/ConnectionDialog.py Thu Apr 11 11:26:47 2019 +0200
@@ -138,7 +138,7 @@
self.ConnectionName.SetValue(value)
# Refresh preview panel
- self.DrawPreview()
+ self.RefreshPreview()
def GetValues(self):
"""
@@ -199,7 +199,7 @@
Called when connection type changed
@param event: wx.RadioButtonEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def OnNameChanged(self, event):
@@ -207,7 +207,7 @@
Called when connection name value changed
@param event: wx.TextEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def DrawPreview(self):
--- a/dialogs/FBDBlockDialog.py Thu Apr 11 08:40:17 2019 +0200
+++ b/dialogs/FBDBlockDialog.py Thu Apr 11 11:26:47 2019 +0200
@@ -199,7 +199,7 @@
control.SetValue(value)
# Refresh preview panel
- self.DrawPreview()
+ self.RefreshPreview()
def GetValues(self):
"""
@@ -293,7 +293,7 @@
self.BlockName.ChangeValue("")
# Refresh preview panel
- self.DrawPreview()
+ self.RefreshPreview()
def OnNameChanged(self, event):
"""
@@ -303,7 +303,7 @@
if self.BlockName.IsEnabled():
# Save block name typed by user
self.CurrentBlockName = self.BlockName.GetValue()
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def OnInputsChanged(self, event):
@@ -312,7 +312,7 @@
@param event: wx.SpinEvent
"""
if self.Inputs.IsEnabled():
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def OnExecutionOrderChanged(self, event):
@@ -320,7 +320,7 @@
Called when block execution order value changed
@param event: wx.SpinEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def OnExecutionControlChanged(self, event):
@@ -328,7 +328,7 @@
Called when block execution control value changed
@param event: wx.SpinEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def DrawPreview(self):
--- a/dialogs/FBDVariableDialog.py Thu Apr 11 08:40:17 2019 +0200
+++ b/dialogs/FBDVariableDialog.py Thu Apr 11 11:26:47 2019 +0200
@@ -195,7 +195,7 @@
self.ExecutionOrder.SetValue(value)
# Refresh preview panel
- self.DrawPreview()
+ self.Refresh()
self.Fit()
def GetValues(self):
@@ -242,7 +242,7 @@
# Refresh name list box values
self.RefreshNameList()
- self.DrawPreview()
+ self.Refresh()
event.Skip()
def OnNameChanged(self, event):
@@ -255,7 +255,7 @@
if self.VariableName.GetSelection() != wx.NOT_FOUND:
self.Expression.ChangeValue(self.VariableName.GetStringSelection())
- self.DrawPreview()
+ self.Refresh()
event.Skip()
def OnExpressionChanged(self, event):
@@ -267,7 +267,7 @@
self.VariableName.SetSelection(
self.VariableName.FindString(self.Expression.GetValue()))
- self.DrawPreview()
+ self.Refresh()
event.Skip()
def OnExecutionOrderChanged(self, event):
@@ -275,7 +275,7 @@
Called when block execution control value changed
@param event: wx.SpinEvent
"""
- self.DrawPreview()
+ self.Refresh()
event.Skip()
def DrawPreview(self):
--- a/dialogs/LDElementDialog.py Thu Apr 11 08:40:17 2019 +0200
+++ b/dialogs/LDElementDialog.py Thu Apr 11 11:26:47 2019 +0200
@@ -156,7 +156,7 @@
self.ModifierRadioButtons[value].SetValue(True)
# Refresh preview panel
- self.DrawPreview()
+ self.RefreshPreview()
def GetValues(self):
"""
@@ -174,7 +174,7 @@
Called when LD element modifier changed
@param event: wx.RadioButtonEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def OnVariableChanged(self, event):
@@ -182,7 +182,7 @@
Called when LD element associated variable changed
@param event: wx.ComboBoxEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def DrawPreview(self):
--- a/dialogs/LDPowerRailDialog.py Thu Apr 11 08:40:17 2019 +0200
+++ b/dialogs/LDPowerRailDialog.py Thu Apr 11 11:26:47 2019 +0200
@@ -144,7 +144,7 @@
Called when power rail type changed
@param event: wx.RadioButtonEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def OnPinNumberChanged(self, event):
@@ -152,7 +152,7 @@
Called when power rail pin number value changed
@param event: wx.SpinEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def DrawPreview(self):
--- a/dialogs/SFCDivergenceDialog.py Thu Apr 11 08:40:17 2019 +0200
+++ b/dialogs/SFCDivergenceDialog.py Thu Apr 11 11:26:47 2019 +0200
@@ -144,7 +144,7 @@
Called when SFC divergence type changed
@param event: wx.RadioButtonEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def OnSequencesChanged(self, event):
@@ -152,7 +152,7 @@
Called when SFC divergence number of sequences changed
@param event: wx.SpinEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def DrawPreview(self):
--- a/dialogs/SFCStepDialog.py Thu Apr 11 08:40:17 2019 +0200
+++ b/dialogs/SFCStepDialog.py Thu Apr 11 11:26:47 2019 +0200
@@ -120,7 +120,7 @@
control.SetValue(value)
# Refresh preview panel
- self.DrawPreview()
+ self.RefreshPreview()
def GetValues(self):
"""
@@ -163,7 +163,7 @@
Called when a step connector value changed
@param event: wx.CheckBoxEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def OnNameChanged(self, event):
@@ -171,7 +171,7 @@
Called when step name value changed
@param event: wx.TextEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def DrawPreview(self):
--- a/dialogs/SFCTransitionDialog.py Thu Apr 11 08:40:17 2019 +0200
+++ b/dialogs/SFCTransitionDialog.py Thu Apr 11 11:26:47 2019 +0200
@@ -156,7 +156,7 @@
control.ChangeValue(type_value)
# Refresh preview panel
- self.DrawPreview()
+ self.RefreshPreview()
def GetValues(self):
"""
@@ -202,7 +202,7 @@
control.Enable(radio.GetValue())
# Refresh preview panel
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def OnReferenceChanged(self, event):
@@ -210,7 +210,7 @@
Called when SFC transition reference value changed
@param event: wx.ComboBoxEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def OnInlineChanged(self, event):
@@ -218,7 +218,7 @@
Called when SFC transition inline value changed
@param event: wx.TextEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def OnPriorityChanged(self, event):
@@ -226,7 +226,7 @@
Called when block inputs number changed
@param event: wx.SpinEvent
"""
- self.DrawPreview()
+ self.RefreshPreview()
event.Skip()
def DrawPreview(self):