def draw (self): """W.draw () -> None Draws the Window. """ Bin.draw (self) cls = self.__class__ style = base.GlobalStyle st = self.style or style.get_style (cls) dropshadow = style.get_style_entry (cls, st, "shadow") rect = self.image.get_rect () # Create the caption. surface_caption = style.engine.draw_caption (rect.width - dropshadow, self.title, self.state, cls, st) self._captionrect = rect self._captionrect = surface_caption.get_rect () self._captionrect.topleft = self.topleft # Blit the caption. self.image.blit (surface_caption, (0, 0)) # Position and blit the child. if self.child: posx, posy = self.dispose_widget () self.child.topleft = posx, posy self.image.blit (self.child.image, (posx, posy))
def draw (self): """W.draw () -> None Draws the ScrolledWindow surface. Creates the visible surface of the ScrolledWindow. """ Bin.draw (self) blit = self.image.blit # Update the srollbars. self.hscrollbar.lock () self.vscrollbar.lock () hscroll, vscroll = self._update_scrollbars () self.hscrollbar.unlock () self.vscrollbar.unlock () if hscroll: blit (self.hscrollbar.image, self.hscrollbar.rect) if vscroll: blit (self.vscrollbar.image, self.vscrollbar.rect) if self.child: blit (self.child.image, self.child.rect)
def draw(self): """W.draw () -> None Draws the Window. """ Bin.draw(self) cls = self.__class__ style = base.GlobalStyle st = self.style or style.get_style(cls) dropshadow = style.get_style_entry(cls, st, "shadow") rect = self.image.get_rect() # Create the caption. surface_caption = style.engine.draw_caption(rect.width - dropshadow, self.title, self.state, cls, st) self._captionrect = rect self._captionrect = surface_caption.get_rect() self._captionrect.topleft = self.topleft # Blit the caption. self.image.blit(surface_caption, (0, 0)) # Position and blit the child. if self.child: posx, posy = self.dispose_widget() self.child.topleft = posx, posy self.image.blit(self.child.image, (posx, posy))
def draw (self): """V.draw () -> None Draws the ViewPort surface and places its child on it. """ border = base.GlobalStyle.get_border_size \ (self.__class__, self.style, StyleInformation.get ("VIEWPORT_BORDER")) Bin.draw (self) if self.child: self.child.topleft = border + self.hadjustment, \ border + self.vadjustment self.image.blit (self.child.image, (border, border), (abs (self.hadjustment), abs (self.vadjustment), self.width - 2 * border, self.height - 2 * border))
def draw(self): """V.draw () -> None Draws the ViewPort surface and places its child on it. """ border = base.GlobalStyle.get_border_size \ (self.__class__, self.style, StyleInformation.get ("VIEWPORT_BORDER")) Bin.draw(self) if self.child: self.child.topleft = border + self.hadjustment, \ border + self.vadjustment self.image.blit( self.child.image, (border, border), (abs(self.hadjustment), abs(self.vadjustment), self.width - 2 * border, self.height - 2 * border))
def draw (self): """B.draw () -> None Draws the Alignment surface and places its child on it. """ Bin.draw (self) rect = self.image.get_rect () if self.child: self.child.center = rect.center if self.align & ALIGN_TOP == ALIGN_TOP: self.child.top = rect.top + self.padding elif self.align & ALIGN_BOTTOM == ALIGN_BOTTOM: self.child.bottom = rect.bottom - self.padding if self.align & ALIGN_LEFT == ALIGN_LEFT: self.child.left = rect.left + self.padding elif self.align & ALIGN_RIGHT == ALIGN_RIGHT: self.child.right = rect.right - self.padding self.image.blit (self.child.image, self.child.rect)
def draw(self): """L.draw () -> None Draws the ListViewPort surface and places its items on it. """ Bin.draw(self) style = base.GlobalStyle cls = self.__class__ color = StyleInformation.get("SELECTION_COLOR") active = StyleInformation.get("ACTIVE_BORDER") border_active = style.get_border_size(cls, self.style, active) border = style.get_border_size \ (cls, self.style, StyleInformation.get ("VIEWPORT_BORDER")) active_space = StyleInformation.get("ACTIVE_BORDER_SPACE") st = self.style state = self.state realwidth = self.real_width posy = 0 draw_rect = Draw.draw_rect sdraw_rect = style.engine.draw_rect sdraw_border = style.engine.draw_border spacing = self.scrolledlist.spacing width = self.width - 2 * border height = self.height - 2 * border selheight = 0 surface = None cursor_found = False cursor = self.scrolledlist.cursor items = self.scrolledlist.items focus = self.scrolledlist.focus images = self.images lower = abs(self.vadjustment) - spacing - 2 * border_active upper = abs(self.vadjustment) + height # Overall surface surface_all = sdraw_rect(max(realwidth, width), self.real_height, state, cls, st) blit = surface_all.blit for item in items: image, rect = images[item] # Draw only those which are visible. if (posy + rect.height < lower): posy += rect.height + 2 * border_active + spacing continue elif posy > upper: break selheight = rect.height + 2 * border_active if item.selected: # Highlight the selection. surface = draw_rect(max(width, realwidth), selheight, color) # Show input focus. if focus and (item == cursor): sdraw_border(surface, state, cls, st, active, space=active_space) cursor_found = True surface.blit(image, (border_active, border_active)) blit(surface, (0, posy)) elif focus and not cursor_found and (item == cursor): # Input focus. surface = sdraw_rect(max(width, realwidth), selheight, state, cls, st) sdraw_border(surface, state, cls, st, active, space=active_space) surface.blit(image, (border_active, border_active)) cursor_found = True blit(surface, (0, posy)) else: # Regular image, move by the active border, so that # all items have the correct offset. blit(image, (border_active, posy + border_active)) posy += selheight + spacing self.image.blit( surface_all, (border, border), (abs(self.hadjustment), abs(self.vadjustment), width, height))
def draw (self): """L.draw () -> None Draws the ListViewPort surface and places its items on it. """ Bin.draw (self) style = base.GlobalStyle cls = self.__class__ color = StyleInformation.get ("SELECTION_COLOR") active = StyleInformation.get ("ACTIVE_BORDER") border_active = style.get_border_size (cls, self.style, active) border = style.get_border_size \ (cls, self.style, StyleInformation.get ("VIEWPORT_BORDER")) active_space = StyleInformation.get ("ACTIVE_BORDER_SPACE") st = self.style state = self.state realwidth = self.real_width posy = 0 draw_rect = Draw.draw_rect sdraw_rect = style.engine.draw_rect sdraw_border = style.engine.draw_border spacing = self.scrolledlist.spacing width = self.width - 2 * border height = self.height - 2 * border selheight = 0 surface = None cursor_found = False cursor = self.scrolledlist.cursor items = self.scrolledlist.items focus = self.scrolledlist.focus images = self.images lower = abs (self.vadjustment) - spacing - 2 * border_active upper = abs (self.vadjustment) + height # Overall surface surface_all = sdraw_rect (max (realwidth, width), self.real_height, state, cls, st) blit = surface_all.blit for item in items: image, rect = images[item] # Draw only those which are visible. if (posy + rect.height < lower): posy += rect.height + 2 * border_active + spacing continue elif posy > upper: break selheight = rect.height + 2 * border_active if item.selected: # Highlight the selection. surface = draw_rect (max (width, realwidth), selheight, color) # Show input focus. if focus and (item == cursor): sdraw_border (surface, state, cls, st, active, space=active_space) cursor_found = True surface.blit (image, (border_active, border_active)) blit (surface, (0, posy)) elif focus and not cursor_found and (item == cursor): # Input focus. surface = sdraw_rect (max (width, realwidth), selheight, state, cls, st) sdraw_border (surface, state, cls, st, active, space=active_space) surface.blit (image, (border_active, border_active)) cursor_found = True blit (surface, (0, posy)) else: # Regular image, move by the active border, so that # all items have the correct offset. blit (image, (border_active, posy + border_active)) posy += selheight + spacing self.image.blit (surface_all, (border, border), (abs (self.hadjustment), abs (self.vadjustment), width, height))