Update main window title
[oscopy.git] / ioscopy_app.sh
blob1877da56a759930b9603752737e48311b9813618
1 #!/bin/sh
2 #-*-Shell-*-
4 IPYTHON=ipython
5 IOSCOPY=ioscopy
6 PYTHON=python
7 IOCFG=--IOscopyConfig
8 REPS="'-b': '$IOCFG.b=True $IOCFG.f=',\
9 '-i': '$IOCFG.i=True',\
10 '-h': '$IOCFG.h=True',\
11 '-H': '-h',\
12 '-q': '--no-banner --IOscopyConfig.quiet=True'"
14 getprofd () {
15 tmpf=tmpfile
16 profd=`$IPYTHON --quick --profile=$IOSCOPY --no-banner --quiet --no-confirm-exit --classic --HistoryManager.hist_file=$tmpf<< EOF| grep /
17 ip=get_ipython()
18 print "\n" + ip.profile_dir.location + "\n"
19 EOF`;
20 rm $tmpf
23 $IPYTHON profile list --log-level=40 | grep $IOSCOPY > /dev/null
24 if [ $? -ne 0 ]; then
25 echo IPython $IOSCOPY profile not found, creating it.
26 $IPYTHON profile create $IOSCOPY
27 getprofd
28 if [ ! -d $profd ]; then
29 mkdir -p $profd
31 cp @datarootdir@/oscopy/ipython_config.py $profd
32 else
33 getprofd
34 if [ ! -f "$profd/ipython_config.py" ]; then
35 echo IPython $IOSCOPY profile file not found, copying it.
36 cp @datarootdir@/oscopy/ipython_config.py $profd
37 elif [ "$profd/ipython_config.py" -ot "@datarootdir@/oscopy/ipython_config.py" ]; then
38 echo
39 upd=0
40 read -p "IPython $IOSCOPY profile file is outdated, update [N/y] ? " upd
41 echo
42 if [ "$upd" = "Y" -o "$upd" = "y" ] ; then
43 echo Updating IPython $IOSCOPY profile.
44 echo
45 cp @datarootdir@/oscopy/ipython_config.py $profd
46 else
47 echo "skipping profile update."
48 echo
53 # Replace short args with their equivalent, and delete space between = and
54 # file name when needed
55 args=`$PYTHON <<EOF
56 reps={$REPS}
57 argout=[reps.get(s, s) for s in "$*".split()]
58 print " ".join(argout).replace(".f= ", ".f=")
59 EOF`
60 #echo ///// $args +++++++++++++++++++++++
61 $IPYTHON --profile=$IOSCOPY $args