Skip to content

Commit d6cf058

Browse files
[test/check_graph_appearance.py] add sample for graph apearance
1 parent 304cd56 commit d6cf058

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

test/check_graph_appearance.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/python
2+
#-*- coding:utf-8 -*-
3+
4+
import argparse
5+
import signal
6+
import pyqtgraph
7+
from test_util import log_plotter_exec
8+
9+
10+
def show_graph():
11+
layout =u'''
12+
main:
13+
graph of dummy:
14+
legends:
15+
- { key: dummy, id: [0] }
16+
- { key: dummy, id: [0] }
17+
'''
18+
a = log_plotter_exec(layout=layout,
19+
plot_conf ='config/sample_plot.yaml',
20+
fname = 'data/sample/sample_data')
21+
a.view.showMaximized()
22+
return a
23+
24+
if __name__ == '__main__':
25+
parser = argparse.ArgumentParser(description='plot data from hrpsys log')
26+
parser.add_argument("-i", action='store_true', help='interactive (start IPython)')
27+
parser.set_defaults(feature=False)
28+
args = parser.parse_args()
29+
30+
app = pyqtgraph.Qt.QtGui.QApplication([])
31+
a = show_graph()
32+
if args.i:
33+
[app.processEvents() for i in range(2)]
34+
# start ipython
35+
print '====='
36+
print "please use \033[33mapp.processEvents()\033[m to update graph."
37+
print "you can use \033[33ma\033[m as LogPlotter instance."
38+
print '====='
39+
from IPython import embed
40+
embed()
41+
else:
42+
signal.signal(signal.SIGINT, signal.SIG_DFL)
43+
pyqtgraph.Qt.QtGui.QApplication.instance().exec_()

0 commit comments

Comments
 (0)