]> git.lyx.org Git - features.git/commitdiff
More precise identification of the lyx window (by id, instead of the buggy by title).
authorTommaso Cucinotta <tommaso@lyx.org>
Tue, 1 Feb 2011 22:57:10 +0000 (22:57 +0000)
committerTommaso Cucinotta <tommaso@lyx.org>
Tue, 1 Feb 2011 22:57:10 +0000 (22:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37410 a592a061-630c-0410-9148-cb99ea01b6c8

development/autotests/keytest.py
development/autotests/single-test.sh

index bb715ff0a7778bf3d898f651a84edb501a586365..1f6710eba741b18c4b1c8f830022896a11da6fb7 100755 (executable)
@@ -224,7 +224,7 @@ def RaiseWindow():
     #os.system("echo x-session-manager open files: `lsof -p $X_PID | grep ICE-unix | wc -l`")
     ####os.system("wmctrl -l | ( grep '"+lyx_window_name+"' || ( killall lyx ; sleep 1 ; killall -9 lyx ))")
     #os.system("wmctrl -R '"+lyx_window_name+"' ;sleep 0.1")
-    system_retry(30, "wmctrl -R '"+lyx_window_name+"'")
+    system_retry(30, "wmctrl -a '"+lyx_window_name+"'")
 
 
 lyx_pid = os.environ.get('LYX_PID')
@@ -274,7 +274,7 @@ else:
 
 outfile = open(outfilename, 'w')
 
-if lyx_pid != "":
+if not lyx_pid is None:
     RaiseWindow()
     sendKeystring("\Afn", lyx_pid)
 
@@ -298,6 +298,8 @@ while not failed:
         if lyx_pid != "":
             print "Found running instance(s) of LyX: " + lyx_pid + ": killing them all\n"
             os.system("killall lyx")
+            time.sleep(0.5)
+            os.system("killall -KILL lyx")
         time.sleep(0.2)
         print "Starting LyX . . ."
         if lyx_userdir is None:
@@ -306,17 +308,15 @@ while not failed:
             os.system(lyx_exe + " -userdir " + lyx_userdir + " " + c[9:] + "&")
         while True:
             lyx_pid=os.popen("pidof lyx").read().rstrip()
-            lyx_window_name=os.popen("wmctrl -l -p | grep ' " + str(lyx_pid) +  " ' | cut -d ' ' -f 1").read().rstrip()
-            if lyx_window_name != "":
-                break
+            if lyx_pid != "":
+                lyx_window_name=os.popen("wmctrl -l -p | grep ' " + str(lyx_pid) +  " ' | cut -d ' ' -f 1").read().rstrip()
+                if lyx_window_name != "":
+                    break
             print 'lyx_win: ' + lyx_window_name + '\n'
             print "Waiting for LyX to show up . . ."
             time.sleep(1)
         print 'lyx_pid: ' + lyx_pid + '\n'
         print 'lyx_win: ' + lyx_window_name + '\n'
-        time.sleep(1)
-        #RaiseWindow()
-        #sendKeystring("\Afn", lyx_pid)
     elif c[0:5] == 'Sleep':
         print "\nSleeping for " + c[6:] + "\n"
         time.sleep(float(c[6:]))
index dd2dec67f6a21dbcafcf841ca8a660128afbec3d..e83d834df40c86b393da16406d39e695f328ad5c 100755 (executable)
@@ -16,7 +16,10 @@ if [ "$1" != "" ]; then
 fi
 
 export MAX_DROP=0
-export LYX_WINDOW_NAME=$(wmctrl -l | grep -v Mozilla | grep -v Firefox | grep LyX | sed -e 's/.*\(LyX: .*\)$/\1/')
+if [ "$(pidof lyx)" != "" ]; then
+    export LYX_PID=$(pidof lyx)
+    export LYX_WINDOW_NAME=$(wmctrl -l | grep " $LYX_PID " | cut -d ' ' -f 1);
+fi
 export MAX_LOOPS=1
 export LYX_EXE=${LYX_EXE:-../../src/lyx}