Example #1
0
 def drawAll(self, widget=None, event=None, cr=None, cursor=True):
     #?????? Must enhance (only draw few cells, not all cells)
     #print(now(), 'drawAll'#, tuple(event.area), tuple(self.get_allocation()))
     if event:
         xu, yu, wu, hu = tuple(event.area)
         #print('expose-event area:', xu, yu, wu, hu)
     self.calcCoord()
     w = self.get_allocation().width
     h = self.get_allocation().height
     if not cr:
         cr = self.get_window().cairo_create()
         #cr.set_line_width(0)#??????????????
         #cr.scale(0.5, 0.5)
     wx = ui.winX
     wy = ui.winY
     if ui.bgUseDesk:## FIXME
         ### ????????????????? Need for mainWin !!!!!
         coord = self.translate_coordinates(self, wx, wy)
         if len(coord)==2:
             from scal2.ui_gtk import desktop
             x0, y0 = coord
             try:
                 bg = desktop.get_wallpaper(x0, y0, w, h)
             except:
                 print('Could not get wallpaper!')
                 myRaise(__file__)
                 #os.popen('gnome-settings-daemon')
                 ui.bgUseDesk = False ##??????????????????
                 #self.prefDialog.checkDeskBg.set_active(False)##??????????????????
             else:
                 cr.set_source_pixbuf(bg, 0, 0)
                 cr.paint()
         #else:
         #    print(coord)
     cr.rectangle(0, 0, w, h)
     fillColor(cr, ui.bgColor)
     status = getCurrentMonthStatus()
     #################################### Drawing Border
     if ui.mcalTopMargin>0:
         ##### Drawing border top background
         ##menuBgColor == borderColor ##???????????????
         cr.rectangle(0, 0, w, ui.mcalTopMargin)
         fillColor(cr, ui.borderColor)
         ######## Drawing weekDays names
         setColor(cr, ui.borderTextColor)
         dx = 0
         wdayAb = (self.wdaysWidth > w)
         for i in range(7):
             wday = newTextLayout(self, core.getWeekDayAuto(i, wdayAb))
             try:
                 fontw, fonth = wday.get_pixel_size()
             except:
                 myRaise(__file__)
                 fontw, fonth = wday.get_pixel_size()
             cr.move_to(
                 self.cx[i]-fontw/2.0,
                 (ui.mcalTopMargin-fonth)/2.0-1,
             )
             cr.show_layout(wday)
         ######## Drawing "Menu" label
         setColor(cr, ui.menuTextColor)
         text = newTextLayout(self, _('Menu'))
         fontw, fonth = text.get_pixel_size()
         if rtl:
             cr.move_to(
                 w-(ui.mcalLeftMargin+fontw)/2.0 - 3,
                 (ui.mcalTopMargin-fonth)/2.0 - 1,
             )
         else:
             cr.move_to(
                 (ui.mcalLeftMargin-fontw)/2.0,
                 (ui.mcalTopMargin-fonth)/2.0 - 1,
             )
         cr.show_layout(text)
     if ui.mcalLeftMargin>0:
         ##### Drawing border left background
         if rtl:
             cr.rectangle(
                 w - ui.mcalLeftMargin,
                 ui.mcalTopMargin,
                 ui.mcalLeftMargin,
                 h - ui.mcalTopMargin,
             )
         else:
             cr.rectangle(
                 0,
                 ui.mcalTopMargin,
                 ui.mcalLeftMargin,
                 h - ui.mcalTopMargin,
             )
         fillColor(cr, ui.borderColor)
         ##### Drawing week numbers
         setColor(cr, ui.borderTextColor)
         for i in range(6):
             lay = newTextLayout(self, _(status.weekNum[i]))
             fontw, fonth = lay.get_pixel_size()
             if rtl:
                 cr.move_to(
                     w - (ui.mcalLeftMargin+fontw)/2.0,
                     self.cy[i]-fonth/2.0 + 2,
                 )
             else:
                 cr.move_to(
                     (ui.mcalLeftMargin-fontw)/2.0,
                     self.cy[i]-fonth/2.0 + 2,
                 )
             cr.show_layout(lay)
     selectedCellPos = ui.cell.monthPos
     if ui.todayCell.inSameMonth(ui.cell):
         tx, ty = ui.todayCell.monthPos ## today x and y
         x0 = self.cx[tx] - self.dx/2.0
         y0 = self.cy[ty] - self.dy/2.0
         cr.rectangle(x0, y0, self.dx, self.dy)
         fillColor(cr, ui.todayCellColor)
     for yPos in range(6):
         for xPos in range(7):
             c = status[yPos][xPos]
             x0 = self.cx[xPos]
             y0 = self.cy[yPos]
             cellInactive = (c.month != ui.cell.month)
             cellHasCursor = (cursor and (xPos, yPos) == selectedCellPos)
             if cellHasCursor:
                 ##### Drawing Cursor
                 cx0 = x0 - self.dx/2.0 + 1
                 cy0 = y0 - self.dy/2.0 + 1
                 cw = self.dx - 1
                 ch = self.dy - 1
                 ######### Circular Rounded
                 drawCursorBg(cr, cx0, cy0, cw, ch)
                 fillColor(cr, ui.cursorBgColor)
             ######## end of Drawing Cursor
             if not cellInactive:
                 iconList = c.getMonthEventIcons()
                 if iconList:
                     iconsN = len(iconList)
                     scaleFact = 1.0 / sqrt(iconsN)
                     fromRight = 0
                     for index, icon in enumerate(iconList):
                         ## if len(iconList) > 1 ## FIXME
                         try:
                             pix = gdk.pixbuf_new_from_file(icon)
                         except:
                             myRaise(__file__)
                             continue
                         pix_w = pix.get_width()
                         pix_h = pix.get_height()
                         ## right buttom corner ?????????????????????
                         x1 = (self.cx[xPos] + self.dx/2.0)/scaleFact - fromRight - pix_w # right side
                         y1 = (self.cy[yPos] + self.dy/2.0)/scaleFact - pix_h # buttom side
                         cr.scale(scaleFact, scaleFact)
                         cr.set_source_pixbuf(pix, x1, y1)
                         cr.rectangle(x1, y1, pix_w, pix_h)
                         cr.fill()
                         cr.scale(1.0/scaleFact, 1.0/scaleFact)
                         fromRight += pix_w
             #### Drawing numbers inside every cell
             #cr.rectangle(
             #    x0-self.dx/2.0+1,
             #    y0-self.dy/2.0+1,
             #    self.dx-1,
             #    self.dy-1,
             #)
             mode = calTypes.primary
             params = ui.mcalTypeParams[0]
             daynum = newTextLayout(self, _(c.dates[mode][2], mode), params['font'])
             fontw, fonth = daynum.get_pixel_size()
             if cellInactive:
                 setColor(cr, ui.inactiveColor)
             elif c.holiday:
                 setColor(cr, ui.holidayColor)
             else:
                 setColor(cr, params['color'])
             cr.move_to(
                 x0 - fontw/2.0 + params['pos'][0],
                 y0 - fonth/2.0 + params['pos'][1],
             )
             cr.show_layout(daynum)
             if not cellInactive:
                 for mode, params in ui.getMcalMinorTypeParams()[1:]:
                     daynum = newTextLayout(self, _(c.dates[mode][2], mode), params['font'])
                     fontw, fonth = daynum.get_pixel_size()
                     setColor(cr, params['color'])
                     cr.move_to(
                         x0 - fontw/2.0 + params['pos'][0],
                         y0 - fonth/2.0 + params['pos'][1],
                     )
                     cr.show_layout(daynum)
                 if cellHasCursor:
                     ##### Drawing Cursor Outline
                     cx0 = x0-self.dx/2.0+1
                     cy0 = y0-self.dy/2.0+1
                     cw = self.dx-1
                     ch = self.dy-1
                     ######### Circular Rounded
                     drawCursorOutline(cr, cx0, cy0, cw, ch)
                     fillColor(cr, ui.cursorOutColor)
                     ##### end of Drawing Cursor Outline
     ################ end of drawing cells
     ##### drawGrid
     if ui.mcalGrid:
         setColor(cr, ui.mcalGridColor)
         for i in range(7):
             cr.rectangle(self.cx[i]+rtlSgn()*self.dx/2.0, 0, 1, h)
             cr.fill()
         for i in range(6):
             cr.rectangle(0, self.cy[i]-self.dy/2.0, w, 1)
             cr.fill()
     return False
Example #2
0
    def paintEvent(self, event):
        self.updateTextWidth()
        self.calcCoord()
        w = self.width()
        h = self.height()
        #####
        painter = qt.QPainter()
        painter.begin(self)
        #####
        #painter.setPen(qt.QColor(*ui.bgColor))
        painter.setBrush(qt.QColor(*ui.bgColor))
        painter.drawRect(0, 0, w, h)
        #####
        status = getCurrentMonthStatus()
        #################################### Drawing Border
        if ui.mcalTopMargin>0:
            ##### Drawing border top background
            ##menuBgColor == borderColor ##???????????????
            painter.setBrush(qt.QColor(*ui.borderColor))
            painter.drawRect(0, 0, w, ui.mcalTopMargin)
            ######## Drawing weekDays names
            painter.setPen(qt.QColor(*ui.borderTextColor))
            dx = 0
            wdayAb = (self.wdaysWidth > w)
            for i in xrange(7):
                painter.drawText(self.cx[i]-self.dx/2.0, 0, self.dx, ui.mcalTopMargin,
                                 qc.Qt.AlignCenter, core.getWeekDayAuto(i, wdayAb))
            ######## Drawing "Menu" label
            painter.setPen(qt.QColor(*ui.menuTextColor))
            painter.drawText(
                w - ui.mcalLeftMargin if rtl else 0,
                0,
                ui.mcalLeftMargin,
                ui.mcalTopMargin,
                qc.Qt.AlignCenter,
                _('Menu')
            )
        if ui.mcalLeftMargin>0:
            ##### Drawing border left background
            painter.setBrush(qt.QColor(*ui.borderColor))
            if rtl:
                painter.drawRect(w-ui.mcalLeftMargin, ui.mcalTopMargin, ui.mcalLeftMargin, h-ui.mcalTopMargin)
            else:
                painter.drawRect(0, ui.mcalTopMargin, ui.mcalLeftMargin, h-ui.mcalTopMargin)
            ##### Drawing week numbers
            painter.setPen(qt.QColor(*ui.borderTextColor))
            for i in xrange(6):
                painter.drawText(
                    w - ui.mcalLeftMargin if rtl else 0,
                    self.cy[i]-self.dy/2.0,
                    ui.mcalLeftMargin,
                    self.dy,
                    qc.Qt.AlignCenter,
                    _(status.weekNum[i])
                )
        cursor = True ## FIXME
        quad = 90 ## 90*16
        selectedCellPos = ui.cell.monthPos
        for yPos in xrange(6):
            for xPos in xrange(7):
                c = status[yPos][xPos]
                x0 = self.cx[xPos]
                y0 = self.cy[yPos]
                cellInactive = (c.month != ui.cell.month)
                cellHasCursor = (cursor and (xPos, yPos) == selectedCellPos)
                if cellHasCursor:
                    ##### Drawing Cursor
                    d=ui.cursorD
                    if ui.cursorFixed:
                        cx0 = x0-ui.cursorW/2.0 - d
                        cy0 = y0-ui.cursorH/2.0 - d
                        cw = ui.cursorW + 2*d
                        ch = ui.cursorH + 2*d
                    else:
                        eps = 0.3 ## ????????????
                        cx0 = x0 - self.dx/2.0 + eps
                        cy0 = y0 - self.dy/2.0 + eps
                        cw = self.dx - 1 - 2*eps
                        ch = self.dy - 1 - 2*eps
                    painter.setBrush(qt.QColor(*ui.cursorBgColor))
                    if ui.cursorR==0:
                        painter.drawRect(cx0, cy0, cw, ch)
                    else:
                        ## if round_oval: ## ??????
                        ######### Circular Rounded
                        ro = min(ui.cursorR, cw/2, ch/2)
                        #a = min(cw, ch); ri = ro*(a-2*d)/a
                        ri = max(ro-d, 0)
                        ######### Outline:
                        path = qt.QPainterPath()
                        path.moveTo(cx0+ro, cy0)
                        path.lineTo(cx0+cw-ro, cy0)
                        path.arcTo(cx0+cw-2*ro, cy0, 2*ro, 2*ro, quad, -quad)## up right corner
                        path.lineTo(cx0+cw, cy0+ch-ro)
                        path.arcTo(cx0+cw-2*ro, cy0+ch-2*ro, 2*ro, 2*ro, 0, -quad)## down right corner
                        path.lineTo(cx0+ro, cy0+ch)
                        path.arcTo(cx0, cy0+ch-2*ro, 2*ro, 2*ro, -quad, -quad)## down left corner
                        path.lineTo(cx0, cy0+ro)
                        path.arcTo(cx0, cy0, 2*ro, 2*ro, -2*quad, -quad)## up left corner
                        ####
                        painter.drawPath(path)
                        ##if round_oval:##???????
                ##### end of Drawing Cursor
                '''
                if not cellInactive:
                    ## right buttom corner ?????????????????????
                    targetRect = QRectF()
                    pix = qt.QPixmap(join(pixDir, ui.customdayModes[c.customday['type']][1]))
                    painter.drawPixmap(self.cx[xPos]+self.dx/2.0-pix.width(),# right side
                                       self.cy[yPos]+self.dy/2.0-pix.height(),# buttom side
                                       self.customdayPixmaps[c.customday['type']])
                '''
                params = ui.mcalTypeParams[0]
                if params['enable']:
                    mode = core.primaryMode
                    num = _(c.dates[mode][2], mode)
                    qfont = qfontEncode(params['font'])
                    met = qt.QFontMetrics(qfont)
                    fontw = met.maxWidth() * len(num)
                    fonth = met.height()
                    painter.setFont(qfont)
                    if not cellInactive:
                        painter.setPen(qt.QColor(*ui.inactiveColor))
                    elif c.holiday:
                        painter.setPen(qt.QColor(*ui.holidayColor))
                    else:
                        painter.setPen(qt.QColor(*params['color']))
                    painter.drawText(
                        x0 - fontw/2.0 + params['x'],
                        y0 - fonth/2.0 + params['y'],
                        fontw,
                        fonth,
                        qc.Qt.AlignCenter,
                        num,
                    )
                if not cellInactive:
                    for mode, params in ui.getMcalMinorTypeParams()[1:]:
                        if params['enable']:
                            num = _(c.dates[mode][2], mode)
                            qfont = qfontEncode(params['font'])
                            met = qt.QFontMetrics(qfont)
                            fontw = met.maxWidth() * len(num)
                            fonth = met.height()
                            painter.setFont(qfont)
                            painter.setPen(qt.QColor(*params['color']))
                            painter.drawText(
                                x0 - fontw/2.0 + params['x'],
                                y0 - fonth/2.0 + params['y'],
                                fontw,
                                fonth,
                                qc.Qt.AlignCenter,
                                num,
                            )
                    if cellHasCursor:
                        ##### Drawing Cursor Outline
                        d = ui.cursorD
                        if ui.cursorFixed:
                            cx0 = x0 - ui.cursorW/2.0 - d
                            cy0 = y0 - ui.cursorH/2.0 - d
                            cw = ui.cursorW + 2*d
                            ch = ui.cursorH + 2* d
                        else:
                            eps = 0.3 ## ????????????
                            cx0 = x0-self.dx/2.0 + eps
                            cy0 = y0-self.dy/2.0 + eps
                            cw = self.dx - 1 - 2*eps
                            ch = self.dy - 1 - 2*eps
                        painter.setBrush(qt.QColor(*ui.cursorOutColor))
                        path = qt.QPainterPath()
                        if ui.cursorR==0:
                            path.moveTo(cx0, cy0)
                            path.lineTo(cx0+cw, cy0)
                            path.lineTo(cx0+cw, cy0+ch)
                            path.lineTo(cx0, cy0+ch)
                            path.lineTo(cx0, cy0)
                            #####
                            path.moveTo(cx0+d, cy0+d)
                            path.lineTo(cx0+d, cy0+ch-d)
                            path.lineTo(cx0+cw-d, cy0+ch-d)
                            path.lineTo(cx0+cw-d, cy0+d)
                            path.lineTo(cx0+d, cy0+d)
                        else:
                            ## if round_oval: #??????????
                            ######### Circular Rounded
                            ro = min(ui.cursorR, cw/2, ch/2)
                            #a = min(cw, ch); ri = ro*(a-2*d)/a
                            d = min(d, ro)
                            ri = ro-d
                            ######### Outline:
                            path.moveTo(cx0+ro, cy0)
                            path.lineTo(cx0+cw-ro, cy0)
                            path.arcTo(cx0+cw-2*ro, cy0, 2*ro, 2*ro, quad, -quad) ## up right corner
                            path.lineTo(cx0+cw, cy0+ch-ro)
                            path.arcTo(cx0+cw-2*ro, cy0+ch-2*ro, 2*ro, 2*ro, 0, -quad) ## down right corner
                            path.lineTo(cx0+ro, cy0+ch)
                            path.arcTo(cx0, cy0+ch-2*ro, 2*ro, 2*ro, -quad, -quad) ## down left corner
                            path.lineTo(cx0, cy0+ro)
                            path.arcTo(cx0, cy0, 2*ro, 2*ro, -2*quad, -quad) ## up left corner
                            #### Inline:
                            path.moveTo(cx0+ro, cy0+d) ## or line to?
                            path.arcTo(cx0+d, cy0+d, 2*ri, 2*ri, quad, quad) ## up left corner
                            path.lineTo(cx0+d, cy0+ch-ro)
                            path.arcTo(cx0+d, cy0+ch-ro-ri, 2*ri, 2*ri, 2*quad, quad) ## down left
                            path.lineTo(cx0+cw-ro, cy0+ch-d)
                            path.arcTo(cx0+cw-ro-ri, cy0+ch-ro-ri, 2*ri, 2*ri, 3*quad, quad) ## down right
                            path.lineTo(cx0+cw-d, cy0+ro)
                            path.arcTo(cx0+cw-ro-ri, cy0+d, 2*ri, 2*ri, 0, quad) ## up right
                            path.lineTo(cx0+ro, cy0+d)
                            ####
                            painter.drawPath(path)
                            ## if round_oval: ## ??????
                            ##### end of Drawing Cursor Outline


        ##### drawGrid
        if ui.mcalGrid:
            painter.setBrush(qt.QColor(*ui.mcalGridColor))
            for i in xrange(7):
                painter.drawRect(self.cx[i]+rtlSgn()*self.dx/2.0, 0, 1, h)
            for i in xrange(6):
                painter.drawRect(0, self.cy[i]-self.dy/2.0, w, 1)
Example #3
0
	def drawAll(self, widget=None, gevent=None, cr=None, cursor=True):
		#?????? Must enhance (only draw few cells, not all cells)
		#print(now(), 'drawAll'#, tuple(gevent.area), tuple(self.get_allocation()))
		if gevent:
			xu, yu, wu, hu = tuple(gevent.area)
			#print('expose-event area:', xu, yu, wu, hu)
		self.calcCoord()
		w = self.get_allocation().width
		h = self.get_allocation().height
		if not cr:
			cr = self.get_window().cairo_create()
			#cr.set_line_width(0)#??????????????
			#cr.scale(0.5, 0.5)
		wx = ui.winX
		wy = ui.winY
		if ui.bgUseDesk:## FIXME
			### ????????????????? Need for mainWin !!!!!
			coord = self.translate_coordinates(self, wx, wy)
			if len(coord)==2:
				from scal2.ui_gtk import desktop
				x0, y0 = coord
				try:
					bg = desktop.get_wallpaper(x0, y0, w, h)
				except:
					print('Could not get wallpaper!')
					myRaise(__file__)
					#os.popen('gnome-settings-daemon')
					ui.bgUseDesk = False ##??????????????????
					#if ui.prefDialog
					#	ui.prefDialog.checkDeskBg.set_active(False)##??????????????????
				else:
					cr.set_source_pixbuf(bg, 0, 0)
					cr.paint()
			#else:
			#	print(coord)
		cr.rectangle(0, 0, w, h)
		fillColor(cr, ui.bgColor)
		status = getCurrentMonthStatus()
		#################################### Drawing Border
		if ui.mcalTopMargin>0:
			##### Drawing border top background
			##menuBgColor == borderColor ##???????????????
			cr.rectangle(0, 0, w, ui.mcalTopMargin)
			fillColor(cr, ui.borderColor)
			######## Drawing weekDays names
			setColor(cr, ui.borderTextColor)
			dx = 0
			wdayAb = (self.wdaysWidth > w)
			for i in range(7):
				wday = newTextLayout(self, core.getWeekDayAuto(i, wdayAb))
				try:
					fontw, fonth = wday.get_pixel_size()
				except:
					myRaise(__file__)
					fontw, fonth = wday.get_pixel_size()
				cr.move_to(
					self.cx[i]-fontw/2.0,
					(ui.mcalTopMargin-fonth)/2.0-1,
				)
				cr.show_layout(wday)
			######## Drawing "Menu" label
			setColor(cr, ui.menuTextColor)
			text = newTextLayout(self, _('Menu'))
			fontw, fonth = text.get_pixel_size()
			if rtl:
				cr.move_to(
					w-(ui.mcalLeftMargin+fontw)/2.0 - 3,
					(ui.mcalTopMargin-fonth)/2.0 - 1,
				)
			else:
				cr.move_to(
					(ui.mcalLeftMargin-fontw)/2.0,
					(ui.mcalTopMargin-fonth)/2.0 - 1,
				)
			cr.show_layout(text)
		if ui.mcalLeftMargin>0:
			##### Drawing border left background
			if rtl:
				cr.rectangle(
					w - ui.mcalLeftMargin,
					ui.mcalTopMargin,
					ui.mcalLeftMargin,
					h - ui.mcalTopMargin,
				)
			else:
				cr.rectangle(
					0,
					ui.mcalTopMargin,
					ui.mcalLeftMargin,
					h - ui.mcalTopMargin,
				)
			fillColor(cr, ui.borderColor)
			##### Drawing week numbers
			setColor(cr, ui.borderTextColor)
			for i in range(6):
				lay = newTextLayout(self, _(status.weekNum[i]))
				fontw, fonth = lay.get_pixel_size()
				if rtl:
					cr.move_to(
						w - (ui.mcalLeftMargin+fontw)/2.0,
						self.cy[i]-fonth/2.0 + 2,
					)
				else:
					cr.move_to(
						(ui.mcalLeftMargin-fontw)/2.0,
						self.cy[i]-fonth/2.0 + 2,
					)
				cr.show_layout(lay)
		selectedCellPos = ui.cell.monthPos
		if ui.todayCell.inSameMonth(ui.cell):
			tx, ty = ui.todayCell.monthPos ## today x and y
			x0 = self.cx[tx] - self.dx/2.0
			y0 = self.cy[ty] - self.dy/2.0
			cr.rectangle(x0, y0, self.dx, self.dy)
			fillColor(cr, ui.todayCellColor)
		for yPos in range(6):
			for xPos in range(7):
				c = status[yPos][xPos]
				x0 = self.cx[xPos]
				y0 = self.cy[yPos]
				cellInactive = (c.month != ui.cell.month)
				cellHasCursor = (cursor and (xPos, yPos) == selectedCellPos)
				if cellHasCursor:
					##### Drawing Cursor
					cx0 = x0 - self.dx/2.0 + 1
					cy0 = y0 - self.dy/2.0 + 1
					cw = self.dx - 1
					ch = self.dy - 1
					######### Circular Rounded
					drawCursorBg(cr, cx0, cy0, cw, ch)
					fillColor(cr, ui.cursorBgColor)
				######## end of Drawing Cursor
				if not cellInactive:
					iconList = c.getMonthEventIcons()
					if iconList:
						iconsN = len(iconList)
						scaleFact = 1.0 / sqrt(iconsN)
						fromRight = 0
						for index, icon in enumerate(iconList):
							## if len(iconList) > 1 ## FIXME
							try:
								pix = gdk.pixbuf_new_from_file(icon)
							except:
								myRaise(__file__)
								continue
							pix_w = pix.get_width()
							pix_h = pix.get_height()
							## right buttom corner ?????????????????????
							x1 = (self.cx[xPos] + self.dx/2.0)/scaleFact - fromRight - pix_w # right side
							y1 = (self.cy[yPos] + self.dy/2.0)/scaleFact - pix_h # buttom side
							cr.scale(scaleFact, scaleFact)
							cr.set_source_pixbuf(pix, x1, y1)
							cr.rectangle(x1, y1, pix_w, pix_h)
							cr.fill()
							cr.scale(1.0/scaleFact, 1.0/scaleFact)
							fromRight += pix_w
				#### Drawing numbers inside every cell
				#cr.rectangle(
				#	x0-self.dx/2.0+1,
				#	y0-self.dy/2.0+1,
				#	self.dx-1,
				#	self.dy-1,
				#)
				mode = calTypes.primary
				params = ui.mcalTypeParams[0]
				daynum = newTextLayout(self, _(c.dates[mode][2], mode), params['font'])
				fontw, fonth = daynum.get_pixel_size()
				if cellInactive:
					setColor(cr, ui.inactiveColor)
				elif c.holiday:
					setColor(cr, ui.holidayColor)
				else:
					setColor(cr, params['color'])
				cr.move_to(
					x0 - fontw/2.0 + params['pos'][0],
					y0 - fonth/2.0 + params['pos'][1],
				)
				cr.show_layout(daynum)
				if not cellInactive:
					for mode, params in ui.getMcalMinorTypeParams()[1:]:
						daynum = newTextLayout(self, _(c.dates[mode][2], mode), params['font'])
						fontw, fonth = daynum.get_pixel_size()
						setColor(cr, params['color'])
						cr.move_to(
							x0 - fontw/2.0 + params['pos'][0],
							y0 - fonth/2.0 + params['pos'][1],
						)
						cr.show_layout(daynum)
					if cellHasCursor:
						##### Drawing Cursor Outline
						cx0 = x0-self.dx/2.0+1
						cy0 = y0-self.dy/2.0+1
						cw = self.dx-1
						ch = self.dy-1
						######### Circular Rounded
						drawCursorOutline(cr, cx0, cy0, cw, ch)
						fillColor(cr, ui.cursorOutColor)
						##### end of Drawing Cursor Outline
		################ end of drawing cells
		##### drawGrid
		if ui.mcalGrid:
			setColor(cr, ui.mcalGridColor)
			for i in range(7):
				cr.rectangle(self.cx[i]+rtlSgn()*self.dx/2.0, 0, 1, h)
				cr.fill()
			for i in range(6):
				cr.rectangle(0, self.cy[i]-self.dy/2.0, w, 1)
				cr.fill()
		return False