chiark / gitweb /
Fix issue of wizard page's titles having the wrong size
authorYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Mon, 27 Jul 2015 18:59:10 +0000 (14:59 -0400)
committerYouness Alaoui <kakaroto@kakaroto.homelinux.net>
Mon, 27 Jul 2015 20:54:00 +0000 (16:54 -0400)
Cura/gui/configWizard.py

index 4e9dceed0b6e2afd04058878b6996283a5a75314..ef936f209ca77f8733f8da7fd035afe022df9d5b 100644 (file)
@@ -116,9 +116,19 @@ class InfoPage(wx.wizard.WizardPageSimple):
                self.sizer = sizer
                self.SetSizer(sizer)
 
-               title = wx.StaticText(self, -1, title)
-               title.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
-               sizer.Add(title, pos=(0, 0), span=(1, 2), flag=wx.ALIGN_CENTRE | wx.ALL)
+               self.title = wx.StaticText(self, -1, title)
+               font = wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)
+               self.title.SetFont(font)
+               # HACK ALERT: For some reason, the StaticText keeps its same size as if
+               # the font was not modified, this causes the text to wrap and to
+               # get out of bounds of the widgets area and hide other widgets.
+               # The only way I found for the widget to get its right size was to calculate
+               # the new font's extent and set the min size on the widget
+               dc = wx.ScreenDC()
+               dc.SetFont(font)
+               w,h = dc.GetTextExtent(title)
+               self.title.SetMinSize((w, h))
+               sizer.Add(self.title, pos=(0, 0), span=(1, 2), flag=wx.ALIGN_CENTRE | wx.ALL)
                sizer.Add(wx.StaticLine(self, -1), pos=(1, 0), span=(1, 2), flag=wx.EXPAND | wx.ALL)
                sizer.AddGrowableCol(1)