summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Guégan <loic.guegan@mailbox.org>2024-09-17 14:35:38 +0200
committerLoïc Guégan <loic.guegan@mailbox.org>2024-09-17 14:35:38 +0200
commit08c3a724eed0b0a2b20de5a72e772ebccf747abc (patch)
tree82897d38d44f72b7d7cf849581fb5ed4eca227d6
parent1b97acaa87a8e8740381573bd3d994344b008043 (diff)
Minor changes
-rw-r--r--tropical/env.py4
-rw-r--r--tropical/qt/eventdrawer.py17
-rw-r--r--tropical/qt/mainwindow.py10
-rwxr-xr-xtropical/tropical.py4
4 files changed, 22 insertions, 13 deletions
diff --git a/tropical/env.py b/tropical/env.py
index 59ac509..834f7e2 100644
--- a/tropical/env.py
+++ b/tropical/env.py
@@ -23,6 +23,7 @@ class CalType(Enum):
class Env:
+ __VERSION__ = "0.1"
def __init__(self):
# Config directory
@@ -55,6 +56,5 @@ class Env:
if e["start"] >=start and e["start"] <= end:
events.append(e)
# TODO: Account for repeat
-
-
+ return events
diff --git a/tropical/qt/eventdrawer.py b/tropical/qt/eventdrawer.py
index 4afcf55..07ba449 100644
--- a/tropical/qt/eventdrawer.py
+++ b/tropical/qt/eventdrawer.py
@@ -18,10 +18,11 @@ class EvtQGraphicsView(QGraphicsView):
class EvtDrawerScene(QGraphicsScene):
- def __init__(self, calState):
+ def __init__(self, calState, env):
self.gridWidth=2
super().__init__(None)
self.calState=calState
+ self.env=env
def drawForeground(self, painter, rect):
origXF, origYF, widthF, heightF = rect.getRect()
@@ -36,13 +37,21 @@ class EvtDrawerScene(QGraphicsScene):
pen.setJoinStyle(Qt.PenJoinStyle.MiterJoin)
po=int(self.gridWidth/2) # Pen offset
painter.setPen(pen)
+ # Init Brush
+ brush=QtGui.QBrush()
+ brush.setColor(QtGui.QColor("#e5e5e5"))
+ brush.setStyle(Qt.BrushStyle.SolidPattern)
+ painter.setBrush(brush)
- painter.drawRect(x+po,y+po,width-po*2,height-po*2)
+ eventHeight=80
+ colorWidth=20
+ for e in self.env.listEventsOn(2024,10,1):
+ painter.drawRect(x+po,y+po,width-po*2,eventHeight-po*2)
class EvtDrawer():
- def __init__(self, layout, calState):
- self.gs=EvtDrawerScene(calState)
+ def __init__(self, layout, calState, env):
+ self.gs=EvtDrawerScene(calState, env)
self.gv=EvtQGraphicsView(self.gs)
# Setup propertion
spLeft=QSizePolicy(QSizePolicy.Policy.Preferred,QSizePolicy.Policy.Preferred);
diff --git a/tropical/qt/mainwindow.py b/tropical/qt/mainwindow.py
index 83a92da..c2662f3 100644
--- a/tropical/qt/mainwindow.py
+++ b/tropical/qt/mainwindow.py
@@ -14,11 +14,11 @@ import sys, os
class MainWindow(QMainWindow):
- def __init__(self,uipath, calState):
+ def __init__(self,uipath, calState, env):
super(MainWindow,self).__init__()
uic.loadUi(uipath+"/MainWindow.ui",self)
self.calDrawer=CalDrawer(self, self.calContainer.layout(),calState)
- self.evtDrawer=EvtDrawer(self.calContainer.layout(),calState)
+ self.evtDrawer=EvtDrawer(self.calContainer.layout(),calState, env)
self.calState=calState
self.show()
@@ -31,7 +31,7 @@ class MainWindow(QMainWindow):
return QWidget.event(self,event) #super().event(event)
-def StartApplication(version,calState):
+def StartApplication(env,calState):
path = os.path.dirname(os.path.abspath(__file__))+"/designer"
# You need one (and only one) QApplication instance per application.
# Pass in sys.argv to allow command line arguments for your app.
@@ -39,8 +39,8 @@ def StartApplication(version,calState):
app = QApplication(sys.argv)
# Create a Qt widget, which will be our window.
- window = MainWindow(path, calState)
- window.setVersion(version)
+ window = MainWindow(path, calState, env)
+ window.setVersion(env.__VERSION__)
window.show() # IMPORTANT!!!!! Windows are hidden by default.
diff --git a/tropical/tropical.py b/tropical/tropical.py
index 13281b3..5b81203 100755
--- a/tropical/tropical.py
+++ b/tropical/tropical.py
@@ -6,7 +6,7 @@ import qt.mainwindow as QtCalanus
from calstate import CalState
from env import Env
-__VERSION__ = "0.1"
+
@@ -16,5 +16,5 @@ if __name__ == '__main__':
env=Env()
env.listEventsOn(2024,10,1)
calState=CalState()
- QtCalanus.StartApplication(__VERSION__,calState)
+ QtCalanus.StartApplication(env,calState)