Пример #1
0
    def __init__(self, rect, parent=None):
        super(QGraphicsEllipseItem, self).__init__(rect, parent)
        self._parent = parent
        self.setPen(getNoPen())

        iw = _ITEM_WIDTH = 3
        x = _RECT.width() - 2*rect_gain - 2*styles.SLICE_HELIX_STROKE_WIDTH - 1
        y = _RECT.center().y()
        prexo_items = {}
        fwd_angles = [0, 240, 120]
        fwd_colors = ['#cc0000', '#00cc00', '#0000cc']
        for i in range(len(fwd_angles)):
            item = QGraphicsEllipseItem(x, y, iw, iw, self)
            item.setPen(getNoPen())
            item.setBrush(getBrushObj(fwd_colors[i]))
            item.setTransformOriginPoint(_RECT.center())
            item.setRotation(fwd_angles[i])
            prexo_items[i] = item

        rev_angles = [150, 30, 270]
        rev_colors = ['#800000cc', '#80cc0000', '#8000cc00']
        # rev_colors = ['#ff00ff', '#3399ff', '#ff6600']
        for i in range(len(fwd_angles)):
            item = QGraphicsEllipseItem(x, y, iw, iw, self)
            item.setPen(getPenObj(rev_colors[i],0.5))
            item.setBrush(getNoBrush())
            item.setTransformOriginPoint(_RECT.center())
            item.setRotation(rev_angles[i])
            prexo_items[i] = item
Пример #2
0
    def resetItem(self, from_virtual_helix_item, is_fwd, from_index,
                  to_vh_id_num, prexoveritemgroup, color):
        """Summary

        Args:
            from_virtual_helix_item (cadnano.gui.views.pathview.virtualhelixitem.VirtualHelixItem): Description
            is_fwd (TYPE): Description
            from_index (TYPE): Description
            to_vh_id_num (TYPE): Description
            prexoveritemgroup (TYPE): Description
            color (TYPE): Description

        Returns:
            TYPE: Description
        """
        self.setParentItem(from_virtual_helix_item)
        self.resetTransform()
        self._id_num = from_virtual_helix_item.idNum()
        self.idx = from_index
        self.is_fwd = is_fwd
        self.to_vh_id_num = to_vh_id_num
        self._color = color
        self.prexoveritemgroup = prexoveritemgroup
        self._bond_item.hide()
        self._label_txt = lbt = None if to_vh_id_num is None else str(
            to_vh_id_num)
        self.setLabel(text=lbt)
        self._label.resetItem(is_fwd, color)

        phos = self._phos_item
        bonditem = self._bond_item

        if is_fwd:
            phos.setPath(FWDPHOS_PP)
            phos.setTransformOriginPoint(0, phos.boundingRect().center().y())
            phos.setPos(0.5 * BASE_WIDTH, BASE_WIDTH)
            phos.setPen(getNoPen())
            phos.setBrush(getBrushObj(color))
            bonditem.setPen(getPenObj(color, styles.PREXOVER_STROKE_WIDTH))
            self.setPos(from_index * BASE_WIDTH, -BASE_WIDTH)
        else:
            phos.setPath(REVPHOS_PP)
            phos.setTransformOriginPoint(0, phos.boundingRect().center().y())
            phos.setPos(0.5 * BASE_WIDTH, 0)
            phos.setPen(getPenObj(color, 0.25))
            phos.setBrush(getNoBrush())
            bonditem.setPen(
                getPenObj(color,
                          styles.PREXOVER_STROKE_WIDTH,
                          penstyle=Qt.DotLine,
                          capstyle=Qt.RoundCap))
            self.setPos(from_index * BASE_WIDTH, 2 * BASE_WIDTH)

        if to_vh_id_num is not None:
            inactive_alpha = PROX_ALPHA
            self.setBrush(getBrushObj(color, alpha=inactive_alpha))
        else:
            self.setBrush(getBrushObj(color, alpha=0))
        self.show()
Пример #3
0
 def shutdown(self):
     """Summary
     """
     self.setBrush(getNoBrush())
     self.to_vh_id_num = None
     self.adapter.resetAnimations()
     self.setAcceptHoverEvents(False)
     self.hide()
Пример #4
0
 def shutdown(self):
     """Summary
     """
     self.setBrush(getNoBrush())
     self.to_vh_id_num = None
     self.adapter.resetAnimations()
     self.setAcceptHoverEvents(False)
     self.hide()
Пример #5
0
    def resetItem(self, from_virtual_helix_item: PathVirtualHelixItemT,
                        is_fwd: bool,
                        from_index: int,
                        nearby_idxs: List[int],
                        to_vh_id_num: int,
                        prexoveritem_manager: PreXoverManagerT):
        """Update this pooled PreXoverItem with current info.
        Called by PreXoverManager.

        Args:
            from_virtual_helix_item: the associated vh_item
            is_fwd: True if associated with fwd strand, False if rev strand
            from_index: idx of associated vh
            nearby_idxs:
            to_vh_id_num: id_num of the other vh
            prexoveritem_manager: the manager
        """
        # to_vh_item = from_virtual_helix_item.partItem().idToVirtualHelixItem(to_vh_id_num)
        self.setParentItem(from_virtual_helix_item)
        # self.setParentItem(to_vh_item)
        self.resetTransform()
        self._id_num = from_virtual_helix_item.idNum()
        self._model_part = from_virtual_helix_item.part()
        self.idx = from_index
        self.is_low = False
        self.is_high = False
        self.nearby_idxs = nearby_idxs
        self.is_fwd = is_fwd
        self.color = None
        self.is3p = None
        self.enter_pos = None
        self.exit_pos = None
        self.to_vh_id_num = to_vh_id_num
        self._label_txt = None
        self.prexoveritem_manager = prexoveritem_manager

        # todo: check here if xover present and disable
        result = self.setPathAppearance(from_virtual_helix_item)

        if result:
            self.setBrush(getNoBrush())
            if is_fwd:
                self.setPos(from_index*BASE_WIDTH, -BASE_WIDTH - 0.1*BASE_WIDTH)
            else:
                self.setPos(from_index*BASE_WIDTH, 2*BASE_WIDTH)
            self.show()
            # label
            self._label_txt = lbt = None if to_vh_id_num is None else str(to_vh_id_num)
            self._label.resetItem(is_fwd, self.color)
            self.setLabel(text=lbt)

            # bond line
            bonditem = self._bond_item
            bonditem.setPen(getPenObj(  self.color,
                                        styles.PREXOVER_STROKE_WIDTH,
                                        penstyle=Qt.DotLine))
            bonditem.hide()
Пример #6
0
    def resetItem(self, from_virtual_helix_item: PathVirtualHelixItemT,
                  is_fwd: bool, from_index: int, nearby_idxs: List[int],
                  to_vh_id_num: int, prexoveritem_manager: PreXoverManagerT):
        """Update this pooled PreXoverItem with current info.
        Called by PreXoverManager.

        Args:
            from_virtual_helix_item: the associated vh_item
            is_fwd: True if associated with fwd strand, False if rev strand
            from_index: idx of associated vh
            nearby_idxs:
            to_vh_id_num: id_num of the other vh
            prexoveritem_manager: the manager
        """
        # to_vh_item = from_virtual_helix_item.partItem().idToVirtualHelixItem(to_vh_id_num)
        self.setParentItem(from_virtual_helix_item)
        # self.setParentItem(to_vh_item)
        self.resetTransform()
        self._id_num = from_virtual_helix_item.idNum()
        self._model_part = from_virtual_helix_item.part()
        self.idx = from_index
        self.is_low = False
        self.is_high = False
        self.nearby_idxs = nearby_idxs
        self.is_fwd = is_fwd
        self.color = None
        self.is3p = None
        self.enter_pos = None
        self.exit_pos = None
        self.to_vh_id_num = to_vh_id_num
        self._label_txt = None
        self.prexoveritem_manager = prexoveritem_manager

        # todo: check here if xover present and disable
        result = self.setPathAppearance(from_virtual_helix_item)

        if result:
            self.setBrush(getNoBrush())
            if is_fwd:
                self.setPos(from_index * BASE_WIDTH,
                            -BASE_WIDTH - 0.1 * BASE_WIDTH)
            else:
                self.setPos(from_index * BASE_WIDTH, 2 * BASE_WIDTH)
            self.show()
            # label
            self._label_txt = lbt = None if to_vh_id_num is None else str(
                to_vh_id_num)
            self._label.resetItem(is_fwd, self.color)
            self.setLabel(text=lbt)

            # bond line
            bonditem = self._bond_item
            bonditem.setPen(
                getPenObj(self.color,
                          styles.PREXOVER_STROKE_WIDTH,
                          penstyle=Qt.DotLine))
            bonditem.hide()
Пример #7
0
 def __init__(self, parent: QGraphicsItem = None):
     """
     Args:
         parent: default is ``None``
     """
     super(PathWorkplaneOutline, self).__init__(parent)
     self.setPen(getNoPen())
     self._path = QGraphicsPathItem(self)
     self._path.setBrush(getNoBrush())
     self._path.setPen(newPenObj(styles.BLUE_STROKE, 0))
Пример #8
0
    def _highlightSpaVH(self, vh_id):
        # TODO[NF]:  Docstring
        if self.spa_start_vhi:
            self.spa_start_vhi.setBrush(getNoBrush())

        if vh_id is None:
            self.spa_start_vhi = None
        else:
            self.spa_start_vhi = self._virtual_helix_item_hash[vh_id]
            self.spa_start_vhi.setBrush(getBrushObj(styles.SPA_START_HINT_COLOR, alpha=32))
Пример #9
0
 def __init__(self, parent: QGraphicsItem = None):
     """
     Args:
         parent: default is ``None``
     """
     super(PathWorkplaneOutline, self).__init__(parent)
     self.setPen(getNoPen())
     self._path = QGraphicsPathItem(self)
     self._path.setBrush(getNoBrush())
     self._path.setPen(newPenObj(styles.BLUE_STROKE, 0))
Пример #10
0
    def resetItem(self, from_virtual_helix_item, is_fwd, from_index,
                  to_vh_id_num, prexoveritemgroup, color):
        """Summary

        Args:
            from_virtual_helix_item (cadnano.gui.views.pathview.virtualhelixitem.VirtualHelixItem): Description
            is_fwd (TYPE): Description
            from_index (TYPE): Description
            to_vh_id_num (TYPE): Description
            prexoveritemgroup (TYPE): Description
            color (TYPE): Description

        Returns:
            TYPE: Description
        """
        self.setParentItem(from_virtual_helix_item)
        self.resetTransform()
        self._id_num = from_virtual_helix_item.idNum()
        self.idx = from_index
        self.is_fwd = is_fwd
        self.to_vh_id_num = to_vh_id_num
        self._color = color
        self.prexoveritemgroup = prexoveritemgroup
        self._bond_item.hide()
        self._label_txt = lbt = None if to_vh_id_num is None else str(to_vh_id_num)
        self.setLabel(text=lbt)
        self._label.resetItem(is_fwd, color)

        phos = self._phos_item
        bonditem = self._bond_item

        if is_fwd:
            phos.setPath(FWDPHOS_PP)
            phos.setTransformOriginPoint(0, phos.boundingRect().center().y())
            phos.setPos(0.5*BASE_WIDTH, BASE_WIDTH)
            phos.setPen(getNoPen())
            phos.setBrush(getBrushObj(color))
            bonditem.setPen(getPenObj(color, styles.PREXOVER_STROKE_WIDTH))
            self.setPos(from_index*BASE_WIDTH, -BASE_WIDTH)
        else:
            phos.setPath(REVPHOS_PP)
            phos.setTransformOriginPoint(0, phos.boundingRect().center().y())
            phos.setPos(0.5*BASE_WIDTH, 0)
            phos.setPen(getPenObj(color, 0.25))
            phos.setBrush(getNoBrush())
            bonditem.setPen(getPenObj(color, styles.PREXOVER_STROKE_WIDTH,
                                      penstyle=Qt.DotLine, capstyle=Qt.RoundCap))
            self.setPos(from_index*BASE_WIDTH, 2*BASE_WIDTH)

        if to_vh_id_num is not None:
            inactive_alpha = PROX_ALPHA
            self.setBrush(getBrushObj(color, alpha=inactive_alpha))
        else:
            self.setBrush(getBrushObj(color, alpha=0))
        self.show()
Пример #11
0
 def showCreateHint(self, id_num=0, show_hint=True, color=None):
     label = self._label
     if show_hint:
         label.setText("%d" % id_num)
         b_rect = label.boundingRect()
         posx = b_rect.width()/2
         posy = b_rect.height()/2
         label.setPos(_RADIUS-posx, _RADIUS-posy)
         self.setBrush(getBrushObj(color if color else styles.MULTI_VHI_HINT_COLOR, alpha=64))
     else:
         label.setText("")
         self.setBrush(getNoBrush())
Пример #12
0
 def showCreateHint(self, id_num: int = 0,
                         show_hint: bool = True,
                         color: str = None):
     label = self._label
     if show_hint:
         label.setText("%d" % id_num)
         b_rect = label.boundingRect()
         posx = b_rect.width()/2
         posy = b_rect.height()/2
         label.setPos(_RADIUS-posx, _RADIUS-posy)
         self.setBrush(getBrushObj(color if color else styles.MULTI_VHI_HINT_COLOR, alpha=64))
     else:
         label.setText("")
         self.setBrush(getNoBrush())
Пример #13
0
    def resetItem(self, from_virtual_helix_item, is_fwd, from_index, nearby_idxs,
                  to_vh_id_num, prexoveritem_manager):
        """Update this pooled PreXoverItem with current info.
        Called by PreXoverManager.

        Args:
            from_virtual_helix_item (cadnano.views.pathview.virtualhelixitem.VirtualHelixItem): the associated vh_item
            is_fwd (bool): True if associated with fwd strand, False if rev strand
            from_index (int): idx of associated vh
            to_vh_id_num (int): id_num of the other vh
            prexoveritem_manager (cadnano.views.pathview.prexoermanager.PreXoverManager): the manager
        """
        self.setParentItem(from_virtual_helix_item)
        self.resetTransform()
        self._id_num = from_virtual_helix_item.idNum()
        self._model_vh = from_virtual_helix_item.cnModel()
        self.idx = from_index
        self.is_low = False
        self.is_high = False
        self.nearby_idxs = nearby_idxs
        self.is_fwd = is_fwd
        self.color = None
        self.is3p = None
        self.enter_pos = None
        self.exit_pos = None
        self.to_vh_id_num = to_vh_id_num
        self.prexoveritem_manager = prexoveritem_manager

        # todo: check here if xover present and disable
        result = self.setPathAppearance(from_virtual_helix_item)

        if result:
            self.setBrush(getNoBrush())
            if is_fwd:
                self.setPos(from_index*BASE_WIDTH, -BASE_WIDTH)
            else:
                self.setPos(from_index*BASE_WIDTH, 2*BASE_WIDTH)
            self.show()
            # label
            self._label_txt = lbt = None if to_vh_id_num is None else str(to_vh_id_num)
            self.setLabel(text=lbt)
            self._label.resetItem(is_fwd, self.color)

            # bond line
            bonditem = self._bond_item
            bonditem.setPen(getPenObj(self.color, styles.PREXOVER_STROKE_WIDTH))
            bonditem.hide()
Пример #14
0
    def enableActive(self, is_active: bool, to_vh_id_num: int = None):
        """Call on PreXoverItems created on the active VirtualHelixItem

        Args:
            is_active: Description
            to_vh_id_num: Default is ``None``
        """
        if is_active:
            self.to_vh_id_num = to_vh_id_num
            self.setAcceptHoverEvents(True)
            if to_vh_id_num is None:
                self.setLabel(text=None)
            else:
                self.setLabel(text=str(to_vh_id_num))
        else:
            self.setBrush(getNoBrush())
            self.setAcceptHoverEvents(False)
Пример #15
0
    def enableActive(self, is_active: bool, to_vh_id_num: int = None):
        """Call on PreXoverItems created on the active VirtualHelixItem

        Args:
            is_active: Description
            to_vh_id_num: Default is ``None``
        """
        if is_active:
            self.to_vh_id_num = to_vh_id_num
            self.setAcceptHoverEvents(True)
            if to_vh_id_num is None:
                self.setLabel(text=None)
            else:
                self.setLabel(text=str(to_vh_id_num))
        else:
            self.setBrush(getNoBrush())
            self.setAcceptHoverEvents(False)
Пример #16
0
    def __init__(self, model_virtual_helix, part_item, viewroot):
        """Summary

        Args:
            id_num (int): VirtualHelix ID number. See `NucleicAcidPart` for description and related methods.
            part_item (TYPE): Description
            viewroot (TYPE): Description
        """
        AbstractVirtualHelixItem.__init__(self, model_virtual_helix, part_item)
        QGraphicsPathItem.__init__(self, parent=part_item.proxy())
        self._viewroot = viewroot
        self._getActiveTool = part_item._getActiveTool
        self._controller = VirtualHelixItemController(self, self._model_part,
                                                      False, True)

        self._handle = VirtualHelixHandleItem(self, part_item, viewroot)
        self._last_strand_set = None
        self._last_idx = None
        self.setFlag(QGraphicsItem.ItemUsesExtendedStyleOption)
        self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
        self.setBrush(getNoBrush())

        view = self.view()
        view.levelOfDetailChangedSignal.connect(self.levelOfDetailChangedSlot)
        should_show_details = view.shouldShowDetails()

        pen = newPenObj(styles.MINOR_GRID_STROKE,
                        styles.MINOR_GRID_STROKE_WIDTH)
        pen.setCosmetic(should_show_details)
        self.setPen(pen)

        self.is_active = False

        self.refreshPath()
        self.setAcceptHoverEvents(True)  # for pathtools
        self.setZValue(styles.ZPATHHELIX)

        self._right_mouse_move = False
        self.drag_last_position = self.handle_start = self.pos()
Пример #17
0
    def __init__(self, model_virtual_helix, part_item, viewroot):
        """Summary

        Args:
            id_num (int): VirtualHelix ID number. See `NucleicAcidPart` for description and related methods.
            part_item (TYPE): Description
            viewroot (TYPE): Description
        """
        AbstractVirtualHelixItem.__init__(self, model_virtual_helix, part_item)
        QGraphicsPathItem.__init__(self, parent=part_item.proxy())
        self._viewroot = viewroot
        self._getActiveTool = part_item._getActiveTool
        self._controller = VirtualHelixItemController(self, self._model_part, False, True)

        self._handle = VirtualHelixHandleItem(self, part_item, viewroot)
        self._last_strand_set = None
        self._last_idx = None
        self.setFlag(QGraphicsItem.ItemUsesExtendedStyleOption)
        self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
        self.setBrush(getNoBrush())

        view = self.view()
        view.levelOfDetailChangedSignal.connect(self.levelOfDetailChangedSlot)
        should_show_details = view.shouldShowDetails()

        pen = newPenObj(styles.MINOR_GRID_STROKE, styles.MINOR_GRID_STROKE_WIDTH)
        pen.setCosmetic(should_show_details)
        self.setPen(pen)

        self.is_active = False

        self.refreshPath()
        self.setAcceptHoverEvents(True)  # for pathtools
        self.setZValue(styles.ZPATHHELIX)

        self._right_mouse_move = False
        self.drag_last_position = self.handle_start = self.pos()
Пример #18
0
    def enableActive(self, is_active, to_vh_id_num=None):
        """Call on PreXoverItems created on the active VirtualHelixItem

        Args:
            is_active (TYPE): Description
            to_vh_id_num (None, optional): Description
        """
        if is_active:
            self.to_vh_id_num = to_vh_id_num
            self.setAcceptHoverEvents(True)
            if to_vh_id_num is None:
                self.setLabel(text=None)
                self.setBrush(getBrushObj(self._color, alpha=0))
            else:
                self.setLabel(text=str(to_vh_id_num))
                inactive_alpha = PROX_ALPHA
                self.setBrush(getBrushObj(self._color, alpha=inactive_alpha))
                self.animate(self, 'brush_alpha', 1000, 128, inactive_alpha)
                self.setFlag(KEYINPUT_ACTIVE_FLAG, True)
        else:
            self.setBrush(getNoBrush())
            # self.setLabel(text=None)
            self.setAcceptHoverEvents(False)
            self.setFlag(KEYINPUT_ACTIVE_FLAG, False)
Пример #19
0
    def enableActive(self, is_active, to_vh_id_num=None):
        """Call on PreXoverItems created on the active VirtualHelixItem

        Args:
            is_active (TYPE): Description
            to_vh_id_num (None, optional): Description
        """
        if is_active:
            self.to_vh_id_num = to_vh_id_num
            self.setAcceptHoverEvents(True)
            if to_vh_id_num is None:
                self.setLabel(text=None)
                self.setBrush(getBrushObj(self._color, alpha=0))
            else:
                self.setLabel(text=str(to_vh_id_num))
                inactive_alpha = PROX_ALPHA
                self.setBrush(getBrushObj(self._color, alpha=inactive_alpha))
                self.animate(self, 'brush_alpha', 1000, 128, inactive_alpha)
                self.setFlag(KEYINPUT_ACTIVE_FLAG, True)
        else:
            self.setBrush(getNoBrush())
            # self.setLabel(text=None)
            self.setAcceptHoverEvents(False)
            self.setFlag(KEYINPUT_ACTIVE_FLAG, False)
Пример #20
0
"""Summary
"""
from PyQt5.QtCore import QPointF, QRectF, Qt
from PyQt5.QtGui import QFontMetrics, QPainterPath
from PyQt5.QtWidgets import QGraphicsItem, QGraphicsPathItem, QGraphicsRectItem, QGraphicsSimpleTextItem
from cadnano.views.pathview import pathstyles as styles
from cadnano.gui.palette import getColorObj, getPenObj, getNoPen, getNoBrush, getSolidBrush

_BASE_WIDTH = styles.PATH_BASE_WIDTH
_toHelixNumFont = styles.XOVER_LABEL_FONT
# precalculate the height of a number font.  Assumes a fixed font
# and that only numbers will be used for labels
_FM = QFontMetrics(_toHelixNumFont)
_ENAB_BRUSH = getSolidBrush()  # Also for the helix number label
_NO_BRUSH = getNoBrush()
# _RECT = QRectF(0, 0, baseWidth, baseWidth)
_X_SCALE = styles.PATH_XOVER_LINE_SCALE_X  # control point x constant
_Y_SCALE = styles.PATH_XOVER_LINE_SCALE_Y  # control point y constant
_RECT = QRectF(0, 0, _BASE_WIDTH, _BASE_WIDTH)


class XoverNode3(QGraphicsRectItem):
    """
    This is a QGraphicsRectItem to allow actions and also a
    QGraphicsSimpleTextItem to allow a label to be drawn

    Attributes:
        is_forward (TYPE): Description
    """
    def __init__(self, virtual_helix_item, xover_item, strand3p, idx):
        """Summary
Пример #21
0
"""
from PyQt5.QtCore import QRectF, QPointF
from PyQt5.QtWidgets import QGraphicsObject

from cadnano import util
from cadnano.gui.views.pathview import pathstyles as styles
from cadnano.gui.palette import getPenObj, getNoBrush

_BW = styles.PATH_BASE_WIDTH
_TOOL_RECT = QRectF(0, 0, _BW, _BW)  # protected not private
_RECT = QRectF(-styles.PATH_BASE_HL_STROKE_WIDTH,
               -styles.PATH_BASE_HL_STROKE_WIDTH,
               _BW + 2 * styles.PATH_BASE_HL_STROKE_WIDTH,
               _BW + 2 * styles.PATH_BASE_HL_STROKE_WIDTH)
_PEN = getPenObj(styles.RED_STROKE, styles.PATH_BASE_HL_STROKE_WIDTH)
_BRUSH = getNoBrush()


class AbstractPathTool(QGraphicsObject):
    """Abstract base class to be subclassed by all other pathview tools.

    Attributes:
        manager (TYPE): Description
    """
    def __init__(self, manager):
        """Summary

        Args:
            manager (TYPE): Description
        """
        super(AbstractPathTool, self).__init__(None)
Пример #22
0
 def __init__(self, parent=None):
     super(PathWorkplaneOutline, self).__init__(parent)
     self.setPen(getNoPen())
     self._path = QGraphicsPathItem(self)
     self._path.setBrush(getNoBrush())
     self._path.setPen(newPenObj(styles.BLUE_STROKE, 0))
Пример #23
0
)
from cadnano.cntypes import (
    DocT,
    WindowT,
    Vec2T
)


_BW: int = styles.PATH_BASE_WIDTH
_TOOL_RECT: QRectF = QRectF(0, 0, _BW, _BW)  # protected not private
_RECT: QRectF = QRectF(-styles.PATH_BASE_HL_STROKE_WIDTH,
               -styles.PATH_BASE_HL_STROKE_WIDTH,
               _BW + 2 * styles.PATH_BASE_HL_STROKE_WIDTH,
               _BW + 2 * styles.PATH_BASE_HL_STROKE_WIDTH)
_PEN: QPen = getPenObj(styles.RED_STROKE, styles.PATH_BASE_HL_STROKE_WIDTH)
_BRUSH: QBrush = getNoBrush()


class AbstractPathTool(AbstractTool):
    """Abstract base class to be subclassed by all other pathview tools.

    Attributes:
        manager: Description
    """

    def __init__(self, manager: PathToolManagerT):
        """
        Args:
            manager: Description
        """
        super(AbstractPathTool, self).__init__(None)
Пример #24
0
from cadnano import util
from cadnano.views.abstractitems import AbstractTool
from cadnano.views.pathview import pathstyles as styles
from cadnano.gui.palette import (getPenObj, getNoBrush)
from cadnano.views.pathview import (PathToolManagerT, PathVirtualHelixItemT)
from cadnano.cntypes import (DocT, WindowT, Vec2T)

_BW: int = styles.PATH_BASE_WIDTH
_TOOL_RECT: QRectF = QRectF(0, 0, _BW, _BW)  # protected not private
_RECT: QRectF = QRectF(-styles.PATH_BASE_HL_STROKE_WIDTH,
                       -styles.PATH_BASE_HL_STROKE_WIDTH,
                       _BW + 2 * styles.PATH_BASE_HL_STROKE_WIDTH,
                       _BW + 2 * styles.PATH_BASE_HL_STROKE_WIDTH)
_PEN: QPen = getPenObj(styles.RED_STROKE, styles.PATH_BASE_HL_STROKE_WIDTH)
_BRUSH: QBrush = getNoBrush()


class AbstractPathTool(AbstractTool):
    """Abstract base class to be subclassed by all other pathview tools.

    Attributes:
        manager: Description
    """
    def __init__(self, manager: PathToolManagerT):
        """
        Args:
            manager: Description
        """
        super(AbstractPathTool, self).__init__(None)
        self.manager: PathToolManagerT = manager