Skip to content

Commit 46f2e8c

Browse files
committed
sandbox / node suspend bug (cf thedmd/imgui-node-editor#282)
1 parent ff081ef commit 46f2e8c

File tree

1 file changed

+69
-4
lines changed

1 file changed

+69
-4
lines changed
Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,73 @@
1-
import functools
1+
from imgui_bundle import imgui, immapp, hello_imgui, ImVec2, imgui_node_editor as ed
22

33

4-
def add(a: int, b: int) -> int:
5-
return a + b
4+
poem = """
5+
If
66
7+
By Rudyard Kipling
8+
_______________________________________________________
79
8-
add4 = functools.partial(add, 4)
10+
If you can keep your head when all about you
11+
Are losing theirs and blaming it on you,
12+
If you can trust yourself when all men doubt you,
13+
But make allowance for their doubting too;
14+
If you can wait and not be tired by waiting,
15+
Or being lied about, don't deal in lies,
16+
Or being hated, don't give way to hating,
17+
And yet don't look too good, nor talk too wise:
18+
19+
If you can dream and not make dreams your master;
20+
If you can think and not make thoughts your aim;
21+
If you can meet with Triumph and Disaster
22+
And treat those two impostors just the same;
23+
If you can bear to hear the truth you've spoken
24+
Twisted by knaves to make a trap for fools,
25+
Or watch the things you gave your life to, broken,
26+
And stoop and build 'em up with worn-out tools:
27+
28+
If you can make one heap of all your winnings
29+
And risk it on one turn of pitch-and-toss,
30+
And lose, and start again at your beginnings
31+
And never breathe a word about your loss;
32+
If you can force your heart and nerve and sinew
33+
To serve your turn long after they are gone,
34+
And so hold on when there is nothing in you
35+
Except the Will which says to them: "Hold on!"
36+
37+
If you can talk with crowds and keep your virtue,
38+
Or walk with Kings nor lose the common touch,
39+
If neither foes nor loving friends can hurt you,
40+
If all men count with you, but none too much;
41+
If you can fill the unforgiving minute
42+
With sixty seconds' worth of distance run,
43+
Yours is the Earth and everything that's in it,
44+
And - which is more - you'll be a Man, my son!
45+
"""
46+
# poem = poem.replace("\n", "")
47+
48+
node_id = ed.NodeId.create()
49+
50+
51+
def gui():
52+
global poem
53+
54+
ed.begin("Graph")
55+
56+
ed.begin_node(node_id)
57+
if imgui.button("O"):
58+
imgui.open_popup("expandable_str_popup")
59+
if imgui.begin_popup("expandable_str_popup"):
60+
ed.suspend()
61+
imgui.input_text_multiline("##value_text", poem, ImVec2(0, hello_imgui.em_size(15)))
62+
ed.resume()
63+
imgui.end_popup()
64+
65+
ed.end_node()
66+
67+
ed.end()
68+
69+
# imgui.input_text_multiline("poem", poem)
70+
# imgui.text_wrapped(poem)
71+
72+
73+
immapp.run(gui, with_node_editor=True)

0 commit comments

Comments
 (0)