From 65fb67afdf55e65f317e8e1cf86bac9165764000 Mon Sep 17 00:00:00 2001 From: v13 Date: Mon, 9 Aug 2010 21:07:44 +0000 Subject: [PATCH] Use the palette's window color for drawing text. Also display the day. Minor alignment fix. Version 1.2. --- trunk/setup.py | 2 +- trunk/src/config.py | 2 +- trunk/src/graph.py | 30 ++++++++++++++++++++++++++---- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/trunk/setup.py b/trunk/setup.py index 523d4d6..a42ceb1 100755 --- a/trunk/setup.py +++ b/trunk/setup.py @@ -26,7 +26,7 @@ i18n_qm_files=["i18n/maegirls_el.qm"] setup( name='maegirls', - version='1.1', + version='1.2', description="MaeGirls", author="Stefanos Harhalakis", author_email="v13@v13.gr", diff --git a/trunk/src/config.py b/trunk/src/config.py index b9fa81a..ca82155 100755 --- a/trunk/src/config.py +++ b/trunk/src/config.py @@ -28,7 +28,7 @@ import pickle import time import algo -version="1.1" +version="1.2" try: home=os.environ['HOME'] 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() -- 1.7.9.5