self.i = self.i + 1
return line
self.i = self.i + 1
return line
def lyx_exists():
if lyx_pid is None:
return False
fname = '/proc/' + lyx_pid + '/status'
return os.path.exists(fname)
def lyx_exists():
if lyx_pid is None:
return False
fname = '/proc/' + lyx_pid + '/status'
return os.path.exists(fname)
+def lyx_sleeping():
+ fname = '/proc/' + lyx_pid + '/status'
+ f = open(fname, 'r')
+ lines = f.readlines()
+ sleeping = lines[1].find('(sleeping)') > 0
+
+ # print 'LYX_STATE', lines[1] , 'SLEEPING=', sleeping
+
+ return sleeping
+
# Interruptible os.system()
def intr_system(cmd, ignore_err = False):
# Interruptible os.system()
def intr_system(cmd, ignore_err = False):
-# Return true if LyX (identified via lyx_pid) is sleeping
-def lyx_sleeping():
- fname = '/proc/' + lyx_pid + '/status'
- return intr_system("grep 'State.*sleeping' " + fname)
-
-
def sendKeystring(keystr, LYX_PID):
# print "sending keystring "+keystr+"\n"
def sendKeystring(keystr, LYX_PID):
# print "sending keystring "+keystr+"\n"
count = 5
while count > 0:
lyx_pid=os.popen("pidof " + lyx).read().rstrip()
count = 5
while count > 0:
lyx_pid=os.popen("pidof " + lyx).read().rstrip()
- print 'lyx_pid=' + lyx_pid, '\n'
if lyx_pid != "":
lyx_window_name=os.popen("wmctrl -l -p | grep ' " + str(lyx_pid) + " ' | cut -d ' ' -f 1").read().rstrip()
if lyx_pid != "":
lyx_window_name=os.popen("wmctrl -l -p | grep ' " + str(lyx_pid) + " ' | cut -d ' ' -f 1").read().rstrip()
- print 'lyx_win=' + lyx_window_name, '\n'
if lyx_window_name != "":
break
else:
if lyx_window_name != "":
break
else:
export LYX_PID=$(pidof lyx)
export LYX_WINDOW_NAME=$(wmctrl -l -p | grep " $LYX_PID " | cut -d ' ' -f 1);
fi
export LYX_PID=$(pidof lyx)
export LYX_WINDOW_NAME=$(wmctrl -l -p | grep " $LYX_PID " | cut -d ' ' -f 1);
fi
-
-echo LYX_PID=$LYX_PID
-echo LYX_WINDOW_NAME=$LYX_WINDOW_NAME
-
export MAX_LOOPS=1
export LYX_EXE=${LYX_EXE:-../../src/lyx}
export MAX_LOOPS=1
export LYX_EXE=${LYX_EXE:-../../src/lyx}
export XVKBD_EXE=${XVKBD_EXE:-xvkbd};
fi
export XVKBD_EXE=${XVKBD_EXE:-xvkbd};
fi
-python -m trace --trace $KEYTEST
wm attributes . -topmost 1
wm attributes . -topmost 1