Minor changes
This commit is contained in:
parent
1b97acaa87
commit
08c3a724ee
4 changed files with 22 additions and 13 deletions
|
@ -23,6 +23,7 @@ class CalType(Enum):
|
||||||
|
|
||||||
|
|
||||||
class Env:
|
class Env:
|
||||||
|
__VERSION__ = "0.1"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# Config directory
|
# Config directory
|
||||||
|
@ -55,6 +56,5 @@ class Env:
|
||||||
if e["start"] >=start and e["start"] <= end:
|
if e["start"] >=start and e["start"] <= end:
|
||||||
events.append(e)
|
events.append(e)
|
||||||
# TODO: Account for repeat
|
# TODO: Account for repeat
|
||||||
|
return events
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,11 @@ class EvtQGraphicsView(QGraphicsView):
|
||||||
|
|
||||||
|
|
||||||
class EvtDrawerScene(QGraphicsScene):
|
class EvtDrawerScene(QGraphicsScene):
|
||||||
def __init__(self, calState):
|
def __init__(self, calState, env):
|
||||||
self.gridWidth=2
|
self.gridWidth=2
|
||||||
super().__init__(None)
|
super().__init__(None)
|
||||||
self.calState=calState
|
self.calState=calState
|
||||||
|
self.env=env
|
||||||
|
|
||||||
def drawForeground(self, painter, rect):
|
def drawForeground(self, painter, rect):
|
||||||
origXF, origYF, widthF, heightF = rect.getRect()
|
origXF, origYF, widthF, heightF = rect.getRect()
|
||||||
|
@ -36,13 +37,21 @@ class EvtDrawerScene(QGraphicsScene):
|
||||||
pen.setJoinStyle(Qt.PenJoinStyle.MiterJoin)
|
pen.setJoinStyle(Qt.PenJoinStyle.MiterJoin)
|
||||||
po=int(self.gridWidth/2) # Pen offset
|
po=int(self.gridWidth/2) # Pen offset
|
||||||
painter.setPen(pen)
|
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():
|
class EvtDrawer():
|
||||||
|
|
||||||
def __init__(self, layout, calState):
|
def __init__(self, layout, calState, env):
|
||||||
self.gs=EvtDrawerScene(calState)
|
self.gs=EvtDrawerScene(calState, env)
|
||||||
self.gv=EvtQGraphicsView(self.gs)
|
self.gv=EvtQGraphicsView(self.gs)
|
||||||
# Setup propertion
|
# Setup propertion
|
||||||
spLeft=QSizePolicy(QSizePolicy.Policy.Preferred,QSizePolicy.Policy.Preferred);
|
spLeft=QSizePolicy(QSizePolicy.Policy.Preferred,QSizePolicy.Policy.Preferred);
|
||||||
|
|
|
@ -14,11 +14,11 @@ import sys, os
|
||||||
|
|
||||||
class MainWindow(QMainWindow):
|
class MainWindow(QMainWindow):
|
||||||
|
|
||||||
def __init__(self,uipath, calState):
|
def __init__(self,uipath, calState, env):
|
||||||
super(MainWindow,self).__init__()
|
super(MainWindow,self).__init__()
|
||||||
uic.loadUi(uipath+"/MainWindow.ui",self)
|
uic.loadUi(uipath+"/MainWindow.ui",self)
|
||||||
self.calDrawer=CalDrawer(self, self.calContainer.layout(),calState)
|
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.calState=calState
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class MainWindow(QMainWindow):
|
||||||
return QWidget.event(self,event) #super().event(event)
|
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"
|
path = os.path.dirname(os.path.abspath(__file__))+"/designer"
|
||||||
# You need one (and only one) QApplication instance per application.
|
# You need one (and only one) QApplication instance per application.
|
||||||
# Pass in sys.argv to allow command line arguments for your app.
|
# Pass in sys.argv to allow command line arguments for your app.
|
||||||
|
@ -39,8 +39,8 @@ def StartApplication(version,calState):
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
# Create a Qt widget, which will be our window.
|
# Create a Qt widget, which will be our window.
|
||||||
window = MainWindow(path, calState)
|
window = MainWindow(path, calState, env)
|
||||||
window.setVersion(version)
|
window.setVersion(env.__VERSION__)
|
||||||
window.show() # IMPORTANT!!!!! Windows are hidden by default.
|
window.show() # IMPORTANT!!!!! Windows are hidden by default.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import qt.mainwindow as QtCalanus
|
||||||
from calstate import CalState
|
from calstate import CalState
|
||||||
from env import Env
|
from env import Env
|
||||||
|
|
||||||
__VERSION__ = "0.1"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,5 +16,5 @@ if __name__ == '__main__':
|
||||||
env=Env()
|
env=Env()
|
||||||
env.listEventsOn(2024,10,1)
|
env.listEventsOn(2024,10,1)
|
||||||
calState=CalState()
|
calState=CalState()
|
||||||
QtCalanus.StartApplication(__VERSION__,calState)
|
QtCalanus.StartApplication(env,calState)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue