]> git.lyx.org Git - lyx.git/commitdiff
Some minor polishment and comments.
authorJuergen Spitzmueller <spitz@lyx.org>
Wed, 19 Jul 2017 08:22:13 +0000 (10:22 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Wed, 19 Jul 2017 08:22:13 +0000 (10:22 +0200)
3rdparty/evince_sync/README
3rdparty/evince_sync/evince_sync_lyx

index 84b3b4ff4e5f41c9a91f4a62da4684c5a6bcae4b..7b787972428fc220bb70381be4e8d8f68dfac3da 100644 (file)
@@ -37,8 +37,9 @@ of gedit-synctex-plugin by José Aliste (https://github.com/jaliste/gedit-syncte
 The work is based on a further derivation of this work for Sublime Text LaTeX Tools
 (https://github.com/SublimeText/LaTeXTools/tree/master/evince).
 
-Adaptations for the use with LyX have been done by Jürgen Spitzmüller <spitz@lyx.org>
-in 2017. 
+Adaptations for the use with LyX and the tranformation of the original evince_sync bash
+script to a python script (evince_sync_lyx) have been done by Jürgen Spitzmüller
+<spitz@lyx.org> in 2017. 
 
 
 CONTACT
index 83b8fefe89227a2afbdb71b15ef2ea7c75ea3b20..7d45c8f3070410ed5db406e87275b954f6963710 100755 (executable)
 # Street, Fifth Floor, Boston, MA  02110-1301, USA
 
 import sys, os.path
-from subprocess import Popen, call
+from subprocess import Popen
 
+# The lyxclient command for backward search
 editor_cmd = "lyxclient -g %f %l"
 
-def print_usage():
+# Check we have (only) one argument
+if len(sys.argv) != 2:
     print("Usage: evince_sync_lyx pdf_file")
     sys.exit(1)
 
-if len(sys.argv) != 2:
-    print_usage()
-
+# Arg 1 is supposed to be the PDF file
 pdf_file = os.path.abspath(sys.argv[1])
 
+# Check whether the file exists & is readable
 if not os.path.isfile(pdf_file):
-    print_usage()
+    print("%s is not valid/readable PDF file." % pdf_file)
+    sys.exit(1)
 
+# The accompanying synctex file has the same name than the PDF
+# but with .synctex.gz extension
 synctex_file, ext = os.path.splitext(pdf_file)
-
 synctex_file += ".synctex.gz"
 
+# If we have a synctex file, start the evince_backward_search script
 SyncTeX = False
-
 if os.path.isfile(synctex_file):
     bsproc = Popen(["evince_backward_search", pdf_file, editor_cmd])
     SyncTeX = True
 
+# Notwithstanding the previous, start evince and open the PDF
 vproc = Popen(['evince', pdf_file])
 vproc.wait()
 
+# If evince has been closed (hence vproc.wait()), we terminate
+# the evince_backward_search script (if we have started it)
 if SyncTeX:
     bsproc.terminate()