summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Guégan <loic.guegan@mailbox.org>2024-09-19 10:49:35 +0200
committerLoïc Guégan <loic.guegan@mailbox.org>2024-09-19 10:49:35 +0200
commit8e24a71ea79f5ef6edeb7621916fd29f138176a1 (patch)
treef5554aa87b5440311e5d73139be06ef7bc29de38
parentf02e224d757c1098cff503a14322a004e8cccfe3 (diff)
Minor changes
-rw-r--r--tropical/calstate.py4
-rw-r--r--tropical/qt/caldrawer.py3
-rw-r--r--tropical/qt/designer/MainWindow.ui26
-rw-r--r--tropical/qt/eventdrawer.py13
-rw-r--r--tropical/qt/mainwindow.py2
5 files changed, 40 insertions, 8 deletions
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 @@
<property name="title">
<string>File</string>
</property>
+ <addaction name="actionImport"/>
+ <addaction name="separator"/>
+ <addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuAbout">
<property name="title">
@@ -65,6 +68,9 @@
<string>Calendars</string>
</property>
<addaction name="actionCreate"/>
+ <addaction name="actionEdit"/>
+ <addaction name="separator"/>
+ <addaction name="actionVisibility"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuCalendars"/>
@@ -87,6 +93,26 @@
<string>Create</string>
</property>
</action>
+ <action name="actionEdit">
+ <property name="text">
+ <string>Edit</string>
+ </property>
+ </action>
+ <action name="actionVisibility">
+ <property name="text">
+ <string>Visibility</string>
+ </property>
+ </action>
+ <action name="actionImport">
+ <property name="text">
+ <string>Import</string>
+ </property>
+ </action>
+ <action name="actionExit">
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
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):