Skip to content

Commit b08862c

Browse files
committed
A lot of common errors are now caught and an appropriate status message is displayed.
1 parent e7c9316 commit b08862c

File tree

2 files changed

+38
-9
lines changed

2 files changed

+38
-9
lines changed

floppy/graph.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,12 @@ def __init__(self, node, cb, arg):
669669

670670
def run(self):
671671
super(NodeThread, self).run()
672-
self.node.run()
672+
try:
673+
self.node.run()
674+
except:
675+
print('Something bad happened in when executing {}.'.format(str(self.node)))
676+
self.node.unlock
677+
return
673678
self.node.notify()
674679
if self.cb:
675680
self.cb(self.arg)

floppy/painter.py

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -889,13 +889,22 @@ def close(self):
889889
qApp.quit()
890890

891891
def updateStatus(self):
892-
self.drawer.graph.requestRemoteStatus()
892+
try:
893+
self.drawer.graph.requestRemoteStatus()
894+
except AttributeError:
895+
self.statusBar.showMessage('Cannot Update Graph. No Interpreter Available..', 2000)
893896

894897
def dropGraph(self):
895-
self.drawer.graph.dropGraph()
898+
try:
899+
self.drawer.graph.dropGraph()
900+
except AttributeError:
901+
self.statusBar.showMessage('Cannot Drop Graph. No Interpreter Available..', 2000)
896902

897903
def pushGraph(self):
898-
self.drawer.graph.push2Runner()
904+
try:
905+
self.drawer.graph.push2Runner()
906+
except AttributeError:
907+
self.statusBar.showMessage('Cannot Push Graph. No Interpreter Available.', 2000)
899908

900909
def killRunner(self):
901910
try:
@@ -911,19 +920,34 @@ def deleteNode(self):
911920
self.drawer.repaint()
912921

913922
def stepRunner(self):
914-
self.drawer.graph.stepRunner()
923+
try:
924+
self.drawer.graph.stepRunner()
925+
except AttributeError:
926+
self.statusBar.showMessage('Cannot Execute Graph Step. No Interpreter Available.', 2000)
915927

916928
def gotoRunner(self):
917-
self.drawer.graph.gotoRunner(1)
929+
try:
930+
self.drawer.graph.gotoRunner(1)
931+
except AttributeError:
932+
self.statusBar.showMessage('Cannot Go To Node. No Interpreter Available.', 2000)
918933

919934
def updateRunner(self):
920-
self.drawer.graph.updateRunner()
935+
try:
936+
self.drawer.graph.updateRunner()
937+
except AttributeError:
938+
self.statusBar.showMessage('Cannot Update Interpreter. No Interpreter Available.', 2000)
921939

922940
def pauseRunner(self):
923-
self.drawer.graph.pauseRunner()
941+
try:
942+
self.drawer.graph.pauseRunner()
943+
except AttributeError:
944+
self.statusBar.showMessage('Cannot Pause Interpreter. No Interpreter Available.', 2000)
924945

925946
def unpauseRunner(self):
926-
self.drawer.graph.unpauseRunner()
947+
try:
948+
self.drawer.graph.unpauseRunner()
949+
except AttributeError:
950+
self.statusBar.showMessage('Cannot Unpause Interpreter. No Interpreter Available.', 2000)
927951

928952
def spawnRunner(self):
929953
print('Spawning new Runner.')

0 commit comments

Comments
 (0)