mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Removed some dead code.
This commit is contained in:
@@ -15,7 +15,6 @@ from game.event import UnitsDeliveryEvent, Event, ControlPointType
|
||||
from gen import Conflict
|
||||
from qt_ui.widgets.map.QLiberationScene import QLiberationScene
|
||||
from qt_ui.widgets.map.QMapControlPoint import QMapControlPoint
|
||||
from qt_ui.widgets.map.QMapEvent import QMapEvent
|
||||
from qt_ui.widgets.map.QMapGroundObject import QMapGroundObject
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
from theater import ControlPoint
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
from PySide2.QtGui import QPen, Qt
|
||||
from PySide2.QtWidgets import QGraphicsRectItem, QGraphicsSceneMouseEvent, QGraphicsSceneHoverEvent
|
||||
|
||||
import qt_ui.uiconstants as CONST
|
||||
from game.event import Event, UnitsDeliveryEvent
|
||||
from qt_ui.windows.QBriefingWindow import QBriefingWindow
|
||||
|
||||
|
||||
class QMapEvent(QGraphicsRectItem):
|
||||
|
||||
def __init__(self, parent, x: float, y: float, w: float, h: float, gameEvent: Event):
|
||||
super(QMapEvent, self).__init__(x, y, w, h)
|
||||
self.gameEvent = gameEvent
|
||||
self.parent = parent
|
||||
self.setAcceptHoverEvents(True)
|
||||
self.setZValue(2)
|
||||
self.setToolTip(str(self.gameEvent))
|
||||
self.playable = not isinstance(self.gameEvent, UnitsDeliveryEvent)
|
||||
|
||||
|
||||
|
||||
def paint(self, painter, option, widget=None):
|
||||
|
||||
playerColor = self.game.get_player_color()
|
||||
enemyColor = self.game.get_enemy_color()
|
||||
|
||||
if self.parent.get_display_rule("events"):
|
||||
painter.save()
|
||||
|
||||
if self.gameEvent.is_player_attacking:
|
||||
painter.setPen(QPen(brush=CONST.COLORS[playerColor]))
|
||||
painter.setBrush(CONST.COLORS[playerColor])
|
||||
else:
|
||||
painter.setPen(QPen(brush=CONST.COLORS[enemyColor]))
|
||||
painter.setBrush(CONST.COLORS[enemyColor])
|
||||
|
||||
if self.isUnderMouse() and self.playable:
|
||||
painter.setBrush(CONST.COLORS["white"])
|
||||
|
||||
painter.drawRect(option.rect)
|
||||
painter.drawPixmap(option.rect, CONST.EVENT_ICONS[self.gameEvent.__class__])
|
||||
painter.restore()
|
||||
|
||||
def mousePressEvent(self, event:QGraphicsSceneMouseEvent):
|
||||
if self.parent.get_display_rule("events"):
|
||||
self.openBriefing()
|
||||
|
||||
def hoverEnterEvent(self, event: QGraphicsSceneHoverEvent):
|
||||
self.update()
|
||||
if self.playable:
|
||||
self.setCursor(Qt.PointingHandCursor)
|
||||
|
||||
def openBriefing(self):
|
||||
if self.playable:
|
||||
self.briefing = QBriefingWindow(self.gameEvent)
|
||||
self.briefing.show()
|
||||
Reference in New Issue
Block a user