Author: bugman Date: Fri Jul 8 16:27:20 2011 New Revision: 13548 URL: http://svn.gna.org/viewcvs/relax?rev=13548&view=rev Log: The wizard _add_desc() method is no longer private to allow derived classes to format this text. Modified: branches/gui_testing/gui/wizard.py Modified: branches/gui_testing/gui/wizard.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/wizard.py?rev=13548&r1=13547&r2=13548&view=diff ============================================================================== --- branches/gui_testing/gui/wizard.py (original) +++ branches/gui_testing/gui/wizard.py Fri Jul 8 16:27:20 2011 @@ -152,71 +152,11 @@ self._add_title(main_sizer) # Add the description. - self._add_desc(main_sizer, max_y=self.desc_height) + self.add_desc(main_sizer, max_y=self.desc_height) # Add the specific GUI elements (bounded by spacers). main_sizer.AddStretchSpacer() self.add_contents(main_sizer) - - - def _add_desc(self, sizer, max_y=220): - """Add the description to the dialog. - - @param sizer: A sizer object. - @type sizer: wx.Sizer instance - @keyword max_y: The maximum height, in number of pixels, for the description. - @type max_y: int - """ - - # A line with spacing. - sizer.AddSpacer(5) - sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND|wx.ALL, 0) - sizer.AddSpacer(5) - - # Create a scrolled panel. - panel = scrolledpanel.ScrolledPanel(self, -1, name="desc") - - # A sizer for the panel. - panel_sizer = wx.BoxSizer(wx.VERTICAL) - - # The text. - text = wx.StaticText(panel, -1, self.main_text, style=wx.TE_MULTILINE) - - # Font. - #text.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.NORMAL)) - - # Wrap the text. - text.Wrap(self._main_size - 20) - - # The text size. - x, y = text.GetSizeTuple() - - # Scrolling needed. - if y > max_y-10: - # Set the panel size. - panel.SetInitialSize((self._main_size, max_y)) - - # No scrolling. - else: - # Rewrap the text. - text.Wrap(self._main_size) - - # Set the panel size. - panel.SetInitialSize(text.GetSize()) - - # Add the text. - panel_sizer.Add(text, 0, wx.ALIGN_LEFT, 0) - - # Set up and add the panel to the sizer. - panel.SetSizer(panel_sizer) - panel.SetAutoLayout(1) - panel.SetupScrolling(scroll_x=False, scroll_y=True) - sizer.Add(panel, 0, wx.ALL|wx.EXPAND) - - # A line with spacing. - sizer.AddSpacer(5) - sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND|wx.ALL, 0) - sizer.AddSpacer(5) def _add_title(self, sizer): @@ -332,6 +272,66 @@ # This must be supplied. raise RelaxImplementError + + + def add_desc(self, sizer, max_y=220): + """Add the description to the dialog. + + @param sizer: A sizer object. + @type sizer: wx.Sizer instance + @keyword max_y: The maximum height, in number of pixels, for the description. + @type max_y: int + """ + + # A line with spacing. + sizer.AddSpacer(5) + sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND|wx.ALL, 0) + sizer.AddSpacer(5) + + # Create a scrolled panel. + panel = scrolledpanel.ScrolledPanel(self, -1, name="desc") + + # A sizer for the panel. + panel_sizer = wx.BoxSizer(wx.VERTICAL) + + # The text. + text = wx.StaticText(panel, -1, self.main_text, style=wx.TE_MULTILINE) + + # Font. + #text.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.NORMAL)) + + # Wrap the text. + text.Wrap(self._main_size - 20) + + # The text size. + x, y = text.GetSizeTuple() + + # Scrolling needed. + if y > max_y-10: + # Set the panel size. + panel.SetInitialSize((self._main_size, max_y)) + + # No scrolling. + else: + # Rewrap the text. + text.Wrap(self._main_size) + + # Set the panel size. + panel.SetInitialSize(text.GetSize()) + + # Add the text. + panel_sizer.Add(text, 0, wx.ALIGN_LEFT, 0) + + # Set up and add the panel to the sizer. + panel.SetSizer(panel_sizer) + panel.SetAutoLayout(1) + panel.SetupScrolling(scroll_x=False, scroll_y=True) + sizer.Add(panel, 0, wx.ALL|wx.EXPAND) + + # A line with spacing. + sizer.AddSpacer(5) + sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND|wx.ALL, 0) + sizer.AddSpacer(5) def boolean_selector(self, sizer, desc, tooltip=None, divider=None, padding=0, spacer=None, default=True):