Fix redraw problems in preview frames and debug panel
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 14 Feb 2019 10:02:58 +0300
changeset 2509 9c5f835b031e
parent 2508 9076249f11eb
child 2510 4f78f0e201d9
Fix redraw problems in preview frames and debug panel

The problem was that direct call of RefreshView (now DrawView) doesn't
generate EVT_PAINT (at least on GNU/Linux with Wayland and wxgtk build
with gtk3+ support).
Now RefreshView simply triggers EVT_PAINT and EVT_PAINT handler does actual work.
controls/DebugVariablePanel/DebugVariablePanel.py
controls/DebugVariablePanel/DebugVariableTextViewer.py
dialogs/BlockPreviewDialog.py
--- a/controls/DebugVariablePanel/DebugVariablePanel.py	Thu Feb 14 09:44:19 2019 +0300
+++ b/controls/DebugVariablePanel/DebugVariablePanel.py	Thu Feb 14 10:02:58 2019 +0300
@@ -521,6 +521,15 @@
         self.RefreshGraphicsWindowScrollbars()
 
     def RefreshView(self):
+        """Triggers EVT_PAINT event to refresh UI"""
+        self.Refresh()
+
+    def DrawView(self):
+        """
+        Redraw elements.
+        Method is used by EVT_PAINT handler.
+        """
+
         self.RefreshCanvasPosition()
 
         if not self.Fixed or self.Force:
@@ -922,7 +931,9 @@
         pass
 
     def OnGraphicsWindowPaint(self, event):
-        self.RefreshView()
+        """EVT_PAINT handler"""
+
+        self.DrawView()
         event.Skip()
 
     def OnGraphicsWindowResize(self, event):
--- a/controls/DebugVariablePanel/DebugVariableTextViewer.py	Thu Feb 14 09:44:19 2019 +0300
+++ b/controls/DebugVariablePanel/DebugVariableTextViewer.py	Thu Feb 14 10:02:58 2019 +0300
@@ -185,8 +185,12 @@
             self.Buttons.append(GraphButton(0, 0, bitmap, callback))
 
     def RefreshViewer(self):
-        """
-        Method that refresh the content displayed by Viewer
+        """Triggers EVT_PAINT event to refresh UI"""
+        self.Refresh()
+
+    def DrawViewer(self):
+        """
+        Redraw content displayed by Viewer
         """
         # Create buffered DC for drawing in panel
         width, height = self.GetSize()
@@ -282,5 +286,5 @@
         Function called when redrawing Viewer content is needed
         @param event: wx.PaintEvent
         """
-        self.RefreshViewer()
+        self.DrawViewer()
         event.Skip()
--- a/dialogs/BlockPreviewDialog.py	Thu Feb 14 09:44:19 2019 +0300
+++ b/dialogs/BlockPreviewDialog.py	Thu Feb 14 10:02:58 2019 +0300
@@ -251,6 +251,10 @@
         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
@@ -300,5 +304,5 @@
         Called when Preview panel need to be redraw
         @param event: wx.PaintEvent
         """
-        self.RefreshPreview()
+        self.DrawPreview()
         event.Skip()