Fix size of ProjectDialog used by PLCOpenEditor
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Tue, 26 Jun 2018 14:48:44 +0300
changeset 2228 12cb48823b8c
parent 2227 f150783ee8e7
child 2229 3c94bac4526e
Fix size of ProjectDialog used by PLCOpenEditor

Disable scrolling for ProjectDialog, because otherwise very very small
windows is created.
This regression was introduced by 5701225 ("replaced normal panel with scrolled panel under project
properties").
controls/ProjectPropertiesPanel.py
dialogs/ProjectDialog.py
--- a/controls/ProjectPropertiesPanel.py	Tue Jun 26 10:37:36 2018 +0300
+++ b/controls/ProjectPropertiesPanel.py	Tue Jun 26 14:48:44 2018 +0300
@@ -68,7 +68,7 @@
             sizer.AddWindow(tc, border=10,
                             flag=wx.GROW | border | wx.RIGHT)
 
-    def __init__(self, parent, controller=None, window=None, enable_required=True):
+    def __init__(self, parent, controller=None, window=None, enable_required=True, scrolling=True):
         wx.Notebook.__init__(self, parent)
 
         self.Controller = controller
@@ -77,9 +77,10 @@
 
         # Project Panel elements
 
-        self.ProjectPanel = ScrolledPanel(self, -1, style=wx.TAB_TRAVERSAL)
+        self.ProjectPanel = ScrolledPanel(self, style=wx.TAB_TRAVERSAL)
         self.ProjectPanel.SetAutoLayout(1)
-        self.ProjectPanel.SetupScrolling()
+        if scrolling:
+            self.ProjectPanel.SetupScrolling()
         projectpanel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=5, vgap=15)
         projectpanel_sizer.AddGrowableCol(1)
         self.ProjectPanel.SetSizer(projectpanel_sizer)
@@ -95,9 +96,10 @@
 
         # Author Panel elements
 
-        self.AuthorPanel = ScrolledPanel(self, -1, style=wx.TAB_TRAVERSAL)
+        self.AuthorPanel = ScrolledPanel(self, style=wx.TAB_TRAVERSAL)
         self.AuthorPanel.SetAutoLayout(1)
-        self.AuthorPanel.SetupScrolling()
+        if scrolling:
+            self.AuthorPanel.SetupScrolling()
         authorpanel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=4, vgap=15)
         authorpanel_sizer.AddGrowableCol(1)
         self.AuthorPanel.SetSizer(authorpanel_sizer)
@@ -112,9 +114,10 @@
 
         # Graphics Panel elements
 
-        self.GraphicsPanel = ScrolledPanel(self, -1, style=wx.TAB_TRAVERSAL)
+        self.GraphicsPanel = ScrolledPanel(self, style=wx.TAB_TRAVERSAL)
         self.GraphicsPanel.SetAutoLayout(1)
-        self.GraphicsPanel.SetupScrolling()
+        if scrolling:
+            self.GraphicsPanel.SetupScrolling()
         graphicpanel_sizer = wx.FlexGridSizer(cols=1, hgap=5, rows=4, vgap=5)
         graphicpanel_sizer.AddGrowableCol(0)
         graphicpanel_sizer.AddGrowableRow(3)
@@ -190,13 +193,12 @@
 
         # Miscellaneous Panel elements
 
-        self.MiscellaneousPanel = ScrolledPanel(id=-1, parent=self,
+        self.MiscellaneousPanel = ScrolledPanel(parent=self,
                                                 name='MiscellaneousPanel',
-                                                pos=wx.Point(0, 0),
-                                                size=wx.Size(0, 0),
                                                 style=wx.TAB_TRAVERSAL)
         self.MiscellaneousPanel.SetAutoLayout(1)
-        self.MiscellaneousPanel.SetupScrolling()
+        if scrolling:
+            self.MiscellaneousPanel.SetupScrolling()
         miscellaneouspanel_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=2, vgap=15)
         miscellaneouspanel_sizer.AddGrowableCol(1)
         miscellaneouspanel_sizer.AddGrowableRow(1)
--- a/dialogs/ProjectDialog.py	Tue Jun 26 10:37:36 2018 +0300
+++ b/dialogs/ProjectDialog.py	Tue Jun 26 14:48:44 2018 +0300
@@ -41,9 +41,7 @@
         main_sizer.AddGrowableRow(0)
 
         self.ProjectProperties = ProjectPropertiesPanel(
-            self,
-            enable_required=enable_required)
-
+            self, enable_required=enable_required, scrolling=False)
         main_sizer.AddWindow(self.ProjectProperties, flag=wx.GROW)
 
         self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)