forked from SublimeText/LaTeXTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskim_viewer.py
67 lines (50 loc) · 1.61 KB
/
skim_viewer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from base_viewer import BaseViewer
import os
from latextools_utils.external_command import check_output, external_command
class SkimViewer(BaseViewer):
def forward_sync(self, pdf_file, tex_file, line, col, **kwargs):
keep_focus = kwargs.pop('keep_focus', True)
path_to_skim = '/Applications/Skim.app'
if not os.path.exists(path_to_skim):
path_to_skim = check_output([
'osascript',
'-e',
'POSIX path of (path to app id "net.sourceforge.skim-app.skim")'
], use_texpath=False)
command = [
os.path.join(
path_to_skim,
'Contents',
'SharedSupport',
'displayline'
),
'-r'
]
if keep_focus:
command.append('-g')
command += [
str(line), pdf_file, tex_file
]
external_command(command, use_texpath=False)
def view_file(self, pdf_file, **kwargs):
keep_focus = kwargs.pop('keep_focus', True)
command = [
'/bin/sh',
os.path.normpath(
os.path.join(
os.path.dirname(__file__),
'..',
'skim',
'displayfile'
)
),
'-r'
]
if keep_focus:
command.append('-g')
command.append(pdf_file)
external_command(command, use_texpath=False)
def supports_keep_focus(self):
return True
def supports_platform(self, platform):
return platform == 'osx'