self.update()
def paintEvent(self, event):
+ palette=self.palette()
+
w0=self.width()
h=self.height()
pencur=QPen(colcur, 3)
# Text color
- coltxt=Qt.white
+ #coltxt=Qt.white
+ coltxt=palette.color(palette.WindowText)
pentxt=QPen(coltxt)
# Font
# 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)
# 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()