def calculate_padding_filler(self, size, focus): """Return (padding left, right, filler top, bottom).""" (maxcol, maxrow) = size height = None if self.width_type is None: # top_w is a fixed widget width, height = self.top_w.pack((),focus=focus) assert height, "fixed widget must have a height" left, right = calculate_padding(self.align_type, self.align_amount, 'fixed', width, None, maxcol, clip=True ) else: left, right = calculate_padding(self.align_type, self.align_amount, self.width_type, self.width_amount, self.min_width, maxcol) if height: # top_w is a fixed widget top, bottom = calculate_filler(self.valign_type, self.valign_amount, 'fixed', height, None, maxrow) if maxrow-top-bottom < height: bottom = maxrow-top-height elif self.height_type is None: # top_w is a flow widget height = self.top_w.rows((maxcol,),focus=focus) top, bottom = calculate_filler( self.valign_type, self.valign_amount, 'fixed', height, None, maxrow ) else: top, bottom = calculate_filler(self.valign_type, self.valign_amount, self.height_type, self.height_amount, self.min_height, maxrow) return left, right, top, bottom
def _set_focus_valign_complete(self, size, focus): """ Finish setting the offset and inset now that we have have a maxcol & maxrow. """ (maxcol, maxrow) = size vt, va = self.set_focus_valign_pending self.set_focus_valign_pending = None self.set_focus_pending = None focus_widget, focus_pos = self.body.get_focus() if focus_widget is None: return rows = focus_widget.rows((maxcol, ), focus) rtop, rbot = calculate_filler(vt, va, 'fixed', rows, None, maxrow) self.shift_focus((maxcol, maxrow), rtop)
def _set_focus_valign_complete(self, size, focus): """ Finish setting the offset and inset now that we have have a maxcol & maxrow. """ (maxcol, maxrow) = size vt,va = self.set_focus_valign_pending self.set_focus_valign_pending = None self.set_focus_pending = None focus_widget, focus_pos = self.body.get_focus() if focus_widget is None: return rows = focus_widget.rows((maxcol,), focus) rtop, rbot = calculate_filler( vt, va, 'fixed', rows, None, maxrow ) self.shift_focus((maxcol, maxrow), rtop)