Skip to content

Commit 8c0f1d5

Browse files
committed
Fixed some stuff.
Changed to WaitAll node's input names. The 'Pass' Input will now be relayed to the output to make certain logic possible.
1 parent 1b374c5 commit 8c0f1d5

6 files changed

Lines changed: 49 additions & 10 deletions

File tree

bin/pairs.ppy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[[0, {"class": "ForEachAtomPair", "inputConnections": {"Control": "4:Oout", "Start": "1:OAtoms"}, "inputs": [["Start", "Atom", null, ""], ["Control", "object", null, ""]], "position": [5, -73], "outputConnections": {"Final": ["5:IstrInput"], "Atom1": ["2:IAtom"], "Atom2": ["3:IAtom"]}, "outputs": [["Final", "object", null, ""], ["Atom1", "Atom", null, ""], ["Atom2", "Atom", null, ""]]}], [1, {"class": "ReadAtoms", "inputConnections": {}, "inputs": [["FileName", "str", "test.cif", "test.cif"]], "position": [-163, -103], "outputConnections": {"Atoms": ["0:IStart"]}, "outputs": [["Atoms", "Atom", null, ""]]}], [2, {"class": "BreakAtom", "inputConnections": {"Atom": "0:OAtom1"}, "inputs": [["Atom", "Atom", null, ""]], "position": [235, -218], "outputConnections": {"Element": [], "Cell": [], "Name": ["4:I2"], "ADP": [], "ADP_Flag": [], "frac": [], "cart": []}, "outputs": [["Name", "str", null, ""], ["Element", "str", null, ""], ["frac", "float", null, ""], ["cart", "float", null, ""], ["ADP", "float", null, ""], ["ADP_Flag", "str", null, ""], ["Cell", "float", null, ""]]}], [3, {"class": "BreakAtom", "inputConnections": {"Atom": "0:OAtom2"}, "inputs": [["Atom", "Atom", null, ""]], "position": [289, 66], "outputConnections": {"Element": [], "Cell": [], "Name": ["4:I1"], "ADP": [], "ADP_Flag": [], "frac": [], "cart": []}, "outputs": [["Name", "str", null, ""], ["Element", "str", null, ""], ["frac", "float", null, ""], ["cart", "float", null, ""], ["ADP", "float", null, ""], ["ADP_Flag", "str", null, ""], ["Cell", "float", null, ""]]}], [4, {"class": "WaitAll", "inputConnections": {"1": "3:OName", "2": "2:OName"}, "inputs": [["1", "object", null, ""], ["2", "object", null, ""]], "position": [535, 17], "outputConnections": {"out": ["0:IControl"]}, "outputs": [["out", "object", null, ""]]}], [5, {"class": "FinalTestNode", "inputConnections": {"strInput": "0:OFinal"}, "inputs": [["strInput", "str", null, ""]], "position": [141, 287], "outputConnections": {"strOutput": []}, "outputs": [["strOutput", "str", null, ""]]}]]
1+
[[0, {"class": "ForEachAtomPair", "position": [5, -73], "inputs": [["Start", "Atom", null, ""], ["Control", "object", null, ""]], "outputs": [["Final", "object", null, ""], ["Atom1", "Atom", null, ""], ["Atom2", "Atom", null, ""]], "outputConnections": {"Atom2": ["3:IAtom"], "Atom1": ["2:IAtom"], "Final": ["10:ITrigger"]}, "inputConnections": {"Start": "1:OAtoms", "Control": "9:OTrigger"}}], [1, {"class": "ReadAtoms", "position": [-163, -103], "inputs": [["FileName", "str", "test.cif", "test.cif"]], "outputs": [["Atoms", "Atom", null, ""]], "outputConnections": {"Atoms": ["0:IStart"]}, "inputConnections": {}}], [2, {"class": "BreakAtom", "position": [235, -218], "inputs": [["Atom", "Atom", null, ""]], "outputs": [["Name", "str", null, ""], ["Element", "str", null, ""], ["frac", "float", null, ""], ["cart", "float", null, ""], ["ADP", "float", null, ""], ["ADP_Flag", "str", null, ""], ["Cell", "float", null, ""]], "outputConnections": {"Element": [], "Name": ["7:IStr1"], "ADP": [], "frac": [], "cart": ["6:IPosition1"], "ADP_Flag": [], "Cell": []}, "inputConnections": {"Atom": "0:OAtom1"}}], [3, {"class": "BreakAtom", "position": [289, 66], "inputs": [["Atom", "Atom", null, ""]], "outputs": [["Name", "str", null, ""], ["Element", "str", null, ""], ["frac", "float", null, ""], ["cart", "float", null, ""], ["ADP", "float", null, ""], ["ADP_Flag", "str", null, ""], ["Cell", "float", null, ""]], "outputConnections": {"Element": [], "Name": ["8:IStr2"], "ADP": [], "frac": [], "cart": ["6:IPosition2"], "ADP_Flag": [], "Cell": []}, "inputConnections": {"Atom": "0:OAtom2"}}], [6, {"class": "Distance", "position": [606, -49], "inputs": [["Position1", "float", null, ""], ["Position2", "float", null, ""]], "outputs": [["Distance", "float", null, ""]], "outputConnections": {"Distance": ["9:IValue"]}, "inputConnections": {"Position2": "3:Ocart", "Position1": "2:Ocart"}}], [7, {"class": "Join", "position": [501, -195], "inputs": [["Str1", "str", null, ""], ["Str2", "str", " -- ", " -- "]], "outputs": [["Joined", "str", null, ""]], "outputConnections": {"Joined": ["8:IStr1"]}, "inputConnections": {"Str1": "2:OName"}}], [8, {"class": "Join", "position": [771, -80], "inputs": [["Str1", "str", null, ""], ["Str2", "str", null, ""]], "outputs": [["Joined", "str", null, ""]], "outputConnections": {"Joined": ["9:IName"]}, "inputConnections": {"Str1": "7:OJoined", "Str2": "3:OName"}}], [9, {"class": "SetValue", "position": [939, 50], "inputs": [["Name", "str", null, ""], ["Value", "object", null, ""]], "outputs": [["Trigger", "object", null, ""]], "outputConnections": {"Trigger": ["0:IControl"]}, "inputConnections": {"Value": "6:ODistance", "Name": "8:OJoined"}}], [10, {"class": "ShowValues", "position": [175, 324], "inputs": [["Trigger", "object", null, ""]], "outputs": [["Output", "object", null, ""]], "outputConnections": {"Output": []}, "inputConnections": {"Trigger": "0:OFinal"}}]]

bin/test.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
O5 -- H12 O5 -- O2 O5 -- O3 O5 -- H14 O5 -- C5 O5 -- H4 O5 -- H1A O5 -- H15 O5 -- H2 O5 -- O1 O5 -- C2 O5 -- C3 O5 -- C4 O5 -- H13 O5 -- H5B O5 -- H11 O5 -- C1 O5 -- H1B O5 -- O4 O5 -- H5A H12 -- O2 H12 -- O3 H12 -- H14 H12 -- C5 H12 -- H4 H12 -- H1A H12 -- H15 H12 -- H2 H12 -- O1 H12 -- C2 H12 -- C3 H12 -- C4 H12 -- H13 H12 -- H5B H12 -- H11 H12 -- C1 H12 -- H1B H12 -- O4 H12 -- H5A O2 -- O3 O2 -- H14 O2 -- C5 O2 -- H4 O2 -- H1A O2 -- H15 O2 -- H2 O2 -- O1 O2 -- C2 O2 -- C3 O2 -- C4 O2 -- H13 O2 -- H5B O2 -- H11 O2 -- C1 O2 -- H1B O2 -- O4 O2 -- H5A O3 -- H14 O3 -- C5 O3 -- H4 O3 -- H1A O3 -- H15 O3 -- H2 O3 -- O1 O3 -- C2 O3 -- C3 O3 -- C4 O3 -- H13 O3 -- H5B O3 -- H11 O3 -- C1 O3 -- H1B O3 -- O4 O3 -- H5A H14 -- C5 H14 -- H4 H14 -- H1A H14 -- H15 H14 -- H2 H14 -- O1 H14 -- C2 H14 -- C3 H14 -- C4 H14 -- H13 H14 -- H5B H14 -- H11 H14 -- C1 H14 -- H1B H14 -- O4 H14 -- H5A C5 -- H4 C5 -- H1A C5 -- H15 C5 -- H2 C5 -- O1 C5 -- C2 C5 -- C3 C5 -- C4 C5 -- H13 C5 -- H5B C5 -- H11 C5 -- C1 C5 -- H1B C5 -- O4 C5 -- H5A H4 -- H1A H4 -- H15 H4 -- H2 H4 -- O1 H4 -- C2 H4 -- C3 H4 -- C4 H4 -- H13 H4 -- H5B H4 -- H11 H4 -- C1 H4 -- H1B H4 -- O4 H4 -- H5A H1A -- H15 H1A -- H2 H1A -- O1 H1A -- C2 H1A -- C3 H1A -- C4 H1A -- H13 H1A -- H5B H1A -- H11 H1A -- C1 H1A -- H1B H1A -- O4 H1A -- H5A H15 -- H2 H15 -- O1 H15 -- C2 H15 -- C3 H15 -- C4 H15 -- H13 H15 -- H5B H15 -- H11 H15 -- C1 H15 -- H1B H15 -- O4 H15 -- H5A H2 -- O1 H2 -- C2 H2 -- C3 H2 -- C4 H2 -- H13 H2 -- H5B H2 -- H11 H2 -- C1 H2 -- H1B H2 -- O4 H2 -- H5A O1 -- C2 O1 -- C3 O1 -- C4 O1 -- H13 O1 -- H5B O1 -- H11 O1 -- C1 O1 -- H1B O1 -- O4 O1 -- H5A C2 -- C3 C2 -- C4 C2 -- H13 C2 -- H5B C2 -- H11 C2 -- C1 C2 -- H1B C2 -- O4 C2 -- H5A C3 -- C4 C3 -- H13 C3 -- H5B C3 -- H11 C3 -- C1 C3 -- H1B C3 -- O4 C3 -- H5A C4 -- H13 C4 -- H5B C4 -- H11 C4 -- C1 C4 -- H1B C4 -- O4 C4 -- H5A H13 -- H5B H13 -- H11 H13 -- C1 H13 -- H1B H13 -- O4 H13 -- H5A H5B -- H11 H5B -- C1 H5B -- H1B H5B -- O4 H5B -- H5A H11 -- C1 H11 -- H1B H11 -- O4 H11 -- H5A C1 -- H1B C1 -- O4 C1 -- H5A H1B -- O4 H1B -- H5A O4 -- H5A
2+
6.519944382727827 6.176581617933202 4.223013746887121 3.3529286177161857 1.4224639184749497 2.6079978377530106 5.63367395701502 0.9828417016292433 5.086443203661766 6.605978967463302 4.983802801844918 3.768785839457029 2.430137887647689 4.806564527716624 1.9843032661701134 7.0745468908130436 5.359977092992702 4.746970359848434 2.8780726511951253 1.9846260047606588 0.9770624237253238 2.7871627702394144 4.574713066164712 5.289183758373831 4.597193742575342 3.4619344151026117 6.7839571418285765 2.1253392648508966 3.482142449216947 1.9771219974799386 2.8770102602899983 4.171263295589478 2.926993880001588 5.248465784939197 2.897692865475505 3.1564657021748164 3.943842551132101 4.337578170702395 5.480073090361406 2.764080700524492 4.441304829877801 4.93832228719242 4.08155496597257 2.52688460784637 6.573484227951723 2.0002346619632383 2.873202304946643 1.4319200896841637 2.435471101938967 3.8037631379623895 2.83863630197614 5.050185899985341 2.498512797945002 2.36943741667308 3.2241463645384076 4.250359699421327 5.000984172293031 3.5990482962522075 2.890839023615415 3.2602359738563687 3.986459341397622 4.414811839375053 2.723985789241553 4.872890749452606 2.4316698092111904 1.4303771233274827 2.406540445418709 0.9865871953237135 2.5852862115790476 4.793013080307341 3.767771044085454 4.030707689690788 2.8482218643464647 3.145060112257964 3.116033904773557 2.0483086163928332 4.390230048223037 3.425625003378282 2.5952104559197804 4.335718047488551 3.1044036202995113 2.9434733038071297 1.9493495896474058 4.53437481939216 3.4879476034962864 4.585757879889809 3.597829793032671 3.1053100475243456 0.9685624046777473 3.891704550239579 2.068990649040773 4.662078454784283 1.9614402463351504 4.140331117552742 5.797102764006144 3.890419734418835 2.5040230597916504 1.5202235105702568 3.404181351253176 0.9897831166115857 6.17077432572675 4.467019724583732 4.067278945151528 2.418357169869963 0.9900411100084034 3.2015629372361643 3.243449713202843 2.9271992296519547 4.006516771761054 2.731478573195811 2.0782294342331005 1.0002967718655777 3.9163596056408565 2.8696883382915765 4.541347397452148 2.794824367025442 2.1506408792136607 1.9952250459711316 2.3912513309894416 6.326992057646994 2.87267105738002 1.9866345763269586 2.0681966926803588 2.758255999090772 3.5560211593804407 4.127703799967118 5.231192764101803 2.5751818452543978 0.9900298095863708 1.6005605464918848 4.472220560854391 4.473291672393786 5.361321631898043 7.141531506837263 5.404063152775187 4.213376287621784 2.881449979357842 5.07075330802465 2.094238999224089 7.520508386031888 5.957468970464726 5.382631603644747 2.883623082305162 2.7149750079694495 2.609593701487746 0.9996238977358157 2.091602859115947 2.7046975673776754 3.4045278107205985 4.3581138655785026 2.454366094296055 2.0771848186697874 2.421781148860181 2.6438261571827932 4.540966187777691 2.4443643772337227 3.79502159114468 4.382950605592071 5.247295881340578 6.32038808909226 0.9946471914061011 1.427506799427296 1.9867411196063212 4.735330890583053 5.894845613384302 1.5352577311293507 2.5607029408443456 2.901623818883568 4.171397916602208 2.446850164662564 1.5189834588453994 2.0678569141005627 3.012106281819687 4.079975772068364 1.5306497594283106 1.9653301948351334 2.724818366302741 3.958014102625968 2.5252592339266826 2.6603166749932248 2.446999993921161 2.649567859818307 3.147352741457171 2.0707201246929205 4.729281307016202 3.1445351789651395 2.764352138622394 1.4370379945422833 2.071185039513009 3.067769842191878 5.146437634812442 4.129476473648625 4.513589890329109 3.7963554942512197 3.3985509153978706 6.5610075307091185 5.019379685747649 4.757197276228691 2.612224267745099 1.6015201912760566 2.022752454186973 2.7476769755308665 4.918644182818611 6.330921332326774 0.9899125955196226 3.8010657681249302 4.491445688131536 3.4343157970343396 4.140346897947429 3.2662067169808795

floppy/CustomNodes/mathNodes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def run(self):
4444
class Distance(VectorNode):
4545
Input('Position1', float, list=True)
4646
Input('Position2', float, list=True)
47-
Output('Distance', float, list=True)
47+
Output('Distance', float, )
4848

4949
def run(self):
5050
super(Distance, self).run()

floppy/node.py

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -687,9 +687,12 @@ class WaitAll(Node):
687687
"""
688688
Watis for all inputs to be set before executing further nodes.
689689
"""
690-
Input('1', object)
691-
Input('2', object)
692-
Output('out', object)
690+
Input('Pass', object)
691+
Input('Wait', object)
692+
Output('Out', object)
693+
694+
def run(self):
695+
self._Out(self._Pass)
693696

694697
def notify(self):
695698
super(WaitAll, self).notify()
@@ -1041,12 +1044,12 @@ def report(self):
10411044
return r
10421045

10431046

1044-
class Createlist(Node):
1047+
class CreateList(Node):
10451048
Input('Name', str)
10461049
Output('List', object, list=True)
10471050

10481051
def run(self):
1049-
super(Createlist, self).run()
1052+
super(CreateList, self).run()
10501053
l = []
10511054
self.graph.STOREDVALUES[self._Name] = l
10521055
self._List(l)
@@ -1071,4 +1074,35 @@ def run(self):
10711074
super(ToString, self).run()
10721075
self._String(str(self._Value))
10731076

1077+
1078+
class MakeTable(Node):
1079+
Input('Keys', str, list=True)
1080+
# Input('Values', object, list=True)
1081+
Output('Table', str)
1082+
1083+
def run(self):
1084+
super(MakeTable, self).run()
1085+
for key, value in self.graph.STOREDVALUES.items():
1086+
print(key, value)
1087+
keys = self._Keys
1088+
data = [self.graph.STOREDVALUES[key] for key in keys]
1089+
# cols = len(keys)
1090+
table = ''
1091+
for key in keys:
1092+
table += '{} '.format(key)
1093+
table += '\n'
1094+
alive = True
1095+
while alive:
1096+
for col in data:
1097+
try:
1098+
value = col.pop(0)
1099+
except IndexError:
1100+
alive = False
1101+
break
1102+
else:
1103+
table += '{} '.format(value)
1104+
print(table)
1105+
self._Table(table)
1106+
1107+
10741108
# TODO Cleanup this mess. Prepare method and probably a lot of other stuff is no longer needed.

floppy/painter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,13 +771,13 @@ def initMenus(self):
771771
self.mainToolBar.addAction(self.gotoRunnerAction)
772772
self.mainToolBar.addSeparator()
773773
self.mainToolBar.addAction(self.spawnRunnerAction)
774+
self.mainToolBar.addAction(self.pushAction)
774775
self.mainToolBar.addAction(self.killRunnerAction)
775776
self.mainToolBar.addSeparator()
776777
# self.mainToolBar.addAction(self.deleteNodeAction)
777778
self.mainToolBar.addAction(self.connectAction)
778779
# self.mainToolBar.addAction(self.statusAction)
779780
self.mainToolBar.addAction(self.dropAction)
780-
self.mainToolBar.addAction(self.pushAction)
781781
self.mainToolBar.addAction(self.updateRunnerAction)
782782

783783
self.mainToolBar.addSeparator()

floppy/runner.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ def kill(self):
192192

193193
def step(self):
194194
print('Stepping up.')
195-
self.executeGraphStep()
196-
self.master.updateRunningNodes(self.graph.runningNodes)
195+
if self.executeGraphStep():
196+
self.master.updateRunningNodes(self.graph.runningNodes)
197197
# self.executeGraphStepPar()
198198

199199
def loadGraph(self):
@@ -211,6 +211,8 @@ def updateGraph(self):
211211
#self.resetPointers()
212212

213213
def executeGraphStep(self):
214+
if not self.graph:
215+
return
214216
if self.master.nextNodePointer:
215217
print(self.master.nextNodePointer, self.graph.nodes.keys())
216218
nextNode = self.graph.nodes[self.master.nextNodePointer]
@@ -235,6 +237,7 @@ def executeGraphStep(self):
235237
if not running:
236238
print('Nothing to do here @ {}'.format(time.time()))
237239
time.sleep(.5)
240+
return True
238241

239242
def executeGraphStepPar(self):
240243
if self.master.nextNodePointer:

0 commit comments

Comments
 (0)