Added classes for sub windows. (WIP)

This commit is contained in:
Khopa 2019-07-05 22:01:16 +02:00
parent 9a73c78705
commit 6b5f77c415
5 changed files with 70 additions and 2 deletions

View File

@ -1,7 +1,9 @@
from PySide2.QtCore import QLine
from PySide2.QtGui import QColor, QPainter, QCursor, QTextItem, QPen
from PySide2.QtWidgets import QGraphicsRectItem, QGraphicsSceneHoverEvent, QGraphicsSceneContextMenuEvent, QMenu
from PySide2.QtWidgets import QGraphicsRectItem, QGraphicsSceneHoverEvent, QGraphicsSceneContextMenuEvent, QMenu, \
QAction
from qt_ui.windows.QBaseMenu import QBaseMenu
from theater import ControlPoint
import qt_ui.uiconstants as CONST
@ -49,9 +51,14 @@ class QMapControlPoint(QGraphicsRectItem):
def contextMenuEvent(self, event: QGraphicsSceneContextMenuEvent):
# TODO : improve this and add contextual actions (just a placholder for now)
openBaseMenu = QAction("Open base menu")
openBaseMenu.triggered.connect(self.openBaseMenu)
menu = QMenu("Menu", self.parent)
menu.addAction("Plan a strike on " + self.model.name + " airbase")
menu.addAction("See available intel")
menu.addAction(openBaseMenu)
menu.exec_(event.screenPos())
@ -67,4 +74,8 @@ class QMapControlPoint(QGraphicsRectItem):
if self.parent.game.player_country == "USA":
return self.model.captured and CONST.COLORS["dark_blue"] or CONST.COLORS["bright_red"]
else:
return self.model.captured and CONST.COLORS["bright_red"] or CONST.COLORS["dark_blue"]
return self.model.captured and CONST.COLORS["bright_red"] or CONST.COLORS["dark_blue"]
def openBaseMenu(self):
window = QBaseMenu(self.window(), self.model)
window.show()

View File

@ -0,0 +1,23 @@
from PySide2.QtCore import Qt
from PySide2.QtGui import QWindow
from PySide2.QtWidgets import QHBoxLayout, QLabel, QWidget
from theater import ControlPoint
class QBaseMenu(QWidget):
def __init__(self, parent, controlPoint: ControlPoint):
super(QBaseMenu, self).__init__(parent)
self.cp = controlPoint
self.setWindowFlags(Qt.WindowStaysOnTopHint)
self.initUi()
def initUi(self):
layout = QHBoxLayout()
layout.addWidget(QLabel("TODO : This will be the base menu"))
layout.addWidget(QLabel(self.cp.name + " Base Info"))
central_widget = QWidget()
central_widget.setLayout(layout)
self.setLayout(layout)

View File

@ -0,0 +1,17 @@
from PySide2.QtGui import QWindow
from PySide2.QtWidgets import QHBoxLayout, QLabel, QWidget
class QBriefingWindow(QWindow):
def __init__(self, parent):
super(QBriefingWindow, self).__init__(parent)
self.initUi()
def initUi(self):
layout = QHBoxLayout()
layout.addWidget(QLabel("TODO : This will be the briefing window"))
central_widget = QWidget()
central_widget.setLayout(layout)
self.setCentralWidget(central_widget)

View File

@ -0,0 +1,17 @@
from PySide2.QtGui import QWindow
from PySide2.QtWidgets import QHBoxLayout, QLabel, QWidget
class QDebriefingWindow(QWindow):
def __init__(self, parent):
super(QDebriefingWindow, self).__init__(parent)
self.initUi()
def initUi(self):
layout = QHBoxLayout()
layout.addWidget(QLabel("TODO : This will be the debriefing menu"))
central_widget = QWidget()
central_widget.setLayout(layout)
self.setCentralWidget(central_widget)