Minor changes
This commit is contained in:
parent
8e24a71ea7
commit
58d03fbea5
1 changed files with 24 additions and 2 deletions
|
@ -34,6 +34,7 @@ class CalDrawerScene(QGraphicsScene):
|
|||
self.env=env
|
||||
self.calState=env.calState
|
||||
self.daysNames=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]
|
||||
self.monthNames=["January", "February", "March", "April", "May", "June","July","August", "September","October", "November", "December"]
|
||||
self.pullState()
|
||||
self.selection=self.today
|
||||
|
||||
|
@ -43,11 +44,32 @@ class CalDrawerScene(QGraphicsScene):
|
|||
self.defaultBrush=painter.brush()
|
||||
self.daysRect.clear()
|
||||
self.eventsRect.clear()
|
||||
daysNamesH=self.drawDaysName(painter, origXI, origYI, widthI, heightI)
|
||||
self.drawGrid(painter, origXI, origYI+daysNamesH, widthI, heightI-daysNamesH)
|
||||
offsetX=0
|
||||
offsetX+=self.drawHeader(painter, origXI, origYI, widthI, heightI)
|
||||
offsetX+=self.drawDaysName(painter, origXI, origYI+offsetX, widthI, heightI-offsetX)
|
||||
self.drawGrid(painter, origXI, origYI+offsetX, widthI, heightI-offsetX)
|
||||
self.drawDaysLabel(painter)
|
||||
self.drawEvents(painter)
|
||||
|
||||
def drawHeader(self,painter, x, y, width, height):
|
||||
# Init Pen
|
||||
pen=QtGui.QPen()
|
||||
pen.setWidth(self.gridWidth)
|
||||
pen.setJoinStyle(Qt.PenJoinStyle.MiterJoin)
|
||||
po=int(self.gridWidth/2) # Pen offset
|
||||
painter.setPen(pen)
|
||||
# Init Brush
|
||||
painter.setBrush(Qt.BrushStyle.NoBrush)
|
||||
# Init dimensions
|
||||
font=painter.font()
|
||||
metric=QtGui.QFontMetrics(font);
|
||||
labelH=metric.boundingRect("".join(self.monthNames)).height()
|
||||
# Draw
|
||||
rect=QRect(x+po,y+po,width-po*2,height-po*2) # Draw grid
|
||||
painter.drawRect(rect)
|
||||
painter.drawText(x,y,width,height,Qt.AlignmentFlag.AlignHCenter,self.monthNames[self.calState.month])
|
||||
return labelH
|
||||
|
||||
def drawDaysName(self, painter, x, y, width, height):
|
||||
# Init Pen
|
||||
pen=QtGui.QPen()
|
||||
|
|
Loading…
Add table
Reference in a new issue