summaryrefslogtreecommitdiff
path: root/tropical/qt
diff options
context:
space:
mode:
Diffstat (limited to 'tropical/qt')
-rw-r--r--tropical/qt/eventdrawer.py17
-rw-r--r--tropical/qt/mainwindow.py10
2 files changed, 18 insertions, 9 deletions
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.