def __init__(self, **kwargs): #super().__init__(parent, **kwargs) ActionDialog.__init__(self, **kwargs) self.initFile = game_init.openInitFile(self.gamefolder) self.setWindowTitle('Select map to teleport...') self.LabelText = QtWidgets.QLabel('Select where to teleport:') self.comboBox = QtWidgets.QComboBox() if (self.nothis is False): self.levelsList = ["this"] else: self.levelsList = [] for level in self.initFile['LevelsList']: self.levelsList.append(level) for level in self.levelsList: self.comboBox.addItem(str(level)) self.scrollArea = QtWidgets.QScrollArea() if (self.nothis is False): self.currentLevel = self.myMap self.currentTileSet = self.myMap.parent.myTileSet else: self.currentLevel = mapfile.MapFormat() self.currentLevel.load( game_init.getLevelPathFromInitFile(self.gamefolder, self.comboBox.itemText(0))) self.currentTileSet = tile_set.TileSet( os.path.join(current_project.settings["gamefolder"], self.currentLevel.tileImage), self.currentLevel.palette) self.myMiniMapWidget = miniWdgt.MiniMapWidget(self.currentLevel, self.currentTileSet, None, 0) self.scrollArea.setWidget(self.myMiniMapWidget) self.buttonBox = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self.comboBox.currentIndexChanged.connect(self.updateMap) self.VBox.addWidget(self.LabelText) self.VBox.addWidget(self.comboBox) self.VBox.addWidget(self.scrollArea) self.VBox.addWidget(self.buttonBox) self.setGeometry(300, 200, 350, 650) if (self.edit != None): for idx, val in enumerate(self.levelsList): if (val == self.edit[0]): self.comboBox.setCurrentIndex(idx) break self.updateMap(idx)
def __init__(self, **kwargs): #if selectStartPosition is here, we should not pass it along self.selectStartPosition = kwargs.pop('selectStartPosition', None) #super().__init__(parent, **kwargs) ActionDialog.__init__(self, **kwargs) self.initFile = game_init.openInitFile(self.gamefolder) if (self.selectStartPosition == None): self.setWindowTitle('Select where to teleport...') indicative = 1 else: self.setWindowTitle(self.selectStartPosition) indicative = 2 self.LabelText = QtWidgets.QLabel('Select where to teleport:') self.comboBox = QtWidgets.QComboBox() if (self.nothis is False): self.levelsList = ["this"] else: self.levelsList = [] for level in self.initFile['LevelsList']: self.levelsList.append(level) for level in self.levelsList: self.comboBox.addItem(str(level)) self.scrollArea = QtWidgets.QScrollArea() if (self.nothis is False): if (self.selectStartPosition == None): self.currentLevel = self.myMap self.currentTileSet = self.myMap.parent.myTileSet else: self.currentLevel = self.parent.myMap self.currentTileSet = self.parent.myTileSet else: self.currentLevel = mapfile.MapFormat() self.currentLevel.load( game_init.getLevelPathFromInitFile(self.gamefolder, self.comboBox.itemText(0))) self.currentTileSet = tile_set.TileSet( os.path.join(current_project.settings["gamefolder"], self.currentLevel.tileImage), self.currentLevel.palette) self.myMiniMapWidget = miniWdgt.MiniMapWidget(self.currentLevel, self.currentTileSet, None, indicative) self.scrollArea.setWidget(self.myMiniMapWidget) self.myMiniMapWidget.selectedTile.connect(self.setTeleportPlace) self.LineText = QtWidgets.QLineEdit() self.buttonBox = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self.comboBox.currentIndexChanged.connect(self.updateMap) self.LineText.setReadOnly(True) self.VBox.addWidget(self.LabelText) self.VBox.addWidget(self.comboBox) self.VBox.addWidget(self.scrollArea) self.VBox.addWidget(self.LineText) self.VBox.addWidget(self.buttonBox) self.setGeometry(300, 200, 350, 650) if (self.edit != None): self.LineText.setText("{0};{1}".format(self.edit[0], self.edit[1])) for idx, val in enumerate(self.levelsList): if (val == self.edit[2]): self.comboBox.setCurrentIndex(idx) break self.updateMap(idx) self.myMiniMapWidget.changeSelectXY(int(self.edit[0]), int(self.edit[1]))
def __init__(self, **kwargs): #super().__init__(parent, **kwargs) ActionDialog.__init__(self, **kwargs) self.initFile = game_init.openInitFile(self.gamefolder) self.useCurrentPlace = "current" self.LabelText1 = QtWidgets.QLabel("Select the map for tile change:") self.LabelText2 = QtWidgets.QLabel("What type to change from?") self.LabelText3 = QtWidgets.QLabel("To what type change to?") self.LabelText4 = QtWidgets.QLabel("Change to modify collision layer:") self.LabelText5 = QtWidgets.QLabel( "Select if event should also change:") self.levelSelector = miniWdgt.levelSelector(nothis=self.nothis) self.collisionList = ["keep", "nocollision", "collidable"] self.scrollArea = QtWidgets.QScrollArea() if (self.nothis is False): self.currentLevel = self.myMap self.currentTileSet = self.myMap.parent.myTileSet else: self.currentLevel = mapfile.MapFormat() self.currentLevel.load( game_init.getLevelPathFromInitFile( self.gamefolder, self.levelSelector.itemText(0))) self.currentTileSet = tile_set.TileSet( os.path.join(current_project.settings["gamefolder"], self.currentLevel.tileImage), self.currentLevel.palette) self.myMiniMapWidget = miniWdgt.MiniMapWidget(self.currentLevel, self.currentTileSet, self, indicativeToUse=0) self.eventList = self.currentLevel.getTileListFromLayer(EVENTSLAYER)[:] self.eventList.insert(0, "remove") self.eventList.insert(0, "keep") self.eventList = [str(x) for x in self.eventList] self.scrollArea.setWidget(self.myMiniMapWidget) self.oriMPWidget = miniWdgt.MiniPaletteWidget(self.currentTileSet, self) self.newMPWidget = miniWdgt.MiniPaletteWidget(self.currentTileSet, self) self.comboBoxLayers = QtWidgets.QComboBox() for layer in mapfile.LayersNameViewable: self.comboBoxLayers.addItem(str(layer)) self.comboBoxCollision = QtWidgets.QComboBox() for item in self.collisionList: self.comboBoxCollision.addItem(str(item)) self.comboBoxEvent = QtWidgets.QComboBox() for item in self.eventList: self.comboBoxEvent.addItem(str(item)) self.levelSelector.currentIndexChanged.connect(self.updateMap) if (self.edit != None): self.levelSelector.edit(self.edit[5]) self.oriMPWidget.setImageCurrent(int(self.edit[0])) self.newMPWidget.setImageCurrent(int(self.edit[1])) for idx, val in enumerate(mapfile.LayersNameViewable): if (val == self.edit[2]): self.comboBoxLayers.setCurrentIndex(idx) for idx, val in enumerate(self.collisionList): if (val == self.edit[3]): self.comboBoxCollision.setCurrentIndex(idx) for idx, val in enumerate(self.eventList): if (val == self.edit[4]): self.comboBoxEvent.setCurrentIndex(idx) self.VBox.addWidget(self.LabelText1) self.VBox.addWidget(self.levelSelector) self.VBox.addWidget(self.scrollArea) self.VBox.addWidget(self.LabelText2) self.VBox.addWidget(self.oriMPWidget) self.VBox.addWidget(self.LabelText3) self.VBox.addWidget(self.newMPWidget) self.VBox.addWidget(self.comboBoxLayers) self.VBox.addWidget(self.LabelText4) self.VBox.addWidget(self.comboBoxCollision) self.VBox.addWidget(self.LabelText5) self.VBox.addWidget(self.comboBoxEvent) self.setGeometry(300, 200, 350, 650) self.setWindowTitle( 'changeAllTiles: Select what tile and where to change to...')
def __init__(self, **kwargs): #super().__init__(parent, **kwargs) ActionDialog.__init__(self, **kwargs) self.initFile = game_init.openInitFile(self.gamefolder) self.useCurrentPlace = "current" self.LabelText1 = QtWidgets.QLabel( "Select where is the tile to change:") self.LabelText2 = QtWidgets.QLabel("Select to what type change:") self.LabelText3 = QtWidgets.QLabel("Change to modify colision layer:") self.LabelText4 = QtWidgets.QLabel( "Select if event should also change:") self.comboBox = QtWidgets.QComboBox() self.colisionList = ["keep", "noColision", "collidable"] if (self.nothis is False): self.levelsList = ["this"] else: self.levelsList = [] for level in self.initFile['LevelsList']: self.levelsList.append(level) for level in self.levelsList: self.comboBox.addItem(str(level)) self.scrollArea = QtWidgets.QScrollArea() if (self.nothis is False): self.currentLevel = self.myMap self.currentTileSet = self.myMap.parent.myTileSet else: self.currentLevel = mapfile.MapFormat() self.currentLevel.load( game_init.getLevelPathFromInitFile(self.gamefolder, self.comboBox.itemText(0))) self.currentTileSet = tile_set.TileSet( os.path.join(current_project.settings["gamefolder"], self.currentLevel.tileImage), self.currentLevel.palette) self.myMiniMapWidget = miniWdgt.MiniMapWidget(self.currentLevel, self.currentTileSet, self) self.eventList = self.currentLevel.getTileListFromLayer(EVENTSLAYER)[:] self.eventList.insert(0, "remove") self.eventList.insert(0, "keep") self.eventList = [str(x) for x in self.eventList] self.checkbox = QtWidgets.QCheckBox("instead use event location", self) self.scrollArea.setWidget(self.myMiniMapWidget) self.myMiniMapWidget.selectedTile.connect(self.setTeleportPlace) self.LineTextPlace = QtWidgets.QLineEdit() self.myMiniPaletteWidget = miniWdgt.MiniPaletteWidget( self.currentTileSet, self) self.myMiniPaletteWidget.selectedTilePalette.connect( self.setTileToChange) self.LineTextTile = QtWidgets.QLineEdit() self.comboBoxLayers = QtWidgets.QComboBox() for layer in mapfile.LayersNameViewable: self.comboBoxLayers.addItem(str(layer)) self.comboBoxColision = QtWidgets.QComboBox() for item in self.colisionList: self.comboBoxColision.addItem(str(item)) self.comboBoxEvent = QtWidgets.QComboBox() for item in self.eventList: self.comboBoxEvent.addItem(str(item)) self.buttonBox = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self.comboBox.currentIndexChanged.connect(self.updateMap) self.checkbox.stateChanged.connect(self.checkboxChanged) self.checkbox.setCheckState(QtCore.Qt.Checked) self.LineTextPlace.setReadOnly(True) self.LineTextTile.setReadOnly(True) if (self.edit != None): self.myMiniPaletteWidget.setImageCurrent(int(self.edit[0])) for idx, val in enumerate(mapfile.LayersNameViewable): if (val == self.edit[1]): self.comboBoxLayers.setCurrentIndex(idx) for idx, val in enumerate(self.colisionList): if (val == self.edit[2]): self.comboBoxColision.setCurrentIndex(idx) for idx, val in enumerate(self.eventList): if (val == self.edit[3]): self.comboBoxEvent.setCurrentIndex(idx) if (self.edit[4] != self.useCurrentPlace): self.checkbox.setCheckState(QtCore.Qt.Unchecked) self.LineTextPlace.setText("{0};{1};{2}".format( self.edit[4], self.edit[5], self.edit[6])) for idx, val in enumerate(self.levelsList): if (val == self.edit[6]): self.comboBox.setCurrentIndex(idx) self.myMiniMapWidget.changeSelectXY(int(self.edit[4]), int(self.edit[5])) else: self.checkbox.setCheckState(QtCore.Qt.Checked) self.VBox.addWidget(self.LabelText1) self.VBox.addWidget(self.comboBox) self.VBox.addWidget(self.scrollArea) self.VBox.addWidget(self.LineTextPlace) self.VBox.addWidget(self.checkbox) self.VBox.addWidget(self.LabelText2) self.VBox.addWidget(self.myMiniPaletteWidget) self.VBox.addWidget(self.LineTextTile) self.VBox.addWidget(self.comboBoxLayers) self.VBox.addWidget(self.LabelText3) self.VBox.addWidget(self.comboBoxColision) self.VBox.addWidget(self.LabelText4) self.VBox.addWidget(self.comboBoxEvent) self.VBox.addWidget(self.buttonBox) self.setGeometry(300, 200, 350, 650) self.setWindowTitle('Select what tile and where to change to...') self.setTileToChange()
def __init__(self, **kwargs): #if selectStartPosition is here, we should not pass it along self.selectStartPosition = kwargs.pop('selectStartPosition', None) #super().__init__(parent, **kwargs) ActionDialog.__init__(self, **kwargs) self.initFile = game_init.openInitFile(self.gamefolder) if (self.selectStartPosition == None): self.setWindowTitle('teleport: Select where to teleport...') indicative = 1 else: self.setWindowTitle(self.selectStartPosition) indicative = 2 self.LabelText = QtWidgets.QLabel('Select where to teleport:') self.levelSelector = miniWdgt.levelSelector(nothis=self.nothis) self.scrollArea = QtWidgets.QScrollArea() if (self.nothis is False): if (self.selectStartPosition == None): self.currentLevel = self.myMap self.currentTileSet = self.myMap.parent.myTileSet else: self.currentLevel = self.parent.myMap self.currentTileSet = self.parent.myTileSet else: self.currentLevel = mapfile.MapFormat() self.currentLevel.load( game_init.getLevelPathFromInitFile( self.gamefolder, self.levelSelector.itemText(0))) self.currentTileSet = tile_set.TileSet( os.path.join(current_project.settings["gamefolder"], self.currentLevel.tileImage), self.currentLevel.palette) self.myMiniMapWidget = miniWdgt.MiniMapWidget(self.currentLevel, self.currentTileSet, None, indicative) self.scrollArea.setWidget(self.myMiniMapWidget) self.myMiniMapWidget.selectedTile.connect(self.setTeleportPlace) self.LineText = QtWidgets.QLineEdit() self.levelSelector.currentIndexChanged.connect(self.updateMap) self.LineText.setReadOnly(True) self.VBox.addWidget(self.LabelText) self.VBox.addWidget(self.levelSelector) self.VBox.addWidget(self.scrollArea) self.VBox.addWidget(self.LineText) self.setGeometry(300, 200, 350, 650) if (self.edit != None): self.LineText.setText("{0};{1}".format(self.edit[0], self.edit[1])) self.levelSelector.edit(self.edit[2]) self.myMiniMapWidget.changeSelectXY(int(self.edit[0]), int(self.edit[1]))