Author: bugman Date: Thu Feb 4 19:21:17 2010 New Revision: 10657 URL: http://svn.gna.org/viewcvs/relax?rev=10657&view=rev Log: The init keyword arg is now accepted by offset(). This allows the offset to be reset each time the widget is created and shown. Modified: branches/bieri_gui/gui_bieri/about.py Modified: branches/bieri_gui/gui_bieri/about.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/about.py?rev=10657&r1=10656&r2=10657&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/about.py (original) +++ branches/bieri_gui/gui_bieri/about.py Thu Feb 4 19:21:17 2010 @@ -163,7 +163,7 @@ """Build the about dialog.""" # A global Y offset for packing the elements together (initialise to the boarder position). - self.offset(self.boarder) + self.offset(self.boarder, init=True) # Draw all the elements. self.draw_title() @@ -313,23 +313,26 @@ self.offset(max_y + 1) - def offset(self, val=0): + def offset(self, val=0, init=False): """Shift the offset by the given value and return the offset. @keyword val: The value to add to the offset (can be negative). @type val: int + @keyword init: Flag for initialising the offset. + @type init: bool @return: The current offset. @rtype: int """ # Initialisation. - if not hasattr(self, '_offset_val'): + if init or not hasattr(self, '_offset_val'): self._offset_val = 0 # Shift. self._offset_val = self._offset_val + val # Return. + print self._offset_val return self._offset_val