def _finish_add_display(self): self.unregister_handler(self.home_map_scene, QEvent.GraphicsSceneMouseRelease) self.unregister_handler(self.home_map_scene, QEvent.GraphicsSceneMousePress) name = self.current_op_stat["name"] p = self.current_op_stat["position"] port = self.current_op_stat["port"] temp = TemperatureItem() temp.setTemperature(0) temp.setPos(p) temp.setToolTip(name) self.home_map_scene.addItem(temp) HMItem.name(temp, name) HMItem.module(temp, self.__class__.__name__) HMItem.type(temp, HMItem.ARTIFACT) HMItem.level(temp, self.home_map_scene.current_level) HMItem.ports(temp, "In", [port]) item_key = "name_%d" % (len(self.home_module.artifacts)) self.home_module.artifacts[item_key] = temp self.current_op = "" self.current_op_stat = None
def _finish_add_area(self): poligon = QPolygonF( self.current_op_stat['points']) pol = QGraphicsPolygonItem(poligon) pol.setToolTip(self.current_op_stat['name']) pol.setPen(QPen(Qt.black, 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin)) HMItem.type(pol,HMItem.MAP_AREA) HMItem.select(pol,False) HMItem.name(pol,self.current_op_stat['name']) HMItem.level(pol, self.home_map_scene.current_level) pol.setVisible(True) pol.setZValue(1) self.home_map_scene.addItem(pol) print "flags %x" % pol.flags() it_remove = QGraphicsPolygonItem() HMItem.module( it_remove, self.__class__.__name__) HMItem.type(it_remove,HMItem.OUTLINE_POINT) self.home_map_scene.remove_by_item(it_remove) self.current_op = '' self.current_op_stat = None