##// END OF EJS Templates
Make set_term_title() default to no-op, as it can cause problems....
Fernando Perez -
Show More
@@ -12,10 +12,6 b' for your operation system, from platutils_PLATFORMNAME module.'
12 12 # the file COPYING, distributed as part of this software.
13 13 #*****************************************************************************
14 14
15 from IPython import Release
16 __author__ = '%s <%s>' % Release.authors['Ville']
17 __license__ = Release.license
18
19 15 import os
20 16 import sys
21 17
@@ -35,8 +31,26 b' else:'
35 31 # Functionality that's logically common to all platforms goes here, each
36 32 # platform-specific module only provides the bits that are OS-dependent.
37 33
38 def freeze_term_title():
39 _platutils.ignore_termtitle = True
34 # XXX - I'm still not happy with a module global for this, but at least now
35 # there is a public, cross-platform way of toggling the term title control on
36 # and off. We should make this a stateful object later on so that each user
37 # can have its own instance if needed.
38 def toggle_set_term_title(val):
39 """Control whether set_term_title is active or not.
40
41 set_term_title() allows writing to the console titlebar. In embedded
42 widgets this can cause problems, so this call can be used to toggle it on
43 or off as needed.
44
45 The default state of the module is for the function to be disabled.
46
47 Parameters
48 ----------
49 val : bool
50 If True, set_term_title() actually writes to the terminal (using the
51 appropriate platform-specific module). If False, it is a no-op.
52 """
53 _platutils.ignore_termtitle = not(val)
40 54
41 55
42 56 def set_term_title(title):
@@ -45,3 +59,12 b' def set_term_title(title):'
45 59 if _platutils.ignore_termtitle:
46 60 return
47 61 _platutils.set_term_title(title)
62
63
64 #-----------------------------------------------------------------------------
65 # Deprecated functions
66 #-----------------------------------------------------------------------------
67 def freeze_term_title():
68 warnings.warn("This function is deprecated, use toggle_set_term_title()")
69 _platutils.ignore_termtitle = True
70
@@ -12,14 +12,10 b' to use these functions in platform agnostic fashion.'
12 12 # the file COPYING, distributed as part of this software.
13 13 #*****************************************************************************
14 14
15 from IPython import Release
16 __author__ = '%s <%s>' % Release.authors['Ville']
17 __license__ = Release.license
18
19 15 import sys
20 16 import os
21 17
22 ignore_termtitle = False
18 ignore_termtitle = True
23 19
24 20 def _dummy_op(*a, **b):
25 21 """ A no-op function """
@@ -27,7 +23,7 b' def _dummy_op(*a, **b):'
27 23 def _set_term_title_xterm(title):
28 24 """ Change virtual terminal title in xterm-workalikes """
29 25
30 sys.stdout.write('\033]%d;%s\007' % (0,title))
26 sys.stdout.write('\033]0;%s\007' % title)
31 27
32 28
33 29 if os.environ.get('TERM','') == 'xterm':
@@ -12,13 +12,10 b' to use these functions in platform agnostic fashion.'
12 12 # the file COPYING, distributed as part of this software.
13 13 #*****************************************************************************
14 14
15 from IPython import Release
16 __author__ = '%s <%s>' % Release.authors['Ville']
17 __license__ = Release.license
18 15
19 16 import os
20 17
21 ignore_termtitle = False
18 ignore_termtitle = True
22 19
23 20 try:
24 21 import ctypes
General Comments 0
You need to be logged in to leave comments. Login now