##// END OF EJS Templates
freeze_term_title for platutils_posix
Ville M. Vainio -
Show More
@@ -1,41 +1,47 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """ Platform specific utility functions, posix version
2 """ Platform specific utility functions, posix 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 sys
23 import sys
24 import os
24 import os
25
25
26 ignore_termtitle = False
26
27
27 def _dummy_op(*a, **b):
28 def _dummy_op(*a, **b):
28 """ A no-op function """
29 """ A no-op function """
29
30
30 def _set_term_title_xterm(title):
31 def _set_term_title_xterm(title):
31 """ Change virtual terminal title in xterm-workalikes """
32 """ Change virtual terminal title in xterm-workalikes """
33
34 if ignore_termtitle:
35 return
36
32 sys.stdout.write('\033]%d;%s\007' % (0,title))
37 sys.stdout.write('\033]%d;%s\007' % (0,title))
33
38
34
39
35 if os.environ.get('TERM','') == 'xterm':
40 if os.environ.get('TERM','') == 'xterm':
36 set_term_title = _set_term_title_xterm
41 set_term_title = _set_term_title_xterm
37 else:
42 else:
38 set_term_title = _dummy_op
43 set_term_title = _dummy_op
39
44
40 freeze_term_title = _dummy_op
45 def freeze_term_title():
41
46 global ignore_termtitle
47 ignore_termtitle = True
General Comments 0
You need to be logged in to leave comments. Login now