X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=trunk%2Fsrc%2Fgraph.py;h=b476513b201dfc78d4884c0a8882e26a8164f0f8;hb=65fb67afdf55e65f317e8e1cf86bac9165764000;hp=4e612b1e8559cc2c884e5405c8b21ab2af28135b;hpb=97b009237ff28e912809db3aa446dc689d2f427c;p=maegirls diff --git a/trunk/src/graph.py b/trunk/src/graph.py index 4e612b1..b476513 100755 --- a/trunk/src/graph.py +++ b/trunk/src/graph.py @@ -51,6 +51,8 @@ class DaysGraph(QWidget): self.update() def paintEvent(self, event): + palette=self.palette() + w0=self.width() h=self.height() @@ -84,7 +86,8 @@ class DaysGraph(QWidget): pencur=QPen(colcur, 3) # Text color - coltxt=Qt.white + #coltxt=Qt.white + coltxt=palette.color(palette.WindowText) pentxt=QPen(coltxt) # Font @@ -167,13 +170,15 @@ class DaysGraph(QWidget): # Highlight today if curday==today: painter.setPen(pencur) - painter.drawRect(x+2,y+2,self.day_width-4, h2-5) + painter.drawRect(x+1,y+3,self.day_width-4, h2-7) date=time.localtime(curday*86400+30000) y2=h2 - txt="%d.%02d\n%d" % (date.tm_mday, date.tm_mon, date.tm_year) + day=QLocale().dayName(date.tm_wday+1, QLocale.ShortFormat) + txt="%s\n%d.%02d\n%d" % \ + (day, date.tm_mday, date.tm_mon, date.tm_year) # br is used to determine overlaps br=fontdate_m.boundingRect(txt) @@ -191,13 +196,30 @@ class DaysGraph(QWidget): # br2 is the true bounding rectangle # The width calculation helps with alignment br2=QRect(x-((colnum-1)/2 * self.day_width), y2, - self.day_width*colnum, fontdate_m.height()*2) + self.day_width*colnum, fontdate_m.height()*3) # Draw it painter.setFont(fontdate) painter.setPen(pentxt) painter.drawText(br2, Qt.AlignCenter | Qt.AlignTop, txt) + # Outer border + +# Try 1 +# for x in xrange(5, -1, -1): +# c=0x11*(x+1) +# colobg=QColor(c, c, c) +# penobg=QPen(colobg, 1) +# painter.setPen(penobg) +# painter.drawRect(x, x, self.width()-(2*x)-1, h2-(2*x)-1) + +# Try 2 +# colobg=Qt.black +# w=2 +# penobg=QPen(colobg, w) +# painter.setPen(penobg) +# painter.drawRect(w/2, w/2, self.width()-w, h2-w) + # Handle both horizontal and vertical movement def mouseMoveEvent(self, event): pos=event.pos()