Skip to content

Commit

Permalink
Merge pull request #68 from jaimervq/small_bugs_fix
Browse files Browse the repository at this point in the history
Small bugfixes
  • Loading branch information
jaimervq authored Jul 15, 2024
2 parents fa98356 + fb032fb commit a99b34c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion graphic/graphic_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ def event(self, event: QtWidgets.QGraphicsScene.event):

# See that we are not working on a node widget
if self.focusItem(): # Means we are editing a widget in some input node
return
return QtWidgets.QGraphicsScene.event(self, event)

modifiers = QtWidgets.QApplication.keyboardModifiers()

Expand Down
5 changes: 5 additions & 0 deletions logic/logic_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
__license__ = "MIT License"

import ast
from copy import deepcopy
import datetime
import getpass
import os
Expand Down Expand Up @@ -67,6 +68,10 @@ def __init__(self):
self.node_name = self.class_name + "_1"
self.uuid = str(uuid.uuid4())

# Copy dicts
self.INPUTS_DICT = deepcopy(self.INPUTS_DICT)
self.OUTPUTS_DICT = deepcopy(self.OUTPUTS_DICT)

# Attributes
self.all_attributes = []
self.check_attributes_validity()
Expand Down
22 changes: 22 additions & 0 deletions test/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,25 @@ def test_node_execution_time(self):
n_1.run_single()

self.assertGreater(n_1.execution_time, 1.0)

def test_add_attrs(self):
"""
Check attributes can be added to a node instance
"""
utils.print_test_header("test_add_attrs")

n_empty = debug.EmptyNode()
n_empty.add_attribute("test_attr", constants.INPUT, int, value=100)
self.assertEqual(n_empty["test_attr"].get_value(), 100)
self.assertEqual(len(n_empty.get_input_attrs()), 2)

def test_add_attrs_2(self):
"""
Check attributes can be added to a node instance
"""
utils.print_test_header("test_add_attrs_2")

n_empty = debug.ErrorNode()
n_empty.add_attribute("some_attr", constants.OUTPUT, str)
self.assertIsNone(n_empty["some_attr"].get_value())
self.assertEqual(len(n_empty.get_output_attrs()), 2)
26 changes: 0 additions & 26 deletions test/test_node_manipulation.py

This file was deleted.

0 comments on commit a99b34c

Please sign in to comment.