mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Added classes for sub windows. (WIP)
This commit is contained in:
parent
9a73c78705
commit
6b5f77c415
@ -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()
|
||||
23
qt_ui/windows/QBaseMenu.py
Normal file
23
qt_ui/windows/QBaseMenu.py
Normal 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)
|
||||
17
qt_ui/windows/QBriefingWindow.py
Normal file
17
qt_ui/windows/QBriefingWindow.py
Normal 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)
|
||||
17
qt_ui/windows/QDebriefingWindow.py
Normal file
17
qt_ui/windows/QDebriefingWindow.py
Normal 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)
|
||||
Loading…
x
Reference in New Issue
Block a user