def onExposeEvent(self, widget=None, event=None): t0 = time.time() w = self.allocation.width h = self.allocation.height cr = self.window.cairo_create() cr.rectangle(0, 0, w, h) fillColor(cr, ui.bgColor) setColor(cr, ui.wcalTextColor) status = getCurrentWeekStatus() rowH = (h-self.topMargin)/7 widthList = [] expandIndex = [] for (i, item) in enumerate(self.rowItems): widthList.append(item.width + self.widthSpacing) if item.expand: expandIndex.append(i) extraWidth = float(w - sum(widthList)) / len(expandIndex) for i in expandIndex: widthList[i] += extraWidth del expandIndex for (i, row) in enumerate(status): y = self.topMargin + i*rowH cr.rectangle(0, 0, w, h) #fillColor(cr, bgColor) if rtl: x = w else: x = 0 for (j, item) in enumerate(self.rowItems): itemW = widthList[j] text = item.getText(row).decode('utf8') if text: layout = newLimitedWidthTextLayout(self, text, itemW) if layout: layoutW, layoutH = layout.get_pixel_size() layoutX = x + item.textAlign * (itemW-layoutW) if rtl: layoutX -= itemW cr.move_to(layoutX, y+(rowH - layoutH)/2) if row.holiday and item.holidayColorize: setColor(cr, ui.holidayColor) else: setColor(cr, ui.wcalTextColor) cr.show_layout(layout) x = x - rtlSgn() * itemW for button in self.buttons: button.draw(cr, w, h) #print time.time()-t0 return False
def updateStatus(self): from scal2.weekcal import getCurrentWeekStatus self.status = getCurrentWeekStatus()
def updateStatus(self): self.status = getCurrentWeekStatus()