Exemple #1
0
 def __init__(self, host, action):
     """
     :param ConstituentNode host:
     :param string action:
     """
     UIGraphicsItem.__init__(self, host=host)
     QtWidgets.QGraphicsObject.__init__(self)
     self._dragging = False
     self._path = None
     self.start_point = None
     self.end_point = None
     self.setZValue(160)
     self.status_tip = ""
     # Drawing flags defaults
     self._fill_path = False
     self._align_left = False
     self._below_node = False
     self.focusable = True
     self._visible = True
     self._hovering = False
     self._drag_hint = False
     self.setAcceptHoverEvents(True)
     self.setAcceptDrops(True)
     self.update_end_points()
     self.action = action
     self.setFlag(QtWidgets.QGraphicsObject.ItemIsSelectable)
     self.setCursor(QtCore.Qt.PointingHandCursor)
     if action:
         action.connect_element(self)
     if action and action.tip:
         self.set_tip(action.tip)
Exemple #2
0
 def __init__(self, host, action):
     """
     :param ConstituentNode host:
     :param string action:
     """
     UIGraphicsItem.__init__(self, host=host)
     QtWidgets.QGraphicsObject.__init__(self)
     self._dragging = False
     self._path = None
     self.start_point = None
     self.end_point = None
     self.z_value = 160
     self.setZValue(self.z_value)
     self.status_tip = ""
     # Drawing flags defaults
     self._fill_path = False
     self._align_left = False
     self._below_node = False
     self.focusable = True
     self._visible = True
     self._hovering = False
     self._drag_hint = False
     self.setAcceptHoverEvents(True)
     self.setAcceptDrops(True)
     self.update_end_points()
     self.action = action
     self.setFlag(QtWidgets.QGraphicsObject.ItemIsSelectable)
     self.setCursor(QtCore.Qt.PointingHandCursor)
     if action:
         action.connect_element(self)
     if action and action.tip:
         self.set_tip(action.tip_with_shortcut())
Exemple #3
0
 def __init__(self, role=0, ui_key=None):
     QtWidgets.QGraphicsRectItem.__init__(self, QtCore.QRectF(0, 0, 4, 4))  # , scene = parent)
     UIGraphicsItem.__init__(self, ui_key=ui_key)
     self.role = int(role)
     self.setZValue(100)
     self.setBrush(ctrl.cm.get('accent%s' % str(self.role + 1)))
     self.setPen(qt_prefs.no_pen)  # QtCore.Qt.NoPen
     self.setPos(5 + self.role * 10, 5)
Exemple #4
0
 def __init__(self, role=0, ui_key=None):
     QtWidgets.QGraphicsRectItem.__init__(self, QtCore.QRectF(
         0, 0, 4, 4))  # , scene = parent)
     UIGraphicsItem.__init__(self, ui_key=ui_key)
     self.role = int(role)
     self.setZValue(100)
     self.setBrush(ctrl.cm.get('accent%s' % str(self.role + 1)))
     self.setPen(qt_prefs.no_pen)  # QtCore.Qt.NoPen
     self.setPos(5 + self.role * 10, 5)
Exemple #5
0
 def __init__(self, scene_pos, embed):
     UIGraphicsItem.__init__(self)
     QtWidgets.QGraphicsItem.__init__(self)
     self.start_point = None
     self.end_point = None
     self.embed = embed
     self.update_position(scene_pos=scene_pos)
     self.start_point_cp = MarkerStartPoint(self)
     self.start_point_cp.show()
Exemple #6
0
 def __init__(self, scene_pos, embed):
     UIGraphicsItem.__init__(self)
     QtWidgets.QGraphicsItem.__init__(self)
     self.start_point = None
     self.end_point = None
     self.embed = embed
     self.update_position(scene_pos=scene_pos)
     self.start_point_cp = MarkerStartPoint(self)
     self.start_point_cp.show()
     self.dragged = False
Exemple #7
0
 def __init__(self, symbol, host, place='bottom_right'):
     UIGraphicsItem.__init__(self, host=host)
     QtWidgets.QGraphicsObject.__init__(self)
     self.inner = QtWidgets.QGraphicsPixmapItem()
     self.inner.setParentItem(self)
     self.inner.setPixmap(symbol)
     self.place = place
     self.update_position()
     self._fade_anim = None
     self.setZValue(72)
     self.show()
     self.setOpacity(1.0)
Exemple #8
0
    def __init__(self, edge, index=-1, role=''):
        UIGraphicsItem.__init__(self, host=edge, role=role)
        QtWidgets.QGraphicsItem.__init__(self)
        print('creating control_point, role is: ', role)
        if prefs.touch:
            self._wh = 12
            self._xy = -6
            self.round = True
            self.setCursor(Qt.PointingHandCursor)
        else:
            self._wh = 4
            self._xy = -2
            self.round = True
            self.setCursor(Qt.CrossCursor)
        self._index = index
        self.focusable = True
        self.pressed = False
        self._hovering = False
        self.being_dragged = False
        self.setAcceptHoverEvents(True)
        self.setFlag(QtWidgets.QGraphicsObject.ItemIsMovable)
        self.setFlag(QtWidgets.QGraphicsObject.ItemIsSelectable)

        self.setZValue(52)
        self._compute_position()
        self.status_tip = ""
        if self.role == g.START_POINT:
            self.status_tip = "Drag to move the starting point"
        elif self.role == g.END_POINT:
            self.status_tip = "Drag to move the ending point"
        elif self.role == g.CURVE_ADJUSTMENT:
            self.status_tip = "Drag to adjust the curvature of this line"
        elif self.role == g.LABEL_START:
            self.status_tip = "Drag along the line to adjust the anchor point of label"
            if prefs.touch:
                self._wh = 6
                self._xy = -3

        if ctrl.main.use_tooltips:
            self.setToolTip(self.status_tip)
        self.show()
Exemple #9
0
    def __init__(self, edge, index=-1, role=''):
        UIGraphicsItem.__init__(self, host=edge, role=role)
        QtWidgets.QGraphicsItem.__init__(self)
        print('creating control_point, role is: ', role)
        if prefs.touch:
            self._wh = 12
            self._xy = -6
            self.round = True
            self.setCursor(Qt.PointingHandCursor)
        else:
            self._wh = 4
            self._xy = -2
            self.round = True
            self.setCursor(Qt.CrossCursor)
        self._index = index
        self.focusable = True
        self.pressed = False
        self._hovering = False
        self.being_dragged = False
        self.setAcceptHoverEvents(True)
        self.setFlag(QtWidgets.QGraphicsObject.ItemIsMovable)
        self.setFlag(QtWidgets.QGraphicsObject.ItemIsSelectable)

        self.setZValue(52)
        self._compute_position()
        self.status_tip = ""
        if self.role == g.START_POINT:
            self.status_tip = "Drag to move the starting point"
        elif self.role == g.END_POINT:
            self.status_tip = "Drag to move the ending point"
        elif self.role == g.CURVE_ADJUSTMENT:
            self.status_tip = "Drag to adjust the curvature of this line"
        elif self.role == g.LABEL_START:
            self.status_tip = "Drag along the line to adjust the anchor point of label"
            if prefs.touch:
                self._wh = 6
                self._xy = -3

        if ctrl.main.use_tooltips:
            self.setToolTip(self.status_tip)
        self.show()
Exemple #10
0
 def __init__(self, host, click_action='', click_kwargs=None, drop_action='', drop_kwargs=None):
     """
     :param ConstituentNode host:
     :param string click_action: str, action to call when clicking toucharea
     :param dict click_kwargs: args to add to click_action call
     :param string drop_action: str, action to call when dropping something into
     :param dict drop_kwargs: args to add to drop_action call
     """
     UIGraphicsItem.__init__(self, host=host)
     QtWidgets.QGraphicsObject.__init__(self)
     self._dragging = False
     self._path = None
     self.start_point = None
     self.end_point = None
     self.z_value = 160
     self.setZValue(self.z_value)
     # Drawing flags defaults
     self._fill_path = False
     self._align_left = self.__class__.align_left
     self._below_node = False
     self.focusable = True
     self._visible = True
     self._hovering = False
     self._drag_hint = False
     self.setAcceptHoverEvents(True)
     self.setAcceptDrops(True)
     self.update_end_points()
     self.click_action = click_action
     self.click_kwargs = click_kwargs or {}
     self.drop_action = drop_action
     self.drop_kwargs = drop_kwargs or {}
     self.setFlag(QtWidgets.QGraphicsObject.ItemIsSelectable)
     self.setCursor(QtCore.Qt.PointingHandCursor)
     self.setCacheMode(QtWidgets.QGraphicsItem.DeviceCoordinateCache)
     if click_action and isinstance(click_action, str):
         action_obj = ctrl.ui.get_action(click_action)
         if action_obj:
             action_obj.connect_element(self)
     self.update_end_points()