Exemple #1
0
	def displayEntity(self, entityType, x, y):
		"""
		This method creates a pixmap in the map for each desired entity of the map.
		"""
		entityType = str(entityType)
		if entityType not in self._pixmaps.keys():
			self._pixmaps[entityType] = list()

		rect = QtGui.QGraphicsRectItem(x, y, 1, 1, None, self._imageScene)
		rect.setBrush(QtGui.QBrush(color.getColorFromConfig(entityType, color.COLOR_BRUSH)))
		rect.setPen(QtGui.QPen(color.getColorFromConfig(entityType, color.COLOR_PEN)))
		self._pixmaps[entityType].append(rect)
Exemple #2
0
	def displayStartCell(self, x, y):
		"""
		Here the start cell is displayed in the map, as a new pixmap
		"""
		if 'start-cell' in self._pixmaps.keys():
			self._imageScene.removeItem(self._pixmaps['start-cell'])
			self._pixmaps['start-cell'] = None

		rect = QtGui.QGraphicsRectItem(x, y, 1, 1, None, self._imageScene)
		rect.setBrush(QtGui.QBrush(color.getColorFromConfig('start-cell', color.COLOR_BRUSH)))
		rect.setPen(QtGui.QPen(color.getColorFromConfig('start-cell', color.COLOR_PEN)))
		self._pixmaps['start-cell'] = rect
Exemple #3
0
	def selectCell(self, x, y):
		"""
		This method is called when the record mode is enabled and a cell of
		the map is clicked. At this moment, the cell is highlighted with a
		black border arround it.
		"""
		if self._selectedCellRect is not None:
			self.unselectCell()

		self._selectedCellRect = QtGui.QGraphicsRectItem(x, y, 1, 1, None, self._imageScene)
		self._selectedCellRect.setBrush(QtGui.QBrush(color.getColorFromConfig('selected-cell', color.COLOR_BRUSH)))
		self._selectedCellRect.setPen(QtGui.QPen(color.getColorFromConfig('selected-cell', color.COLOR_PEN)))