def __init__(self, x, y, diameter, parent=None, ID=None): QGraphicsEllipseItem.__init__(self, x, y, diameter, diameter, parent) self.setBrush(Qt.white) self._ref = references.textReference(ID) self.setToolTip(references.tooltip(self._ref)) self.setPen(QPen(Qt.black, 2)) self.setAcceptHoverEvents(True)
def __init__(self, model_virtual_helix, part_item): """ Args: id_num (int): VirtualHelix ID number. See `NucleicAcidPart` for description and related methods. part_item (cadnano.gui.views.sliceview.nucleicacidpartitem.NucleicAcidPartItem): the part item """ AbstractVirtualHelixItem.__init__(self, model_virtual_helix, part_item) QGraphicsEllipseItem.__init__(self, parent=part_item) self._controller = VirtualHelixItemController(self, self._model_part, False, True) self.hide() model_part = self._model_part x, y = model_part.locationQt(self._id_num, part_item.scaleFactor()) # set position to offset for radius # self.setTransformOriginPoint(_RADIUS, _RADIUS) self.setCenterPos(x, y) self.wedge_gizmos = {} self._added_wedge_gizmos = set() # self._prexo_gizmos = [] self.setAcceptHoverEvents(True) self.setZValue(_ZVALUE) # handle the label specific stuff self._label = self.createLabel() self.setNumber() self.old_pen = None self.is_active = False self.updateAppearance() self.show() self._right_mouse_move = False
def __init__(self, sur): QGraphicsEllipseItem.__init__(self) self.setRect(0, 0, 20 * min, 20 * min) self.setBrush(QBrush(Qt.cyan)) self.surowiec = sur self.ikona = QGraphicsPixmapItem() self.ikona.setParentItem(self) self.ikona.setPixmap(self.wybor().scaled(20 * x, 20 * x))
def __init__(self, *args): QGraphicsEllipseItem.__init__(self, *args) self.setRect(-3, -3, 6, 6) self.setPen(QPen(Qt.NoPen)) self.normalBrush = QBrush(QColor("#9CACB4")) self.hoverBrush = QBrush(QColor("#7D7D7D")) self.setBrush(self.normalBrush) self.__hover = False
def __init__(self, x, y, diameter, parent=None, ID=None, important=False): QGraphicsEllipseItem.__init__(self, x, y, diameter, diameter, parent) self.setBrush(Qt.white) self._ref = references.textReference(ID) self.setToolTip(references.tooltip(self._ref)) self.setPen(QPen(Qt.black, 2)) self.setAcceptHoverEvents(True) if important: self.setBrush(Qt.black)
def __init__(self, parent): QGraphicsEllipseItem.__init__(self, QRectF(-4, -4, 8, 8), parent) self.parent = parent self.setPos(self.parent.w, self.parent.h) self.setBrush(Qt.transparent) p1 = QPen() p1.setStyle(Qt.DotLine) self.setPen(p1) self.setFlags(self.ItemIsSelectable | self.ItemIsMovable) self.setFlag(self.ItemSendsScenePositionChanges, True)
def __init__(self, x, y, w, h): QGraphicsEllipseItem.__init__(self, x, y, w, h) self._creation = True self._min = 0.0 self._max = 0.0 self._x = x self._y = y self._value = 0.0 self._focused = False
def __init__(self, id, graphicsGraphView): # Parent constructor(s) GraphicsNode.__init__(self, id, graphicsGraphView) QGraphicsEllipseItem.__init__(self) # Init text node self.graphicsTextNode.setParentItem(self) self.setFlags(QGraphicsItem.ItemIsMovable | QGraphicsItem.ItemIsSelectable) self.centerTextInShape()
def __init__(self, name, parent=None): QGraphicsEllipseItem.__init__(self, QRectF(-4, -4, 8.0, 8.0), parent) self.parent_block = parent self.setCursor(QCursor(QtCore.Qt.CrossCursor)) # Properties: self.setBrush(QBrush(Qt.red)) # Name: self.name = name self.posCallbacks = [] self.setFlag(self.ItemSendsScenePositionChanges, True)
def __init__(self, label = ""): QGraphicsEllipseItem.__init__(self) self.text = label self.textItem = GraphicsTextItem(self.text, parent = self) self.textItem.setTextInteractionFlags(Qt.TextEditorInteraction) self.setRect(self.textItem.boundingRect().marginsAdded(QMarginsF(10,10,10,10))) self.setFlags(QGraphicsItem.ItemIsSelectable) self.observers = set() self.edgeInConstruction = None
def __init__(self, label=""): QGraphicsEllipseItem.__init__(self) self.text = label self.textItem = GraphicsTextItem(self.text, parent=self) self.textItem.setTextInteractionFlags(Qt.TextEditorInteraction) self.setRect(self.textItem.boundingRect().marginsAdded( QMarginsF(10, 10, 10, 10))) self.setFlags(QGraphicsItem.ItemIsSelectable) self.observers = set() self.edgeInConstruction = None
def __init__(self, x1, y1, x2, y2): QGraphicsEllipseItem.__init__(self, x1, y1, x2, y2) self.point_to = 0 self.point_from = 0 self.path_point = 0 self.path_point_to = 0 self.tbl = QTableWidget(1, 2) item = QTableWidgetItem("0:00") self.tbl.setItem(0, 0, item) item = QTableWidgetItem("0:00") self.tbl.setItem(0, 1, item) self.tbl.setFixedWidth(219) item = QTableWidgetItem("time of origin") self.tbl.setHorizontalHeaderItem(0, item) item = QTableWidgetItem("path time") self.tbl.setHorizontalHeaderItem(1, item)
def __init__(self, obj, parent=None, scene=None,\ brush=QBrush(), pen=QPen(Qt.blue, 0, Qt.SolidLine)) : """Adds QGraphics(Rect)Item to the scene. Parameters obj : QPointF or shape type e.g. QRectF obj is QPointF - shape parameters are defined at first mouse click obj is QRectF - it will be drawn as is """ logger.debug('In DragEllipse') rect = obj if isinstance(obj, QRectF) else\ QRectF(obj, obj + QPointF(5,5)) if isinstance(obj, QPointF) else\ None if rect is None: logger.warning('DragEllipse - wrong init object type:', str(obj)) return self._dragtype = ELLIPSE parent_for_base = None QGraphicsEllipseItem.__init__(self, rect, parent_for_base) #DragBase.__init__(self, parent, brush, pen) # is called inside QGraphicsEllipseItem logger.debug('In DragEllipse - superclass initialization is done') if isinstance(obj, QPointF): self._drag_mode = ADD logger.debug('set elf._drag_mode = ADD, ADD:%d _drag_mode:%d' % (ADD, self._drag_mode)) if scene is not None: scene.addItem(self) if self._drag_mode == ADD: self.grabMouse() # makes available mouseMoveEvent logger.debug('In DragEllipse mode grabMouse()') self.setAcceptHoverEvents(True) #self.setAcceptTouchEvents(True) self.setAcceptedMouseButtons(Qt.LeftButton) self.setPen(self._pen_pos) self.setBrush(self._brush) # Flags: ItemIsPanel, ItemClipsChildrenToShape, ItemIsSelectable, # ItemIsMovable, itemClipsToShape, ItemSendsScenePositionChanges self.setFlags(self.ItemIsSelectable)
def __init__(self, name, side, parent): self.parent = parent self.logger = parent.logger self.name = name self.side = side self.createdAtSide = side self.posCallbacks = [] self.connectionList = [] self.id = self.parent.parent.parent().idGen.getID() self.color = "white" self.ashColorR = QColor(239, 57, 75) self.ashColorB = QColor(20, 83, 245) QGraphicsEllipseItem.__init__(self, QRectF(-4, -4, 7.0, 7.0), parent) self.innerCircle = QGraphicsEllipseItem(-4, -4, 6, 6, self) self.innerCircle.setPen(QPen(QColor(0, 0, 0, 0), 0)) self.visibleColor = QColor(0, 0, 0) # This if is only for input/output having different colors if name == "i": self.innerCircle.setBrush(self.visibleColor) if name == "o": self.innerCircle.setBrush(self.visibleColor) self.setCursor(QCursor(QtCore.Qt.CrossCursor)) # self.setCursor(QCursor(QtCore.Qt.PointingHandCursor)) # The Port itself is larger than only the innerCircle self.setBrush(QBrush(QtCore.Qt.white)) # Hacky fix for no border of ellipse p1 = QPen(QColor(0, 0, 0, 0), 0) self.setPen(p1) self.setFlag(self.ItemSendsScenePositionChanges, True) self.setAcceptHoverEvents(True) # QUndo framework related self.savePos = None self.savedPos = False
def __init__(self, name, rect=QRectF(0, 0, 20, 20), parent=None): QGraphicsEllipseItem.__init__(self, rect, parent) self.setX(random.randrange(0, 1000, 1)) self.setY(random.randrange(0, 300, 1)) self.edges = [] self.setZValue(2) self.brush_color = QColor(153, 153, 153) self.setBrush(self.brush_color) self.setPen(QPen(Qt.NoPen)) self.setFlags(QGraphicsItem.ItemIsMovable | QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemSendsGeometryChanges) self.text = QGraphicsTextItem(name) self.text.setDefaultTextColor(self.brush_color) self.text.setPos(-float(len(self.text.toPlainText())), -20.0) self.text.setParentItem(self) self.screen = ''
def __init__(self, tag=None, zvalue=1000, relative=False, **kwargs): QGraphicsEllipseItem.__init__(self, **kwargs) #: Signal to be emitted when the PointHandle is moved. #: #: **slot args:** (`dx`, `dy`), #: where `dx` and `dy` are displacements along *x* and *y*, #: in scene coordinates. self.signal_moved = Signal() #: Signal emitted when an `ItemSelectedChange` occurs. #: #: **slot args:** (:obj:`boolean`) self.signal_selected_change = Signal() self.relative = relative self.setFlag(QGraphicsItem.ItemIsMovable, True) self.setFlag(QGraphicsItem.ItemIsSelectable, True) # needed to handle move event self.setFlag(QGraphicsItem.ItemSendsGeometryChanges, True) if not relative: self.setFlag(QGraphicsItem.ItemSendsScenePositionChanges, True) # keep same size when zooming # then we need to map position from scene to device in itemChange self.setFlag(QGraphicsItem.ItemIgnoresTransformations, True) # zvalue should be higher than rays, # otherwise the ray takes focus before its handle self.setZValue(zvalue) # radius (in pixels) r = 4 # circle is centered on (0, 0) in item coordinates self.setRect(-r, -r, 2 * r, 2 * r) self.position_before_move = None #: ignore :term:`move restrictions` ? #: Initially True so that the first move, to the initial position, is free #: The user is responsible for setting it back to False, #: to honor the scene setting self.ignore_move_restrictions = True
def __init__(self, landmark, *args, **kwargs): self._landmark = landmark QGraphicsEllipseItem.__init__(self, *args, **kwargs) self.setFlags(QGraphicsItem.ItemIsMovable | QGraphicsItem.ItemSendsGeometryChanges | QGraphicsItem.ItemSendsScenePositionChanges)
def __init__(self, x, y): QGraphicsEllipseItem.__init__(self, x, y, self.RADIUS_DAMAGE, self.RADIUS_DAMAGE) self.recharge = self.RECHARGE_ITER self.goal = None