Exemple #1
0
 def __init__(self,
              scale,
              glob_scale,
              cell_id,
              polygon,
              points,
              walls,
              parent=None):
     QGraphicsItem.__init__(self, parent)
     self.cell_id = cell_id
     self.setZValue(2.5)
     self.setAcceptsHoverEvents(True)
     self.setSelectable(False)
     self.setFlag(QGraphicsItem.ItemSendsGeometryChanges, True)
     self.hover = False
     self.hover_contour = False
     self.hover_side = None
     self.scale = scale
     self.glob_scale = glob_scale
     self.setToolTip(unicode(cell_id))
     self.polygon_id = polygon
     self.walls = walls
     self.sides = []
     self.points = points
     self.current = False
     self.drag_line = False
     self.dragging_line = False
     self.editable = False
     self.p1 = None
     self.p2 = None
     self.setGeometry()
    def __init__(self, scene, axis, posModel):
        QGraphicsItem.__init__(self, scene=scene)
        self.setFlag(QGraphicsItem.ItemHasNoContents);
        
        self.axis = axis
        self.posModel = posModel
        
        self._width = 0
        self._height = 0

        self.thick_penX = QPen(Qt.red, self.thick_width)
        self.thick_penX.setCosmetic(True)

        self.thick_penY = QPen(Qt.green, self.thick_width)
        self.thick_penY.setCosmetic(True)

        self.thin_penX = QPen(Qt.red, self.thin_width)
        self.thin_penX.setCosmetic(True)

        self.thin_penY = QPen(Qt.green, self.thin_width)
        self.thin_penY.setCosmetic(True)

        self.x = 0
        self.y = 0

        # These child items do most of the work.
        self._horizontal_marker = SliceMarkerLine(self, 'horizontal')
        self._vertical_marker = SliceMarkerLine(self, 'vertical')

        # We 
        self._horizontal_marker = SliceMarkerLine(self, 'horizontal')
        self._vertical_marker = SliceMarkerLine(self, 'vertical')
    def __init__(self, scene, axis, crop_extents_model, editable=True):

        self._cropColor = Qt.white

        QGraphicsItem.__init__(self, scene=scene)
        self.setFlag(QGraphicsItem.ItemHasNoContents)
        self.setAcceptHoverEvents(True)
        self.scene = scene
        self.axis = axis
        self.crop_extents_model = crop_extents_model

        self._width = 0
        self._height = 0

        # Add shading item first so crop lines are drawn on top.
        self._shading_item = ExcludedRegionShading(self,
                                                   self.crop_extents_model)

        self._horizontal0 = CropLine(self, 'horizontal', 0)
        self._horizontal1 = CropLine(self, 'horizontal', 1)
        self._vertical0 = CropLine(self, 'vertical', 0)
        self._vertical1 = CropLine(self, 'vertical', 1)

        self.crop_extents_model.changed.connect(self.onExtentsChanged)
        self.crop_extents_model.colorChanged.connect(self.onColorChanged)

        # keeping track which line started mouse move
        self._mouseMoveStartH = -1
        self._mouseMoveStartV = -1
        self._fractionOfDistance = 1
 def __init__(self, scale, source, target, parent=None):
     QGraphicsItem.__init__(self, parent)
     self.source = source
     self.target = target
     self.scale = scale
     self.updateShape()
     self.setZValue(2)
    def __init__(self, scene, axis, posModel):
        """
        scene: Must be an ImageScene2D instance.  We manipulate the scene.allow_brushing flag.
        """
        QGraphicsItem.__init__(self, scene=scene)
        self.setFlag(QGraphicsItem.ItemHasNoContents)

        self.axis = axis
        self.posModel = posModel

        self._width = 0
        self._height = 0

        self.thick_penX = QPen(Qt.red, self.thick_width)
        self.thick_penX.setCosmetic(True)

        self.thick_penY = QPen(Qt.green, self.thick_width)
        self.thick_penY.setCosmetic(True)

        self.thin_penX = QPen(Qt.red, self.thin_width)
        self.thin_penX.setCosmetic(True)

        self.thin_penY = QPen(Qt.green, self.thin_width)
        self.thin_penY.setCosmetic(True)

        self.x = 0
        self.y = 0

        # These child items do most of the work.
        self._horizontal_marker = SliceMarkerLine(self, 'horizontal')
        self._vertical_marker = SliceMarkerLine(self, 'vertical')
Exemple #6
0
    def __init__(self, scene, axis, crop_extents_model, editable=True):

        self._cropColor = Qt.white
        self._editable = editable

        QGraphicsItem.__init__(self, scene=scene)
        self.setFlag(QGraphicsItem.ItemHasNoContents);
        self.setAcceptHoverEvents(True)
        self.scene = scene
        self.axis = axis
        self.crop_extents_model = crop_extents_model
        self.crop_extents_model.editableChanged.connect( self.onEditableChanged)

        self._width = 0
        self._height = 0

        # Add shading item first so crop lines are drawn on top.
        self._shading_item = ExcludedRegionShading( self, self.crop_extents_model )

        self._horizontal0 = CropLine(self, 'horizontal', 0)
        self._horizontal1 = CropLine(self, 'horizontal', 1)
        self._vertical0 = CropLine(self, 'vertical', 0)
        self._vertical1 = CropLine(self, 'vertical', 1)

        self.crop_extents_model.changed.connect( self.onExtentsChanged )
        self.crop_extents_model.colorChanged.connect( self.onColorChanged )

        # keeping track which line started mouse move
        self._mouseMoveStartH = -1
        self._mouseMoveStartV = -1
        self._fractionOfDistance = 1
Exemple #7
0
 def __init__(self, scale, source, target, parent=None):
     QGraphicsItem.__init__(self, parent)
     self.source = source
     self.target = target
     self.scale = scale
     self.updateShape()
     self.setZValue(2)
    def __init__(self, scene, axis, posModel):
        """
        scene: Must be an ImageScene2D instance.  We manipulate the scene.allow_brushing flag.
        """
        QGraphicsItem.__init__(self, scene=scene)
        self.setFlag(QGraphicsItem.ItemHasNoContents);
        
        self.axis = axis
        self.posModel = posModel
        
        self._width = 0
        self._height = 0

        self.thick_penX = QPen(Qt.red, self.thick_width)
        self.thick_penX.setCosmetic(True)

        self.thick_penY = QPen(Qt.green, self.thick_width)
        self.thick_penY.setCosmetic(True)

        self.thin_penX = QPen(Qt.red, self.thin_width)
        self.thin_penX.setCosmetic(True)

        self.thin_penY = QPen(Qt.green, self.thin_width)
        self.thin_penY.setCosmetic(True)

        self.x = 0
        self.y = 0

        # These child items do most of the work.
        self._horizontal_marker = SliceMarkerLine(self, 'horizontal')
        self._vertical_marker = SliceMarkerLine(self, 'vertical')
Exemple #9
0
 def __init__(self, unit):
     QGraphicsItem.__init__(self)
     self.unit = unit
     self.yPosition = unit * 0.03
     self.width = -self.unit * 0.02
     self.lengthInUnits = 200
     self.axisLength = self.lengthInUnits * unit
     self.axisStart = -self.axisLength / 2
    def __init__(self, parent, direction):
        assert isinstance(parent, SliceIntersectionMarker)
        assert direction in ('horizontal', 'vertical')

        self._parent = parent
        self._direction = direction
        QGraphicsItem.__init__(self, parent)
        self.setAcceptHoverEvents(True)
Exemple #11
0
 def __init__(self, unit):
     QGraphicsItem.__init__(self)
     self.unit = unit
     self.yPosition = unit * 0.03
     self.width = -self.unit * 0.02
     self.lengthInUnits = 200
     self.axisLength = self.lengthInUnits * unit
     self.axisStart = -self.axisLength / 2
    def __init__(self, parent, direction):
        assert isinstance(parent, SliceIntersectionMarker)
        assert direction in ('horizontal', 'vertical')

        self._parent = parent
        self._direction = direction
        QGraphicsItem.__init__(self, parent)
        self.setAcceptHoverEvents(True)
Exemple #13
0
 def __init__(self, tile):
     QGraphicsItem.__init__(self)
     self._tile = weakref.ref(tile) # avoid circular references for easier gc
     self._boundingRect = None
     self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
     # while moving the tile we use ItemCoordinateCache, see
     # Tile.setActiveAnimation
     self.setClippingFlags()
Exemple #14
0
 def __init__(self, tile):
     QGraphicsItem.__init__(self)
     self._tile = weakref.ref(
         tile)  # avoid circular references for easier gc
     self._boundingRect = None
     self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
     # while moving the tile we use ItemCoordinateCache, see
     # Tile.setActiveAnimation
     self.setClippingFlags()
Exemple #15
0
    def __init__(self):
        QGraphicsItem.__init__(self)

        self.__selected = None
        self.setZValue(3.0)

        self.__mark = EDraw.Circle(10, 3, 90).translated(QPointF(0.0, -12.0))

        self.__pen = EDraw.EColor.DefaultEnterHoverPen
Exemple #16
0
 def __init__(self,
              size=32,
              bounds=QRectF(0, 0, 100, 100),
              pen=QPen(QColor(0, 0, 255, 64))):
     self.bounds = bounds
     QGraphicsItem.__init__(self)
     self.lines = []
     self.size = size
     self.pen = pen
Exemple #17
0
    def __init__(self, tiling, delay=datetime.timedelta( milliseconds=1000 ) ):
        QGraphicsItem.__init__(self, parent=None)
        self.delay = delay
        self.setFlags(QGraphicsItem.ItemUsesExtendedStyleOption)

        self._tiling = tiling
        self._indicate = numpy.zeros(len(tiling))
        self._zeroProgressTimestamp = [datetime.datetime.now()] * len(tiling)
        self._last_zero = False
Exemple #18
0
    def __init__(self, tiling, delay=datetime.timedelta(milliseconds=1000)):
        QGraphicsItem.__init__(self, parent=None)
        self.delay = delay
        self.setFlags(QGraphicsItem.ItemUsesExtendedStyleOption)

        self._tiling = tiling
        self._indicate = numpy.zeros(len(tiling))
        self._zeroProgressTimestamp = [datetime.datetime.now()] * len(tiling)
        self._last_zero = False
 def __init__(self, parent=None):
     QGraphicsItem.__init__(self, parent)
     self.setZValue(5)
     self.setFlags(QGraphicsItem.ItemIsMovable)
     self.setAcceptsHoverEvents(True)
     self.on_search = False
     self.on_template = None
     self.last_pos = None
     self.changing = False
     self.setGeometry()
Exemple #20
0
 def __init__(self, parent=None):
     QGraphicsItem.__init__(self, parent)
     self.setZValue(5)
     self.setFlags(QGraphicsItem.ItemIsMovable)
     self.setAcceptsHoverEvents(True)
     self.on_search = False
     self.on_template = None
     self.last_pos = None
     self.changing = False
     self.setGeometry()
Exemple #21
0
 def __init__(self, parent=None, graphicView=None, graphicScene=None):
     QGraphicsItem.__init__(self)
     self.set_default_data()
     self.className = QGraphicsTextItem(self)
     self.functionsItem = FunctionsContainerModel(self)
     self.className.setPlainText(self.defaultClassName)
     self.setFlag(self.ItemIsMovable)
     self.setFlag(self.ItemSendsGeometryChanges)
     self.functionsItem.setPos(0, self.__get_title_height())
     self.attributesItem = FunctionsContainerModel(self)
     self.attributesItem.setPos(0, self.functionsItem.get_height())
Exemple #22
0
 def __init__(self, parent=None, graphicView=None, graphicScene=None):
     QGraphicsItem.__init__(self)
     self.set_default_data()
     self.className = QGraphicsTextItem(self)
     self.functionsItem = FunctionsContainerModel(self)
     self.className.setPlainText(self.defaultClassName)
     self.setFlag(self.ItemIsMovable)
     self.setFlag(self.ItemSendsGeometryChanges)
     self.functionsItem.setPos(0, self.__get_title_height())
     self.attributesItem = FunctionsContainerModel(self)
     self.attributesItem.setPos(0, self.functionsItem.get_height())
Exemple #23
0
    def __init__(self, parent, direction, index):
        assert isinstance(parent, CroppingMarkers)
        assert direction in ('horizontal', 'vertical')

        self._parent = parent
        self._direction = direction
        self._index = index
        QGraphicsItem.__init__(self, parent)
        self.setAcceptHoverEvents(True)
        
        self._position = 0
    def __init__(self, parent, direction, index):
        assert isinstance(parent, CroppingMarkers)
        assert direction in ('horizontal', 'vertical')

        self._parent = parent
        self._direction = direction
        self._index = index
        QGraphicsItem.__init__(self, parent)
        self.setAcceptHoverEvents(True)

        self._position = 0
Exemple #25
0
    def __init__(self, start, end, pen=QPen(QColor(0, 0, 0, 255))):
        self.pen = pen

        QGraphicsItem.__init__(self)

        self.starting_line = QLineF(start, end)
        self.bounds = QRectF(start - (end - start), end + (end - start))

        self.steps = 4
        self.smooth = 50
        self.dampen = 100
        self.update_lines()
Exemple #26
0
    def __init__(self,
                 id,
                 title='',
                 title_above=False,
                 title_location=AxisMiddle,
                 line=None,
                 arrows=0,
                 plot=None,
                 bounds=None):
        QGraphicsItem.__init__(self)
        self.setFlag(QGraphicsItem.ItemHasNoContents)
        self.setZValue(AxisZValue)
        self.id = id
        self.title = title
        self.title_location = title_location
        self.data_line = line
        self.plot = plot
        self.graph_line = None
        self.size = None
        self.scale = None
        self.tick_length = (10, 5, 0)
        self.arrows = arrows
        self.title_above = title_above
        self.line_item = QGraphicsLineItem(self)
        self.title_item = QGraphicsTextItem(self)
        self.end_arrow_item = None
        self.start_arrow_item = None
        self.show_title = False
        self.scale = None
        path = QPainterPath()
        path.setFillRule(Qt.WindingFill)
        path.moveTo(0, 3.09)
        path.lineTo(0, -3.09)
        path.lineTo(9.51, 0)
        path.closeSubpath()
        self.arrow_path = path
        self.label_items = []
        self.label_bg_items = []
        self.tick_items = []
        self._ticks = []
        self.zoom_transform = QTransform()
        self.labels = None
        self.values = None
        self._bounds = bounds
        self.auto_range = None
        self.auto_scale = True

        self.zoomable = False
        self.update_callback = None
        self.max_text_width = 50
        self.text_margin = 5
        self.always_horizontal_text = False
Exemple #27
0
 def __init__(self, target, tail_length = 3):
     # super params (x, y, width, height)
     QGraphicsItem.__init__(self)
     
     self._is_selected=False
     self.history = History() # used to store the previous points where the target has been
     self.tail_length = tail_length
     self.target = target
     
     self.plane = PlaneView(self)
     # self.speed_vector = LineItem(parent = self.plane)
     self.label=TargetLabel(parent = self.plane)
     self.box_line = LineItem(parent = self.plane)
 def __init__(self, scale, pt_id, parent=None):
     QGraphicsItem.__init__(self, parent)
     self.pt_id = pt_id
     self.scale = scale
     self.setZValue(1)
     #self.setFlag(QGraphicsItem.ItemIgnoresTransformations, True)
     self.setSelectable()
     self.link = None
     self.back_link = None
     self.arrow = None
     self._show_template = False  # Are we showing the template *now* ?
     self.hover_template = False
     self.hover = False
     self.setGeometry()
Exemple #29
0
	def __init__(self, start, end, pen = QPen(QColor(0,0,0,255))):
		self.pen = pen

		QGraphicsItem.__init__(self)

		self.starting_line = QLineF(start, end)
		self.bounds = QRectF(
			start - (end - start),
			end + (end - start))

		self.steps = 4
		self.smooth = 50
		self.dampen = 100
		self.update_lines()
Exemple #30
0
 def __init__(self, scale, pt_id, parent=None):
     QGraphicsItem.__init__(self, parent)
     self.pt_id = pt_id
     self.scale = scale
     self.setZValue(1)
     #self.setFlag(QGraphicsItem.ItemIgnoresTransformations, True)
     self.setSelectable()
     self.link = None
     self.back_link = None
     self.arrow = None
     self._show_template = False  # Are we showing the template *now* ?
     self.hover_template = False
     self.hover = False
     self.setGeometry()
Exemple #31
0
    def __init__(self, parent, direction, index):
        assert isinstance(parent, CroppingMarkers)
        assert direction in ('horizontal', 'vertical')

        self._parent = parent
        self._direction = direction
        self._index = index
        QGraphicsItem.__init__(self, parent)
        self.setAcceptHoverEvents(True)
        self._position = 0
        self._line_thickness = 1

        # keeping track which line started mouse move
        self._mouseMoveStartH = -1
        self._mouseMoveStartV = -1
    def __init__(self, parent, direction, index):
        assert isinstance(parent, CroppingMarkers)
        assert direction in ('horizontal', 'vertical')

        self._parent = parent
        self._direction = direction
        self._index = index
        QGraphicsItem.__init__(self, parent)
        self.setAcceptHoverEvents(True)
        self._position = 0
        self._line_thickness = 1

        # keeping track which line started mouse move
        self._mouseMoveStartH = -1
        self._mouseMoveStartV = -1
Exemple #33
0
    def __init__(self, line_length, offset, linespace, align, hyphenate, block_id):
        QGraphicsItem.__init__(self)

        self.line_length, self.offset, self.line_space = line_length, offset, linespace
        self.align, self.hyphenate, self.block_id = align, hyphenate, block_id

        self.tokens = collections.deque()
        self.current_width = 0
        self.length_in_space = 0
        self.height, self.descent, self.width = 0, 0, 0
        self.links = collections.deque()
        self.current_link = None
        self.valign = None
        if not hasattr(self, 'children'):
            self.children = self.childItems
    def __init__(self, parent=None, icon=None, iconSize=None, **kwargs):
        QGraphicsItem.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemUsesExtendedStyleOption, True)

        if icon is None:
            icon = QIcon()

        if iconSize is None:
            style = QApplication.instance().style()
            size = style.pixelMetric(style.PM_LargeIconSize)
            iconSize = QSize(size, size)

        self.__transformationMode = Qt.SmoothTransformation

        self.__iconSize = QSize(iconSize)
        self.__icon = QIcon(icon)
    def __init__(self, x1, y1, x2, y2, parent=None, scene=None):
        QGraphicsItem.__init__(self, x1, y1, x2, y2,
                               parent=parent, scene=scene)
        self.selec = False
        self.ctrlPressed = False
        self.selectWidth = 2.5
        self.id = None
        self.parentSelected = False
        self.parentList = []
        self.allItems = []

        self.backupPen = self.pen()

        self.select_pen = QPen(QtCore.Qt.gray)
        self.select_pen.setStyle(QtCore.Qt.DotLine)
        self.select_pen.setWidthF(self.selectWidth)
Exemple #36
0
    def __init__(self, line_length, offset, linespace, align, hyphenate,
                 block_id):
        QGraphicsItem.__init__(self)

        self.line_length, self.offset, self.line_space = line_length, offset, linespace
        self.align, self.hyphenate, self.block_id = align, hyphenate, block_id

        self.tokens = collections.deque()
        self.current_width = 0
        self.length_in_space = 0
        self.height, self.descent, self.width = 0, 0, 0
        self.links = collections.deque()
        self.current_link = None
        self.valign = None
        if not hasattr(self, 'children'):
            self.children = self.childItems
 def __init__(self):
     QGraphicsItem.__init__(self)
     
     self.width = 0
     self.height = 0
           
     self.penX = QPen(Qt.red, 2)
     self.penX.setCosmetic(True)
     
     self.penY = QPen(Qt.green, 2)
     self.penY.setCosmetic(True)
     
     self.x = 0
     self.y = 0
     
     self.isVisible = False
Exemple #38
0
    def __init__(self, parent=None, icon=None, iconSize=None, **kwargs):
        QGraphicsItem.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemUsesExtendedStyleOption, True)

        if icon is None:
            icon = QIcon()

        if iconSize is None:
            style = QApplication.instance().style()
            size = style.pixelMetric(style.PM_LargeIconSize)
            iconSize = QSize(size, size)

        self.__transformationMode = Qt.SmoothTransformation

        self.__iconSize = QSize(iconSize)
        self.__icon = QIcon(icon)
Exemple #39
0
    def __init__(self, scene):
        QGraphicsItem.__init__(self, scene=scene)

        self._width = 0
        self._height = 0

        self.penDotted = QPen(Qt.red, 2, Qt.DotLine, Qt.RoundCap, Qt.RoundJoin)
        self.penDotted.setCosmetic(True)

        self.penSolid = QPen(Qt.red, 2)
        self.penSolid.setCosmetic(True)

        self.x = 0
        self.y = 0
        self.brushSize = 0

        self.mode = self.modeXYPosition
	def __init__(self, parent=None, image=None):
		"""
		This method initializes the class.

		:param parent: Object parent. ( QObject )
		:param image: Image. ( QImage )
		"""

		LOGGER.debug("> Initializing '{0}()' class.".format(self.__class__.__name__))

		QGraphicsItem.__init__(self, parent)

		# --- Setting class attributes. ---
		self.__image = None
		self.image = image or QImage()
		self.__width = image.width()
		self.__height = image.height()
Exemple #41
0
    def __init__(self, id, title='', title_above=False, title_location=AxisMiddle,
                 line=None, arrows=0, plot=None, bounds=None):
        QGraphicsItem.__init__(self)
        self.setFlag(QGraphicsItem.ItemHasNoContents)
        self.setZValue(AxisZValue)
        self.id = id
        self.title = title
        self.title_location = title_location
        self.data_line = line
        self.plot = plot
        self.graph_line = None
        self.size = None
        self.scale = None
        self.tick_length = (10, 5, 0)
        self.arrows = arrows
        self.title_above = title_above
        self.line_item = QGraphicsLineItem(self)
        self.title_item = QGraphicsTextItem(self)
        self.end_arrow_item = None
        self.start_arrow_item = None
        self.show_title = False
        self.scale = None
        path = QPainterPath()
        path.setFillRule(Qt.WindingFill)
        path.moveTo(0, 3.09)
        path.lineTo(0, -3.09)
        path.lineTo(9.51, 0)
        path.closeSubpath()
        self.arrow_path = path
        self.label_items = []
        self.label_bg_items = []
        self.tick_items = []
        self._ticks = []
        self.zoom_transform = QTransform()
        self.labels = None
        self.values = None
        self._bounds = bounds
        self.auto_range = None
        self.auto_scale = True

        self.zoomable = False
        self.update_callback = None
        self.max_text_width = 50
        self.text_margin = 5
        self.always_horizontal_text = False
    def __init__(self, parent=None, image=None):
        """
		This method initializes the class.

		:param parent: Object parent. ( QObject )
		:param image: Image. ( QImage )
		"""

        LOGGER.debug("> Initializing '{0}()' class.".format(
            self.__class__.__name__))

        QGraphicsItem.__init__(self, parent)

        # --- Setting class attributes. ---
        self.__image = None
        self.image = image or QImage()
        self.__width = image.width()
        self.__height = image.height()
Exemple #43
0
    def __init__(self, scene):
        QGraphicsItem.__init__(self, scene=scene)

        self._width = 0
        self._height = 0

        self.penDotted = QPen(Qt.red, 2, Qt.DotLine, Qt.RoundCap, Qt.RoundJoin)
        self.penDotted.setCosmetic(True)

        self.penSolid = QPen(Qt.red, 2)
        self.penSolid.setCosmetic(True)

        self.x = 0
        self.y = 0
        self.brushSize = 0

        self.mode = self.modeXYPosition
        self._enabled = True
Exemple #44
0
 def __init__(self, scale, pt_id, new=False, cells=(), parent=None):
     QGraphicsItem.__init__(self, parent)
     self.remove_in_all = False
     self.new = new
     self.pt_id = pt_id
     self.scale = scale
     self.setZValue(3)
     self.setAcceptsHoverEvents(True)
     self.setSelectable()
     self.link = None
     self.back_link = None
     self.arrow = None
     self._show_template = False  # Are we showing the template *now* ?
     self.hover_template = False
     self.hover = False
     self.setToolTip(unicode(pt_id))
     self.cells = tuple(cells)
     self.setGeometry()
     self.setFlag(QGraphicsItem.ItemSendsGeometryChanges, True)
 def __init__(self, scale, pt_id, new=False, cells=(), parent=None):
     QGraphicsItem.__init__(self, parent)
     self.remove_in_all = False
     self.new = new
     self.pt_id = pt_id
     self.scale = scale
     self.setZValue(3)
     self.setAcceptsHoverEvents(True)
     self.setSelectable()
     self.link = None
     self.back_link = None
     self.arrow = None
     self._show_template = False  # Are we showing the template *now* ?
     self.hover_template = False
     self.hover = False
     self.setToolTip(unicode(pt_id))
     self.cells = tuple(cells)
     self.setGeometry()
     self.setFlag(QGraphicsItem.ItemSendsGeometryChanges, True)
Exemple #46
0
    def __init__(self, scene, axis, crop_extents_model):
        QGraphicsItem.__init__(self, scene=scene)
        self.setFlag(QGraphicsItem.ItemHasNoContents);
        
        self.axis = axis
        self.crop_extents_model = crop_extents_model
        
        self._width = 0
        self._height = 0

        # Add shading item first so crop lines are drawn on top.
        self._shading_item = ExcludedRegionShading( self, self.crop_extents_model )

        self._horizontal0 = CropLine(self, 'horizontal', 0)
        self._horizontal1 = CropLine(self, 'horizontal', 1)
        self._vertical0 = CropLine(self, 'vertical', 0)
        self._vertical1 = CropLine(self, 'vertical', 1)

        self.crop_extents_model.changed.connect( self.onExtentsChanged )
Exemple #47
0
    def __init__(self, scene, pos, node, radius=15, **args):
        '''
        Constructor
        '''
        QGraphicsItem.__init__(self, **args)

        self.node = node
        self.radius = radius
        self.pos = pos
        self.scene = scene
        
        self.m_signalLinkNode = NodeSignal ()

        x, y = self.pos[node]
        self.setPos(QPointF(x, y))

        self.setFlag(QGraphicsItem.ItemIsMovable)
        self.setFlag(QGraphicsItem.ItemIsSelectable)
        self.setFlag(QGraphicsItem.ItemSendsGeometryChanges)
    def __init__(self, scene, axis, crop_extents_model):
        QGraphicsItem.__init__(self, scene=scene)
        self.setFlag(QGraphicsItem.ItemHasNoContents)

        self.axis = axis
        self.crop_extents_model = crop_extents_model

        self._width = 0
        self._height = 0

        # Add shading item first so crop lines are drawn on top.
        self._shading_item = ExcludedRegionShading(self,
                                                   self.crop_extents_model)

        self._horizontal0 = CropLine(self, 'horizontal', 0)
        self._horizontal1 = CropLine(self, 'horizontal', 1)
        self._vertical0 = CropLine(self, 'vertical', 0)
        self._vertical1 = CropLine(self, 'vertical', 1)

        self.crop_extents_model.changed.connect(self.onExtentsChanged)
Exemple #49
0
 def __init__ (self, color, node_id, helper, x, y, parent=None):
     
     QGraphicsItem.__init__ (self)
     
     self.node_id = node_id
     self.helper  = helper
     self.node_model = self.helper.getGraph().getNode (self.node_id)
     
     self.inHooks  = []
     self.outHooks = []
     
     self.scene = self.helper.getScene ()
     
     #self.harpoon = self.helper.getHarpoon()
     #self.color = color
     
     self.canvas_height_in_units = 0
     
     self.comm = self.helper.getGraph().getComm()
     
     self.setFlags (QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsMovable)        
     self.setAcceptHoverEvents (True)
     self.previousMouseGrabberItem = None
     
     self.setZValue (1.0)
     
     self.height = 0
     self.hook_height = 0
     
     self.canvas = cs.Canvas (self)
     self.canvas.setParentItem (self)
     
     self.canvas_bottom = cs1.CanvasProps (self)
     self.canvas_bottom.setParentItem (self)
     self.canvas_bottom.setTitle (self.node_model.getName())
     # populates the props (each one with name and value)
     num_props = len(self.node_model.getProps())
     self.canvas_bottom.setCanvasHeightInUnits (num_props)
     if num_props > 0:
         for prop in self.node_model.getProps():
             self.canvas_bottom.addProp (QString(prop[0]), QString(prop[2]))
Exemple #50
0
    def __init__(self, x1, y1, x2, y2, parent=None, scene=None):
        QGraphicsItem.__init__(self,
                               x1,
                               y1,
                               x2,
                               y2,
                               parent=parent,
                               scene=scene)
        self.selec = False
        self.ctrlPressed = False
        self.selectWidth = 2.5
        self.id = None
        self.parentSelected = False
        self.parentList = []
        self.allItems = []

        self.backupPen = self.pen()

        self.select_pen = QPen(QtCore.Qt.gray)
        self.select_pen.setStyle(QtCore.Qt.DotLine)
        self.select_pen.setWidthF(self.selectWidth)
Exemple #51
0
 def __init__(self, track, carId, startPos=0, pitLane=False):
     QGraphicsItem.__init__(self)
     self.setAcceptHoverEvents(True)
     self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
     self.setOpacity(0.7)
     self.setZValue(4)
     self._track = track
     self._id = carId
     self._position = startPos
     self._pit = pitLane
     self._state = None
     self._font = QFont()
     self._font.setPointSize(16)
     self._rect = QRectF(-self.carSize / 2, -self.carSize / 2,
                         self.carSize, self.carSize)
     self.refreshState()
     e = QGraphicsColorizeEffect()
     e.setColor(Qt.darkMagenta)
     e.setEnabled(False)
     self.setGraphicsEffect(e)
     self._translateToNewPos()
Exemple #52
0
    def __init__(self, scene):
        QGraphicsItem.__init__(self, scene=scene)

        self._width = 0
        self._height = 0

        self.thick_penX = QPen(Qt.red, self.thick_width)
        self.thick_penX.setCosmetic(True)

        self.thick_penY = QPen(Qt.green, self.thick_width)
        self.thick_penY.setCosmetic(True)

        self.thin_penX = QPen(Qt.red, self.thin_width)
        self.thin_penX.setCosmetic(True)

        self.thin_penY = QPen(Qt.green, self.thin_width)
        self.thin_penY.setCosmetic(True)

        self.x = 0
        self.y = 0

        self.isVisible = True
    def __init__(self, scene):
        QGraphicsItem.__init__(self, scene=scene)

        self._width = 0
        self._height = 0

        self.thick_penX = QPen(Qt.red, self.thick_width)
        self.thick_penX.setCosmetic(True)

        self.thick_penY = QPen(Qt.green, self.thick_width)
        self.thick_penY.setCosmetic(True)

        self.thin_penX = QPen(Qt.red, self.thin_width)
        self.thin_penX.setCosmetic(True)

        self.thin_penY = QPen(Qt.green, self.thin_width)
        self.thin_penY.setCosmetic(True)

        self.x = 0
        self.y = 0

        self.isVisible = True
Exemple #54
0
 def __init__(self, parent=None, scene=None):
     
     QGraphicsItem.__init__ (self)
     
     self.parent = parent
     self.helper = self.parent.getHelper()
     
     #self.setFlags (QGraphicsItem.ItemIsSelectable)
     self.setAcceptsHoverEvents (True)
     
     self.pen_color = QPen (Qt.black, 2)
     
     self.color = QColor (Qt.white).dark (150)
     
     # init Canvas Animation Tweening
     self.timeline = QTimeLine (200)
     self.timeline.setFrameRange (0, 100)
     self.anim = QGraphicsItemAnimation ()
     self.anim.setItem (self)
     self.anim.setTimeLine (self.timeline)
     self.helper.connect (self.timeline, SIGNAL("finished()"), self.moveFurtherUp)
     self.anim_active = False
     
     #self._nodename = QGraphicsTextItem ('text '+str(self.node_id), self)
     self._nodename = QGraphicsTextItem ('', self)
     self._nodename.setPos (QPointF (18, 20))
     self._nodename.setDefaultTextColor (QColor (Qt.white).light (255))
     self._nodename.setFont (QFont ("Helvetica", 11, QFont.Bold, False))
     self._nodename.setTextWidth(120)
     self._nodename.setToolTip (self._nodename.toPlainText ())
     #self._nodename.setHtml("<h2 align=\"center\">hello</h2><h2 align=\"center\">world 1234345345</h2>123");
     
     self.props_list = []
     self.props_textItem_value_list = []
     
     self.FACTOR = 4.0
     
     self._canvas_height = 0
Exemple #55
0
 def __init__(self, parent=None):
     QGraphicsItem.__init__(self, parent)
     self.parent = parent
     self.maxWidth = self.parent._get_width()
     self.maxHeight = 0
Exemple #56
0
 def __init__(self, tiling):
     QGraphicsItem.__init__(self, parent=None)
     self._tiling = tiling
     self._indicate = numpy.zeros(len(tiling))
     self._zeroProgressTimestamp = [None] * len(tiling)