diff --git a/tropical/calstate.py b/tropical/calstate.py
index 7bf285a..575d521 100644
--- a/tropical/calstate.py
+++ b/tropical/calstate.py
@@ -6,8 +6,12 @@ class CalState:
def __init__(self):
self.gotoToday()
+ self.selection=(self.year, self.month, self.day)
self.firstWeekDay=0
+ def setSelection(self, yy, mm, dd):
+ self.selection=(yy,mm,dd)
+
def setFirstWeekDay(self, i):
self.firstWeekDay=i
diff --git a/tropical/qt/caldrawer.py b/tropical/qt/caldrawer.py
index 1f8245b..12645f9 100644
--- a/tropical/qt/caldrawer.py
+++ b/tropical/qt/caldrawer.py
@@ -218,7 +218,8 @@ class CalDrawerScene(QGraphicsScene):
b=event.button()
if self.mouseOver>=0 and b==Qt.MouseButton.LeftButton:
event.accept()
- self.selection=self.calState.getMonthDays()[self.mouseOver]
+ s=self.calState.getMonthDays()[self.mouseOver]
+ self.calState.setSelection(s[0],s[1],s[2])
event = QEvent(DaySelectedEvent)
QCoreApplication.postEvent(self.parent, event)
diff --git a/tropical/qt/designer/MainWindow.ui b/tropical/qt/designer/MainWindow.ui
index f36edc4..bc8c1a6 100644
--- a/tropical/qt/designer/MainWindow.ui
+++ b/tropical/qt/designer/MainWindow.ui
@@ -54,6 +54,9 @@
File
+
+
+
@@ -87,6 +93,26 @@
Create
+
+
+ Edit
+
+
+
+
+ Visibility
+
+
+
+
+ Import
+
+
+
+
+ Exit
+
+
diff --git a/tropical/qt/eventdrawer.py b/tropical/qt/eventdrawer.py
index 6b9af44..1d52bb8 100644
--- a/tropical/qt/eventdrawer.py
+++ b/tropical/qt/eventdrawer.py
@@ -24,7 +24,7 @@ class EvtDrawerScene(QGraphicsScene):
self.env=env
self.eventsRect=list()
self.eventsList=list()
- self.setDay(self.env.calState.today())
+ self.calStateChanged()
def drawForeground(self, painter, rect):
self.eventsRect.clear()
@@ -62,9 +62,10 @@ class EvtDrawerScene(QGraphicsScene):
r=self.eventsRect[i]
painter.drawText(r.x(),r.y()+labelH,"Hello event")
- def setDay(self, day):
- self.eventsList=self.env.listEventsOn(day[0],day[1],day[2])
- self.update()
+ def calStateChanged(self):
+ s=self.env.calState.selection
+ self.eventsList=self.env.listEventsOn(s[0],s[1],s[2])
+ self.update()
class EvtDrawer():
@@ -87,5 +88,5 @@ class EvtDrawer():
# self.gv.setSizePolicy(spLeft);
layout.addWidget(self.gv)
- def setDay(self,day):
- self.gs.setDay(day)
+ def calStateChanged(self):
+ self.gs.calStateChanged()
diff --git a/tropical/qt/mainwindow.py b/tropical/qt/mainwindow.py
index 2805683..499b0da 100644
--- a/tropical/qt/mainwindow.py
+++ b/tropical/qt/mainwindow.py
@@ -26,7 +26,7 @@ class MainWindow(QMainWindow):
def event(self, event):
if event.type() == DaySelectedEvent:
- self.evtDrawer.setDay(self.calDrawer.getSelection())
+ self.evtDrawer.calStateChanged()
return QWidget.event(self,event) #super().event(event)
def StartApplication(env):