def update(self, s): updates = [] if self.myfocus: self.toupdate[self.myfocus] = self.myfocus for w in self.topaint: if w is self.mywindow: continue else: sub = surface.subsurface(s, w.rect) #if (hasattr(w, "_container_bkgr")): # sub.blit(w._container_bkgr,(0,0)) w.paint(sub) updates.append(pygame.rect.Rect(w.rect)) for w in self.toupdate: if w is self.mywindow: continue else: us = w.update(surface.subsurface(s, w.rect)) if us: for u in us: updates.append( pygame.rect.Rect(u.x + w.rect.x, u.y + w.rect.y, u.w, u.h)) for w in self.topaint: if w is self.mywindow: w.paint(self.top_surface(s, w)) updates.append(pygame.rect.Rect(w.rect)) else: continue for w in self.toupdate: if w is self.mywindow: us = w.update(self.top_surface(s, w)) else: continue if us: for u in us: updates.append( pygame.rect.Rect(u.x + w.rect.x, u.y + w.rect.y, u.w, u.h)) self.topaint = {} self.toupdate = {} return updates
def myupdate(self, s): updates = [] if self.myfocus: self.toupdate[self.myfocus] = self.myfocus for w in self.topaint: if w is self.mywindow: continue else: sub = surface.subsurface(s, w.rect) w.paint(sub) updates.append(pygame.rect.Rect(w.rect)) while 1: try: for w in self.toupdate: if w is self.mywindow: continue else: us = w.update(surface.subsurface(s, w.rect)) if us: for u in us: updates.append( pygame.rect.Rect(u.x + w.rect.x, u.y + w.rect.y, u.w, u.h)) break except RuntimeError: pass for w in self.topaint: if w is self.mywindow: w.paint(self.top_surface(s, w)) updates.append(pygame.rect.Rect(w.rect)) else: continue for w in self.toupdate: if w is self.mywindow: us = w.update(self.top_surface(s, w)) else: continue if us: for u in us: updates.append( pygame.rect.Rect(u.x + w.rect.x, u.y + w.rect.y, u.w, u.h)) self.topaint = {} self.toupdate = {} return updates
def func(s): if w.disabled: return [] r = m(surface.subsurface(s, w._rect_content)) if type(r) == list: dx, dy = w._rect_content.topleft for rr in r: rr.x, rr.y = rr.x + dx, rr.y + dy return r
def myupdate(self, s): updates = [] if self.myfocus: self.toupdate[self.myfocus] = self.myfocus for w in self.topaint: if w is self.mywindow: continue else: sub = surface.subsurface(s, w.rect) w.paint(sub) updates.append(pygame.rect.Rect(w.rect)) while 1: try: for w in self.toupdate: if w is self.mywindow: continue else: us = w.update(surface.subsurface(s, w.rect)) if us: for u in us: updates.append(pygame.rect.Rect(u.x + w.rect.x, u.y + w.rect.y, u.w, u.h)) break except RuntimeError: pass for w in self.topaint: if w is self.mywindow: w.paint(self.top_surface(s, w)) updates.append(pygame.rect.Rect(w.rect)) else: continue for w in self.toupdate: if w is self.mywindow: us = w.update(self.top_surface(s, w)) else: continue if us: for u in us: updates.append(pygame.rect.Rect(u.x + w.rect.x, u.y + w.rect.y, u.w, u.h)) self.topaint = {} self.toupdate = {} return updates
def func(s): # if w.disabled: # if not hasattr(w,'_disabled_bkgr'): # w._disabled_bkgr = s.convert() # orig = s # s = w._disabled_bkgr.convert() # if not hasattr(w,'_theme_paint_bkgr'): # w._theme_paint_bkgr = s.convert() # else: # s.blit(w._theme_paint_bkgr,(0,0)) # # if w.disabled: # orig = s # s = w._theme_paint_bkgr.convert() if w.disabled: if (not (hasattr(w, '_theme_bkgr') and w._theme_bkgr.get_width() == s.get_width() and w._theme_bkgr.get_height() == s.get_height())): w._theme_bkgr = s.copy() orig = s s = w._theme_bkgr s.fill((0, 0, 0, 0)) s.blit(orig, (0, 0)) if w.background: w.background.paint(surface.subsurface(s, w._rect_border)) self.box(w, surface.subsurface(s, w._rect_border)) r = m(surface.subsurface(s, w._rect_content)) if w.disabled: s.set_alpha(128) orig.blit(s, (0, 0)) # if w.disabled: # orig.blit(w._disabled_bkgr,(0,0)) # s.set_alpha(128) # orig.blit(s,(0,0)) w._painted = True return r
def paint(self, s): self.toupdate = {} self.topaint = {} for w in self.widgets: try: sub = surface.subsurface(s, w.rect) except: print('container.paint(): %s not inside %s' % (w.__class__.__name__, self.__class__.__name__)) print(s.get_width(), s.get_height(), w.rect) print("") else: # if (not hasattr(w,'_container_bkgr') or # w._container_bkgr.get_size() != sub.get_size()): # #w._container_bkgr.get_width() == sub.get_width() and # #w._container_bkgr.get_height() == sub.get_height())): # w._container_bkgr = sub.copy() # w._container_bkgr.fill((0,0,0,0)) # w._container_bkgr.blit(sub,(0,0)) w.paint(sub) for w in self.windows: w.paint(self.top_surface(s, w))
def top_surface(self, s, w): x, y = s.get_abs_offset() s = s.get_abs_parent() return surface.subsurface( s, (x + w.rect.x, y + w.rect.y, w.rect.w, w.rect.h))
def paint(self, s): self.value.pcls = self.pcls self.value.paint(surface.subsurface(s, self.value.rect))
def paint(self, s): if self.group.value == self.value: self.pcls = "down" self.widget.paint(surface.subsurface(s, self.widget.rect))