diff --git a/qt_ui/widgets/map/QMapControlPoint.py b/qt_ui/widgets/map/QMapControlPoint.py index 63b3076a..2949b88e 100644 --- a/qt_ui/widgets/map/QMapControlPoint.py +++ b/qt_ui/widgets/map/QMapControlPoint.py @@ -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"] \ No newline at end of file + 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() \ No newline at end of file diff --git a/qt_ui/windows/BriefingWindow.py b/qt_ui/windows/BriefingWindow.py deleted file mode 100644 index e69de29b..00000000 diff --git a/qt_ui/windows/QBaseMenu.py b/qt_ui/windows/QBaseMenu.py new file mode 100644 index 00000000..6fa0d3db --- /dev/null +++ b/qt_ui/windows/QBaseMenu.py @@ -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) \ No newline at end of file diff --git a/qt_ui/windows/QBriefingWindow.py b/qt_ui/windows/QBriefingWindow.py new file mode 100644 index 00000000..dfe3d07a --- /dev/null +++ b/qt_ui/windows/QBriefingWindow.py @@ -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) \ No newline at end of file diff --git a/qt_ui/windows/QDebriefingWindow.py b/qt_ui/windows/QDebriefingWindow.py new file mode 100644 index 00000000..7b3919c7 --- /dev/null +++ b/qt_ui/windows/QDebriefingWindow.py @@ -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) \ No newline at end of file