diff options
author | Ian Ward <ian@excess.org> | 2014-01-04 20:01:10 -0500 |
---|---|---|
committer | Ian Ward <ian@excess.org> | 2014-01-04 20:01:10 -0500 |
commit | ac2c00768f2888bf843ac05ce94989ab430e58d0 (patch) | |
tree | af85f2e5288db558e4083778f58599ff3a46b06e | |
parent | 01cf0dbc1bc675aa96f7c16c1f618c00e212bc75 (diff) | |
download | urwid-ac2c00768f2888bf843ac05ce94989ab430e58d0.tar.gz |
docs: pop_up and subproc examples
-rw-r--r-- | docs/examples/index.rst | 26 | ||||
l--------- | docs/examples/pop_up.py | 1 | ||||
-rw-r--r-- | docs/examples/pop_up.py.xdotool | 2 | ||||
l--------- | docs/examples/subproc.py | 1 | ||||
-rw-r--r-- | docs/examples/subproc.py.xdotool | 2 | ||||
-rw-r--r-- | docs/examples/subproc2.py | 10 | ||||
-rwxr-xr-x | examples/subproc.py | 5 |
7 files changed, 42 insertions, 5 deletions
diff --git a/docs/examples/index.rst b/docs/examples/index.rst index 75333d6..c9299e9 100644 --- a/docs/examples/index.rst +++ b/docs/examples/index.rst @@ -15,7 +15,7 @@ tour.py .. image:: tour1.png .. image:: tour2.png -A simple example showing how many of the standard widgets may be arranged +Show how many of the standard widgets may be arranged on the screen @@ -24,7 +24,7 @@ graph.py .. image:: graph2.png -A demonstration of the BarGraph widget and alarms used for animation +Demonstrate BarGraph widget and alarms used for animation edit.py @@ -45,12 +45,30 @@ A lazy directory browser with file selection, tree-view, custom widgets and list walker +subproc.py +---------- + +.. image:: subproc1.png +.. image:: subproc2.png + +Monitor and display results from a subprocess + + palette_test.py --------------- .. image:: palette_test2.png -Shows available colors in various screen modes +Show available colors in various screen modes + + +pop_up.py +--------- + +.. image:: pop_up1.png +.. image:: pop_up2.png + +Create a pop-up/drop-down/window anchored to another widget bigtext.py @@ -59,4 +77,4 @@ bigtext.py .. image:: bigtext2.png .. image:: bigtext3.png -A demonstration of the BigText widget +demonstrate the BigText widget diff --git a/docs/examples/pop_up.py b/docs/examples/pop_up.py new file mode 120000 index 0000000..0e32494 --- /dev/null +++ b/docs/examples/pop_up.py @@ -0,0 +1 @@ +../../examples/pop_up.py
\ No newline at end of file diff --git a/docs/examples/pop_up.py.xdotool b/docs/examples/pop_up.py.xdotool new file mode 100644 index 0000000..486ab8d --- /dev/null +++ b/docs/examples/pop_up.py.xdotool @@ -0,0 +1,2 @@ +windowsize --usehints $RXVTWINDOWID 39 18 +key --window $RXVTWINDOWID space diff --git a/docs/examples/subproc.py b/docs/examples/subproc.py new file mode 120000 index 0000000..b3410f7 --- /dev/null +++ b/docs/examples/subproc.py @@ -0,0 +1 @@ +../../examples/subproc.py
\ No newline at end of file diff --git a/docs/examples/subproc.py.xdotool b/docs/examples/subproc.py.xdotool new file mode 100644 index 0000000..4f8e186 --- /dev/null +++ b/docs/examples/subproc.py.xdotool @@ -0,0 +1,2 @@ +windowsize --usehints $RXVTWINDOWID 39 18 +key --window $RXVTWINDOWID a n y t h i n g question diff --git a/docs/examples/subproc2.py b/docs/examples/subproc2.py new file mode 100644 index 0000000..76c8090 --- /dev/null +++ b/docs/examples/subproc2.py @@ -0,0 +1,10 @@ + +import time +time.sleep(1) + +print """factor: 1 +factor: 1000003 +factor: 2000029 +factor: 3000073 +factor: 4000159 +factor: 5000101""" diff --git a/examples/subproc.py b/examples/subproc.py index 28f5497..64eb072 100755 --- a/examples/subproc.py +++ b/examples/subproc.py @@ -2,8 +2,11 @@ import subprocess import urwid +import os +import sys factor_me = 362923067964327863989661926737477737673859044111968554257667 +run_me = os.path.join(os.path.dirname(sys.argv[0]), 'subproc2.py') output_widget = urwid.Text("Factors of %d:\n" % factor_me) edit_widget = urwid.Edit("Type anything or press enter to exit:") @@ -22,7 +25,7 @@ def received_output(data): write_fd = loop.watch_pipe(received_output) proc = subprocess.Popen( - ['python', '-u', 'subproc2.py', str(factor_me)], + ['python', '-u', run_me, str(factor_me)], stdout=write_fd, close_fds=True) |