##// END OF EJS Templates
applied jorgens platutils patch to set_term_title wchar support
vivainio -
Show More
@@ -1,53 +1,53 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """ Platform specific utility functions, win32 version
2 """ Platform specific utility functions, win32 version
3
3
4 Importing this module directly is not portable - rather, import platutils
4 Importing this module directly is not portable - rather, import platutils
5 to use these functions in platform agnostic fashion.
5 to use these functions in platform agnostic fashion.
6
6
7 $Id: ipstruct.py 1005 2006-01-12 08:39:26Z fperez $
7 $Id: ipstruct.py 1005 2006-01-12 08:39:26Z fperez $
8
8
9 """
9 """
10
10
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
13 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
14 #
14 #
15 # Distributed under the terms of the BSD License. The full license is in
15 # Distributed under the terms of the BSD License. The full license is in
16 # the file COPYING, distributed as part of this software.
16 # the file COPYING, distributed as part of this software.
17 #*****************************************************************************
17 #*****************************************************************************
18
18
19 from IPython import Release
19 from IPython import Release
20 __author__ = '%s <%s>' % Release.authors['Ville']
20 __author__ = '%s <%s>' % Release.authors['Ville']
21 __license__ = Release.license
21 __license__ = Release.license
22
22
23 import os
23 import os
24
24
25 ignore_termtitle = 0
25 ignore_termtitle = 0
26
26
27 try:
27 try:
28 from ctypes import windll
28 import ctypes
29 SetConsoleTitleA=windll.kernel32.SetConsoleTitleA
29 SetConsoleTitleW=ctypes.windll.kernel32.SetConsoleTitleW
30
30 SetConsoleTitleW.argtypes=[ctypes.c_wchar_p]
31 def _set_term_title(title):
31 def _set_term_title(title):
32 """ Set terminal title using the ctypes"""
32 """ Set terminal title using the ctypes"""
33 SetConsoleTitleA(str(title))
33 SetConsoleTitleW(title)
34
34
35 except ImportError:
35 except ImportError:
36 def _set_term_title(title):
36 def _set_term_title(title):
37 """ Set terminal title using the 'title' command """
37 """ Set terminal title using the 'title' command """
38 curr=os.getcwd()
38 curr=os.getcwd()
39 os.chdir("C:") #Cannot be on network share when issuing system commands
39 os.chdir("C:") #Cannot be on network share when issuing system commands
40 ret = os.system("title " + title)
40 ret = os.system("title " + title)
41 os.chdir(curr)
41 os.chdir(curr)
42 if ret:
42 if ret:
43 ignore_termtitle = 1
43 ignore_termtitle = 1
44
44
45 def set_term_title(title):
45 def set_term_title(title):
46 """ Set terminal title using the 'title' command """
46 """ Set terminal title using the 'title' command """
47 global ignore_termtitle
47 global ignore_termtitle
48
48
49 if ignore_termtitle:
49 if ignore_termtitle:
50 return
50 return
51 _set_term_title(title)
51 _set_term_title(title)
52
52
53
53
General Comments 0
You need to be logged in to leave comments. Login now