def autodelete(self): item = self.sender() for charaplaced in self.charaslist: if(charaplaced[2] == item): command = cmd.CommandDelChara("deleted chara", self, (charaplaced[1][0], charaplaced[1][1]),charaplaced[0]) cmd.commandToStack(command) break
def changeTileType(self, changeTypeTo): command = cmd.CommandCTTileType(self.parent, self.sender(), self.parent.myMap, self.parent.myTileSet.tileset, self.currentLayer, changeTypeTo, "change tile") cmd.commandToStack(command)
def mapResize(self): myMapResizeDialog = editor_mainwindow_menus.MapResizeDialog(self) if myMapResizeDialog.exec_() == QtWidgets.QDialog.Accepted: resize = myMapResizeDialog.getValue() command = cmd.CommandResizeMap("Resize Map", self.myMap, self.myMapWidget, self.myCharasPalWidget, resize['width'], resize['height'], resize['offsetx'], resize['offsety']) cmd.commandToStack(command)
def autodelete(self): item = self.sender() for charaplaced in self.charaslist: if (charaplaced[2] == item): command = cmd.CommandDelChara( "deleted chara", self, (charaplaced[1][0], charaplaced[1][1]), charaplaced[0]) cmd.commandToStack(command) break
def toolBucketFill(self, changeTypeTo): listToChange = tools_logic.tileFill( self.sender().tileX, self.sender().tileY, self.parent.myMap.LayersMapTiles[self.currentLayer], changeTypeTo) command = cmd.CommandCGroupTType(self.parent, self.sender(), self.parent.myMap, self.parent.myTileSet.tileset, self.currentLayer, changeTypeTo, listToChange, "bucket fill") cmd.commandToStack(command)
def toolRect(self, changeTypeTo, firstX, firstY): listToChange = tools_logic.tileRect( firstX, firstY, self.sender().tileX, self.sender().tileY, self.parent.myMap.LayersMapTiles[self.currentLayer], changeTypeTo) command = cmd.CommandCGroupTType(self.parent, self.sender(), self.parent.myMap, self.parent.myTileSet.tileset, self.currentLayer, changeTypeTo, listToChange, "rectangle") cmd.commandToStack(command)
def actionListChanged(self, previous_actions, current_actions, what, description): #Let's get the event when somethingChanged in the actionsList if (len(self.EventsList.selectedItems()) > 0): event = self.EventsList.selectedItems()[0].whatsThis() else: return command = cmd.CommandEventAction(description, self, event, current_actions, previous_actions, what) cmd.commandToStack(command)
def actionListChanged(self, previous_actions,current_actions,what,description): #Let's get the event when somethingChanged in the actionsList if(len(self.EventsList.selectedItems())>0): event = self.EventsList.selectedItems()[0].whatsThis() else: return command = cmd.CommandEventAction(description, self, event, current_actions, previous_actions, what) cmd.commandToStack(command)
def toolRect(self, changeTypeTo, firstX, firstY): listToChange = tools_logic.tileRect(firstX, firstY, self.sender().tileX, self.sender( ).tileY, self.parent.myMap.LayersMapTiles[self.currentLayer], changeTypeTo) command = cmd.CommandCGroupTType(self.parent, self.sender( ), self.parent.myMap, self.parent.myTileSet.tileset, self.currentLayer, changeTypeTo, listToChange, "rectangle") cmd.commandToStack(command)
def toolBucketFill(self, changeTypeTo): listToChange = tools_logic.tileFill(self.sender().tileX, self.sender( ).tileY, self.parent.myMap.LayersMapTiles[self.currentLayer], changeTypeTo) command = cmd.CommandCGroupTType(self.parent, self.sender( ), self.parent.myMap, self.parent.myTileSet.tileset, self.currentLayer, changeTypeTo, listToChange, "bucket fill") cmd.commandToStack(command)
def changeTileType(self, changeTypeTo, sender = None): if(sender == None): sender = self.sender() command = cmd.CommandCTTileType(self.parent, sender, self.parent.myMap, self.parent.myTileSet.tileset, self.currentLayer, changeTypeTo, "change tile") cmd.commandToStack(command)
def ClickedATileinMap(self, theClickedTool, ev): global firstClickX global firstClickY if theClickedTool == 0: # pen # this points are here to allow click and hold with the map editor pos_qpoint = ev.pos() self.prevPenPos = (int(math.floor(pos_qpoint.x()/(32.0*self.myScale+self.gridpx))), int(math.floor(pos_qpoint.y()/(32.0*self.myScale+self.gridpx)))) self.penTileXY = self.sender().tileX, self.sender().tileY if(self.currentLayer == COLLISIONLAYER): self.changeTileType(self.currentCollision) elif(self.currentLayer == EVENTSLAYER): self.changeTileType(self.currentEvent) else: self.changeTileType(self.currentTile) elif theClickedTool == 1: # dropper if(self.currentLayer == COLLISIONLAYER): self.parent.changeCollisionCurrent( self.sender().tileType[COLLISIONLAYER]) elif(self.currentLayer == EVENTSLAYER): self.parent.changeEventCurrent( self.sender().tileType[EVENTSLAYER]) else: self.parent.changeTileCurrent( self.sender().tileType[self.currentLayer]) elif theClickedTool == 2: # bucket if(self.currentLayer == COLLISIONLAYER): self.toolBucketFill(self.currentCollision) elif(self.currentLayer == EVENTSLAYER): self.toolBucketFill(self.currentEvent) else: self.toolBucketFill(self.currentTile) if theClickedTool == 3: # line if firstClickX is None: firstClickX = self.sender().tileX firstClickY = self.sender().tileY else: if(self.currentLayer == COLLISIONLAYER): self.toolLine(self.currentCollision, firstClickX, firstClickY) elif(self.currentLayer == EVENTSLAYER): self.toolLine(self.currentEvent, firstClickX, firstClickY) else: self.toolLine(self.currentTile, firstClickX, firstClickY) firstClickX = None firstClickY = None elif theClickedTool == 4: # rectangle if firstClickX is None: firstClickX = self.sender().tileX firstClickY = self.sender().tileY else: if(self.currentLayer == COLLISIONLAYER): self.toolRect(self.currentCollision, firstClickX, firstClickY) elif(self.currentLayer == EVENTSLAYER): self.toolRect(self.currentEvent, firstClickX, firstClickY) else: self.toolRect(self.currentTile, firstClickX, firstClickY) firstClickX = None firstClickY = None elif theClickedTool == 5: # charaplacer charaX = self.sender().tileX charaY = self.sender().tileY command = cmd.CommandAddChara("place chara", self.parent.myCharasPalWidget, (charaX, charaY)) cmd.commandToStack(command) elif theClickedTool == 6: # pan self.setPanning(ev) else: firstClickX = None firstClickY = None
def ClickedATileinMap(self, theClickedTool, ev): global firstClickX global firstClickY if theClickedTool == 0: # pen if (self.currentLayer == COLISIONLAYER): self.changeTileType(self.currentColision) elif (self.currentLayer == EVENTSLAYER): self.changeTileType(self.currentEvent) else: self.changeTileType(self.currentTile) elif theClickedTool == 1: # dropper if (self.currentLayer == COLISIONLAYER): self.parent.changeColisionCurrent( self.sender().tileType[COLISIONLAYER]) elif (self.currentLayer == EVENTSLAYER): self.parent.changeEventCurrent( self.sender().tileType[EVENTSLAYER]) else: self.parent.changeTileCurrent( self.sender().tileType[self.currentLayer]) elif theClickedTool == 2: # bucket if (self.currentLayer == COLISIONLAYER): self.toolBucketFill(self.currentColision) elif (self.currentLayer == EVENTSLAYER): self.toolBucketFill(self.currentEvent) else: self.toolBucketFill(self.currentTile) if theClickedTool == 3: # line if firstClickX is None: firstClickX = self.sender().tileX firstClickY = self.sender().tileY else: if (self.currentLayer == COLISIONLAYER): self.toolLine(self.currentColision, firstClickX, firstClickY) elif (self.currentLayer == EVENTSLAYER): self.toolLine(self.currentEvent, firstClickX, firstClickY) else: self.toolLine(self.currentTile, firstClickX, firstClickY) firstClickX = None firstClickY = None elif theClickedTool == 4: # rectangle if firstClickX is None: firstClickX = self.sender().tileX firstClickY = self.sender().tileY else: if (self.currentLayer == COLISIONLAYER): self.toolRect(self.currentColision, firstClickX, firstClickY) elif (self.currentLayer == EVENTSLAYER): self.toolRect(self.currentEvent, firstClickX, firstClickY) else: self.toolRect(self.currentTile, firstClickX, firstClickY) firstClickX = None firstClickY = None elif theClickedTool == 5: # charaplacer charaX = self.sender().tileX charaY = self.sender().tileY command = cmd.CommandAddChara("place chara", self.parent.myCharasPalWidget, (charaX, charaY)) cmd.commandToStack(command) elif theClickedTool == 6: # pan self.mousePos = ev.pos() else: firstClickX = None firstClickY = None