From 570d6a4559218a337ea8e49649a9c4303d9db214 Mon Sep 17 00:00:00 2001 From: pin Date: Thu, 25 Mar 2010 10:49:14 +0000 Subject: [PATCH] =?utf8?q?=C3=A9largissement=20de=20la=20colonne=20si=20ja?= =?utf8?q?mais=20parole=20trop=20large.=20On=20va=20virer=20le=20=C2=AB?= =?utf8?q?=C2=A0atBorder=C2=A0=C2=BB=20:=20il=20n'est=20pas=20exclu=20qu'u?= =?utf8?q?ne=20bande=20non=20adjacente=20=C3=A0=20une=20bordure=20puisse?= =?utf8?q?=20d=C3=A9passer=20le=20bord.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@117 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/app/widgets/column.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/app/widgets/column.py b/src/app/widgets/column.py index e55b935..3d8b986 100755 --- a/src/app/widgets/column.py +++ b/src/app/widgets/column.py @@ -51,8 +51,10 @@ class Column(pygame.sprite.DirtySprite) : onLeft = rect.centerx - onWidth / 2 rectOn = pygame.Rect((onLeft, 0), (onWidth, rect.height)) - if atBorder : - setattr(rectOn, atBorder, getattr(rect, atBorder)) + + self.atBorder = atBorder + if self.atBorder : + setattr(rectOn, self.atBorder, getattr(rect, self.atBorder)) self.surOn = gradients.vertical(rectOn.size, topRgba, bottomRgba) w, h = rectOn.w, rectOn.h @@ -73,14 +75,23 @@ class Column(pygame.sprite.DirtySprite) : sur = self.surOn if syllabus : sur = sur.copy() + rect = self.rectOn renderedSyl = FONT.render(syllabus, True, FONT_COLOR) sw, sh, = renderedSyl.get_size() w, h = self.rectOn.w, self.rectOn.h + + if sw > self.rectOn.w : + sur = pygame.transform.scale(sur, (sw, h)) + rect = rect.inflate(sw - w, 0) + if self.atBorder : + setattr(rect, self.atBorder, getattr(self.rectOn, self.atBorder)) + w = sw + sylRect = pygame.Rect(((w - sw) / 2, (h - sh) / 2), (sw, sh)) sur.blit(renderedSyl, sylRect) self.image = sur - self.rect = self.rectOn + self.rect = rect else : group.change_layer(self, BACKGROUND_LAYER) self.image = self.surOff -- 2.20.1