Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions opencodeblocks/graphics/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from PyQt5.QtCore import QEvent, QPointF, Qt
from PyQt5.QtGui import QMouseEvent, QPainter, QWheelEvent
from PyQt5.QtWidgets import QGraphicsView
from sip import isdeleted

from opencodeblocks.graphics.scene import OCBScene
from opencodeblocks.graphics.socket import OCBSocket
Expand Down Expand Up @@ -142,7 +143,6 @@ def deleteSelected(self):

def bring_forward(self, event: QMouseEvent):
""" When a codeblock is selected, it will be drawn in front of other blocks """
scene = self.scene()
item_at_click = self.itemAt(event.pos())
if item_at_click is None:
return event
Expand All @@ -153,7 +153,7 @@ def bring_forward(self, event: QMouseEvent):
item_at_click = item_at_click.parentItem()

if isinstance(item_at_click, OCBBlock):
if self.currentSelectedBlock is not None:
if self.currentSelectedBlock is not None and not isdeleted(self.currentSelectedBlock):
self.currentSelectedBlock.setZValue(0)
item_at_click.setZValue(1)
self.currentSelectedBlock = item_at_click
Expand Down