Author: bugman Date: Thu Jun 23 16:24:56 2011 New Revision: 13183 URL: http://svn.gna.org/viewcvs/relax?rev=13183&view=rev Log: The wizard list data structures are initialised now to 10 elements within the __init__() method. This will allow for better tracking of all the data, without having to worry about appending to all structures. 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=13183&r1=13182&r2=13183&view=diff ============================================================================== --- branches/gui_testing/gui/wizard.py (original) +++ branches/gui_testing/gui/wizard.py Thu Jun 23 16:24:56 2011 @@ -728,6 +728,20 @@ self._button_sizers = [] self._button_apply_flag = [] + # A max of 10 pages should be plenty enough (any more and the developer should be shot!). + for i in range(10): + # Append some Nones. + self._pages.append(None) + + # Initialise all box sizers for the wizard pages. + self._page_sizers.append(wx.BoxSizer(wx.VERTICAL)) + + # Initialise all box sizers for the buttons. + self._button_sizers.append(wx.BoxSizer(wx.HORIZONTAL)) + + # Set all apply flags to True. + self._button_apply_flag.append(True) + def _build_buttons(self): """Construct the buttons for all pages of the wizard.""" @@ -890,23 +904,22 @@ """ # Store the page. - self._pages.append(panel) + index = self._num_pages self._num_pages += 1 + self._pages[index] = panel # Store a new sizer for the page and its buttons. - self._page_sizers.append(wx.BoxSizer(wx.VERTICAL)) - self.main_sizer.Add(self._page_sizers[-1], 1, wx.ALL|wx.EXPAND, 0) + self.main_sizer.Add(self._page_sizers[index], 1, wx.ALL|wx.EXPAND, 0) # Add the sizer for the top half. top_sizer = wx.BoxSizer(wx.VERTICAL) - self._page_sizers[-1].Add(top_sizer, 1, wx.ALL|wx.EXPAND, 0) + self._page_sizers[index].Add(top_sizer, 1, wx.ALL|wx.EXPAND, 0) # Add the page to the top sizer. top_sizer.Add(panel, 1, wx.ALL|wx.EXPAND, 0) # Add the sizer for the wizard buttons. - self._button_sizers.append(wx.BoxSizer(wx.HORIZONTAL)) - self._page_sizers[-1].Add(self._button_sizers[-1], 0, wx.ALIGN_RIGHT|wx.ALL, 0) + self._page_sizers[index].Add(self._button_sizers[index], 0, wx.ALIGN_RIGHT|wx.ALL, 0) # Store the apply button flag. self._button_apply_flag.append(apply_button)