Skip to content
Snippets Groups Projects
Commit 46757a0e authored by Martin's avatar Martin
Browse files

fixed the bug of entering a string in edit module state for (hopefully) all modules

parent 0cdae997
No related branches found
No related tags found
1 merge request!36Grx displays error message instead of crashing
Pipeline #133077 failed
......@@ -6,6 +6,7 @@ from qtpy.QtCore import Slot
from qtpy.QtGui import QCursor
from qtpy.QtWidgets import (
QAction,
QErrorMessage,
QGraphicsItem,
QGraphicsObject,
QGraphicsRectItem,
......@@ -44,6 +45,8 @@ class ModuleGraphicsItem(QGraphicsObject, QGraphicsItem):
# Save module for later updates
self.module = module
self.errorMessageWidget = QErrorMessage()
# Use modules name if no name is given
if name is None:
self.name = self.module.name
......@@ -193,6 +196,8 @@ class ModuleGraphicsItem(QGraphicsObject, QGraphicsItem):
for value in parsed_value:
if isinstance(value, str):
raise TypeError
if isinstance(parsed_value, str):
raise TypeError
except SyntaxError as e:
self.errorMessageWidget.showMessage(str(e))
......
......@@ -33,7 +33,6 @@ class GrxGraphicsItem(ModuleGraphicsItem):
def __init__(self, module: GRX):
self.register_text_labels = []
self.errorMessageWidget = QErrorMessage()
super().__init__(module)
def draw_graphics_item(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment