def editNpc(self, npc): """ Method called when the user double clicks on a npc in the list. """ row = self._npcWidget.getRowValues(npc) self.selectCell(row['x'], row['y']) dialog = formNpcDialog(self, self._app, row=row) dialog.entityUpdated.connect(self.unselectCell) dialog.entityUpdated.connect(self.refreshEntity) dialog.entityUpdated.connect(self._npcWidget.setData) dialog.entityUpdated.connect(self._app.flagAsUnsaved)
def addNpc(self, x, y): """ Method called when the user click on a cell in the map to add a NPC. """ if not self._app.map.isCellOnLand((x, y)): self.alert(_('ERROR_NPC_IN_WATER')) return dialog = formNpcDialog(self, self._app, coordinates=(x, y)) dialog.entityAdded.connect(self.unselectCell) dialog.entityAdded.connect(self.displayEntity) dialog.entityAdded.connect(self._npcWidget.setData) dialog.entityAdded.connect(self._app.flagAsUnsaved) self.disableRecordingMode()