##// END OF EJS Templates
check win32clipboard existence instead of platform==win32
vivainio -
Show More
@@ -8,7 +8,11 b' from string import Template'
8 import sys
8 import sys
9
9
10 def toclip_w32(s):
10 def toclip_w32(s):
11 """ places contents of s to clipboard """
11 """ places contents of s to clipboard
12
13 Needs pyvin32 to work:
14 http://sourceforge.net/projects/pywin32/
15 """
12 import win32clipboard as cl
16 import win32clipboard as cl
13 import win32con
17 import win32con
14 cl.OpenClipboard()
18 cl.OpenClipboard()
@@ -16,9 +20,10 b' def toclip_w32(s):'
16 cl.SetClipboardText( s )
20 cl.SetClipboardText( s )
17 cl.CloseClipboard()
21 cl.CloseClipboard()
18
22
19 if sys.platform == 'win32':
23 try:
24 import win32clipboard
20 toclip = toclip_w32
25 toclip = toclip_w32
21 else:
26 except ImportError:
22 def toclip(s): pass
27 def toclip(s): pass
23
28
24
29
@@ -41,5 +46,5 b' def render(tmpl):'
41 toclip(res)
46 toclip(res)
42 return res
47 return res
43
48
44 ip.user_ns['render'] = render
49 ip.to_user_ns('render')
45 No newline at end of file
50
General Comments 0
You need to be logged in to leave comments. Login now