Use the palette's window color for drawing text.
authorv13 <v13>
Mon, 9 Aug 2010 21:07:44 +0000 (21:07 +0000)
committerv13 <v13>
Mon, 9 Aug 2010 21:07:44 +0000 (21:07 +0000)
Also display the day.
Minor alignment fix.
Version 1.2.

trunk/setup.py
trunk/src/config.py
trunk/src/graph.py

index 523d4d6..a42ceb1 100755 (executable)
@@ -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",
index b9fa81a..ca82155 100755 (executable)
@@ -28,7 +28,7 @@ import pickle
 import time
 import algo
 
-version="1.1"
+version="1.2"
 
 try:
     home=os.environ['HOME']
index 4e612b1..b476513 100755 (executable)
@@ -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()