Skip to content

Commit be2f636

Browse files
committed
Added a setup method to the Node base class for custom initialization behavior of nodes.
1 parent 39b0b36 commit be2f636

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

floppy/node.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,16 @@ def __init__(self, nodeID, graph):
288288
raise AttributeError('Nodes without any input are not valid.')
289289
if len(self.inputs.keys()) == 2:
290290
self.inputs[list(self.inputs.keys())[1]].setPure()
291+
self.setup()
291292

293+
def setup(self):
294+
"""
295+
This method will be called after a node instance is initialized.
296+
Override this to initialize attributes required for custom node behavior.
297+
This way the annoying calls of super(Node, self).__init__(*args, **kwargs) calls can be avoided.
298+
:return:
299+
"""
300+
pass
292301

293302
def __str__(self):
294303
return '{}-{}'.format(self.__class__.__name__, self.ID)

floppy/painter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ def spawnRunner(self):
10681068

10691069
def runCode(self, *args):
10701070
self.drawer.graph.execute()
1071-
self.statusBar.showMessage('Code execution successful.', 2000)
1071+
self.statusBar.showMessage('Code execution started.', 2000)
10721072

10731073
def loadGraph(self, *args):
10741074
fileName = QFileDialog.getOpenFileName(self, 'Open File', '~/',

0 commit comments

Comments
 (0)