##// END OF EJS Templates
Update a few observer and .tag(config=True) to match new traitlets API.
Matthias Bussonnier -
Show More
@@ -32,7 +32,7 b' from IPython.core.profiledir import ProfileDir'
32 from IPython.utils.importstring import import_item
32 from IPython.utils.importstring import import_item
33 from IPython.paths import get_ipython_dir, get_ipython_package_dir
33 from IPython.paths import get_ipython_dir, get_ipython_package_dir
34 from IPython.utils import py3compat
34 from IPython.utils import py3compat
35 from traitlets import Unicode, Bool, Dict
35 from traitlets import Unicode, Bool, Dict, observe
36
36
37 #-----------------------------------------------------------------------------
37 #-----------------------------------------------------------------------------
38 # Constants
38 # Constants
@@ -149,14 +149,14 b' class ProfileList(Application):'
149 )
149 )
150 ))
150 ))
151
151
152 ipython_dir = Unicode(get_ipython_dir(), config=True,
152 ipython_dir = Unicode(get_ipython_dir(),
153 help="""
153 help="""
154 The name of the IPython directory. This directory is used for logging
154 The name of the IPython directory. This directory is used for logging
155 configuration (through profiles), history storage, etc. The default
155 configuration (through profiles), history storage, etc. The default
156 is usually $HOME/.ipython. This options can also be specified through
156 is usually $HOME/.ipython. This options can also be specified through
157 the environment variable IPYTHONDIR.
157 the environment variable IPYTHONDIR.
158 """
158 """
159 )
159 ).tag(config=True)
160
160
161
161
162 def _print_profiles(self, profiles):
162 def _print_profiles(self, profiles):
@@ -211,15 +211,18 b' class ProfileCreate(BaseIPythonApplication):'
211 name = u'ipython-profile'
211 name = u'ipython-profile'
212 description = create_help
212 description = create_help
213 examples = _create_examples
213 examples = _create_examples
214 auto_create = Bool(True, config=False)
214 auto_create = Bool(True)
215 def _log_format_default(self):
215 def _log_format_default(self):
216 return "[%(name)s] %(message)s"
216 return "[%(name)s] %(message)s"
217
217
218 def _copy_config_files_default(self):
218 def _copy_config_files_default(self):
219 return True
219 return True
220
220
221 parallel = Bool(False, config=True,
221 parallel = Bool(False,
222 help="whether to include parallel computing config files")
222 help="whether to include parallel computing config files"
223 ).tag(config=True)
224
225 @observe('parallel')
223 def _parallel_changed(self, name, old, new):
226 def _parallel_changed(self, name, old, new):
224 parallel_files = [ 'ipcontroller_config.py',
227 parallel_files = [ 'ipcontroller_config.py',
225 'ipengine_config.py',
228 'ipengine_config.py',
@@ -285,6 +285,7 b' class PromptManager(Configurable):'
285
285
286 # The number of characters in each prompt which don't contribute to width
286 # The number of characters in each prompt which don't contribute to width
287 invisible_chars = Dict()
287 invisible_chars = Dict()
288
288 @default('invisible_chars')
289 @default('invisible_chars')
289 def _invisible_chars_default(self):
290 def _invisible_chars_default(self):
290 return {'in': 0, 'in2': 0, 'out': 0, 'rewrite':0}
291 return {'in': 0, 'in2': 0, 'out': 0, 'rewrite':0}
@@ -321,7 +322,9 b' class PromptManager(Configurable):'
321 invis_chars = _invisible_characters(self._render(name, color=True))
322 invis_chars = _invisible_characters(self._render(name, color=True))
322 self.invisible_chars[name] = invis_chars
323 self.invisible_chars[name] = invis_chars
323
324
324 def _update_prompt_trait(self, traitname, new_template):
325 def _update_prompt_trait(self, changes):
326 traitname = changes['name']
327 new_template = changes['new']
325 name = traitname[:-9] # Cut off '_template'
328 name = traitname[:-9] # Cut off '_template'
326 self.update_prompt(name, new_template)
329 self.update_prompt(name, new_template)
327
330
General Comments 0
You need to be logged in to leave comments. Login now