Fixed crash
All checks were successful
Build Dusk / build-linux (push) Successful in 51s
Build Dusk / build-psp (push) Successful in 56s

This commit is contained in:
2025-11-16 17:24:54 -06:00
parent 1b741a81e5
commit ae941a0fdb
12 changed files with 215 additions and 225 deletions

View File

@@ -4,38 +4,39 @@ from PyQt5.QtCore import Qt
from editortool.map.glwidget import GLWidget
from editortool.map.chunkpanel import ChunkPanel
from editortool.map.mapinfopanel import MapInfoPanel
from editortool.map.mapdata import MapData
from editortool.map.toolbar import MapToolbar
from editortool.map.menubar import MapMenubar
from editortool.map.statusbar import StatusBar
from editortool.map.map import Map
from editortool.map.mapdefs import TILE_WIDTH, TILE_HEIGHT, TILE_DEPTH
from editortool.map.selectbox import SelectBox
from editortool.map.camera import Camera
from editortool.map.grid import Grid
class MapWindow(QMainWindow):
def __init__(self):
super().__init__()
# Subclasses
self.mapData = MapData()
self.map = Map(self)
self.camera = Camera(self)
self.grid = Grid()
self.selectBox = SelectBox(self)
# Window setup
self.setWindowTitle("Dusk Map Editor")
self.resize(1280, 720)
# Components
self.toolbar = MapToolbar(self)
# Menubar (TESTING)
self.menubar = MapMenubar(self)
central = QWidget()
self.setCentralWidget(central)
mainLayout = QHBoxLayout(central)
# Left panel (ChunkPanel)
self.chunkPanel = ChunkPanel(self)
leftWidget = QWidget()
leftWidget.setLayout(self.chunkPanel.layout())
leftWidget.setFixedWidth(200)
mainLayout.addWidget(leftWidget)
self.chunkPanel.setFixedWidth(200)
mainLayout.addWidget(self.chunkPanel)
# Center panel (GLWidget + controls)
self.glWidget = GLWidget(self)
@@ -52,21 +53,15 @@ class MapWindow(QMainWindow):
self.setStatusBar(self.statusBar)
self.installEventFilter(self)
self._install_event_filter_recursive(self)
self.installEventFilterRecursively(self)
def _install_event_filter_recursive(self, widget):
def installEventFilterRecursively(self, widget):
for child in widget.findChildren(QWidget):
child.installEventFilter(self)
self._install_event_filter_recursive(child)
def generateData(self):
objOut = {}
self.fileSaving.invoke(objOut)
self.mapData.data = objOut
return objOut
self.installEventFilterRecursively(child)
def closeEvent(self, event):
if not self.mapData.isDirty():
if not self.map.isDirty():
event.accept()
return
@@ -79,7 +74,7 @@ class MapWindow(QMainWindow):
)
if reply == QMessageBox.Save:
self.saveFile()
if self.mapData.isDirty():
if self.map.isDirty():
event.ignore()
return
elif reply == QMessageBox.Cancel: