3 # Copyright (C) 2010 Jose Aliste <jose.aliste@gmail.com>
4 # 2011 Benjamin Kellermann <Benjamin.Kellermann@tu-dresden.de>
6 # Translated from Bash to Python by Juergen Spitzmueller <spitz@lyx.org> 2017.
8 # This program is free software; you can redistribute it and/or modify it under
9 # the terms of the GNU General Public Licence as published by the Free Software
10 # Foundation; either version 2 of the Licence, or (at your option) any later
13 # This program is distributed in the hope that it will be useful, but WITHOUT
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 # FOR A PARTICULAR PURPOSE. See the GNU General Public Licence for more
18 # You should have received a copy of the GNU General Public Licence along with
19 # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
20 # Street, Fifth Floor, Boston, MA 02110-1301, USA
23 from subprocess import Popen, call
25 editor_cmd = "lyxclient -g %f %l"
28 print("Usage: evince_sync_lyx pdf_file")
31 if len(sys.argv) != 2:
34 pdf_file = os.path.abspath(sys.argv[1])
36 if not os.path.isfile(pdf_file):
39 synctex_file, ext = os.path.splitext(pdf_file)
41 synctex_file += ".synctex.gz"
45 if os.path.isfile(synctex_file):
46 bsproc = Popen(["evince_backward_search", pdf_file, editor_cmd])
49 vproc = Popen(['evince', pdf_file])