Minor changes
This commit is contained in:
parent
76ddf4fe10
commit
f02e224d75
3 changed files with 21 additions and 13 deletions
|
@ -136,6 +136,10 @@ class CalDrawerScene(QGraphicsScene):
|
|||
brush.setColor(QtGui.QColor(self.daysLabelBG))
|
||||
brush.setStyle(Qt.BrushStyle.SolidPattern)
|
||||
painter.setBrush(brush)
|
||||
# Brush for today
|
||||
brushToday=QtGui.QBrush()
|
||||
brushToday.setColor(QtGui.QColor("#23a1fc"))
|
||||
brushToday.setStyle(Qt.BrushStyle.SolidPattern)
|
||||
# Init various things
|
||||
days=self.calState.getMonthDays()
|
||||
font=painter.font()
|
||||
|
@ -148,13 +152,19 @@ class CalDrawerScene(QGraphicsScene):
|
|||
for i in range(0,len(self.daysRect)):
|
||||
r=self.daysRect[i]
|
||||
d=days[i]
|
||||
dayLabel="["+str(d[2])+"]" if d == today else str(d[2])
|
||||
dayLabel=str(d[2])
|
||||
labelW=metric.boundingRect(dayLabel).width()
|
||||
offsetX=int(r.width()/2-labelW/2)
|
||||
painter.setPen(Qt.PenStyle.NoPen)
|
||||
painter.drawRect(r.x(),r.y(),r.width(),labelH) # Remember r is within grid stroke
|
||||
painter.setPen(pen)
|
||||
# painter.drawText(r.x()+offsetX,r.y()+offsetY,dayLabel)
|
||||
if d == today:
|
||||
painter.setBrush(brushToday)
|
||||
painter.setPen(Qt.PenStyle.NoPen)
|
||||
painter.drawRect(r.x()+int(r.width()/4),r.y(),int(r.width()/2),labelH)
|
||||
painter.setBrush(brush)
|
||||
painter.setPen(pen)
|
||||
painter.drawText(r,Qt.AlignmentFlag.AlignHCenter,dayLabel)
|
||||
self.eventsRect.append(QRect(r.x(),r.y()+labelH+margin,r.width(),r.height()-(labelH+margin)))
|
||||
|
||||
|
@ -241,7 +251,6 @@ class CalDrawer():
|
|||
# self.gv.setSizePolicy(spLeft);
|
||||
layout.addWidget(self.gv)
|
||||
|
||||
def getSelectionEvents(self):
|
||||
(yy,mm,dd,ww)=self.gs.selection
|
||||
return self.env.listEventsOn(yy,mm,dd)
|
||||
def getSelection(self):
|
||||
return self.gs.selection
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ class EvtDrawerScene(QGraphicsScene):
|
|||
self.env=env
|
||||
self.eventsRect=list()
|
||||
self.eventsList=list()
|
||||
self.setDay(self.env.calState.today())
|
||||
|
||||
def drawForeground(self, painter, rect):
|
||||
self.eventsList=self.env.listEventsOn(2024,10,1)
|
||||
self.eventsRect.clear()
|
||||
origXF, origYF, widthF, heightF = rect.getRect()
|
||||
origXI, origYI, widthI, heightI = (int(origXF),int(origYF),int(widthF),int(heightF))
|
||||
|
@ -62,9 +62,10 @@ class EvtDrawerScene(QGraphicsScene):
|
|||
r=self.eventsRect[i]
|
||||
painter.drawText(r.x(),r.y()+labelH,"Hello event")
|
||||
|
||||
def setEvents(self, events):
|
||||
print(events)
|
||||
pass
|
||||
def setDay(self, day):
|
||||
self.eventsList=self.env.listEventsOn(day[0],day[1],day[2])
|
||||
self.update()
|
||||
|
||||
|
||||
class EvtDrawer():
|
||||
|
||||
|
@ -86,5 +87,5 @@ class EvtDrawer():
|
|||
# self.gv.setSizePolicy(spLeft);
|
||||
layout.addWidget(self.gv)
|
||||
|
||||
def setEvents(self,events):
|
||||
self.gs.setEvents(events)
|
||||
def setDay(self,day):
|
||||
self.gs.setDay(day)
|
||||
|
|
|
@ -20,16 +20,14 @@ class MainWindow(QMainWindow):
|
|||
self.calDrawer=CalDrawer(self, self.calContainer.layout(), env)
|
||||
self.evtDrawer=EvtDrawer(self.calContainer.layout(), env)
|
||||
self.show()
|
||||
print(self.calDrawer.getSelectionEvents())
|
||||
|
||||
def setVersion(self,version):
|
||||
self.statusbar.showMessage("TropiCal v"+version,0)
|
||||
|
||||
def event(self, event):
|
||||
if event.type() == DaySelectedEvent:
|
||||
self.evtDrawer.setEvents(self.calDrawer.getSelectionEvents())
|
||||
self.evtDrawer.setDay(self.calDrawer.getSelection())
|
||||
return QWidget.event(self,event) #super().event(event)
|
||||
|
||||
|
||||
def StartApplication(env):
|
||||
path = os.path.dirname(os.path.abspath(__file__))+"/designer"
|
||||
|
|
Loading…
Add table
Reference in a new issue