##// END OF EJS Templates
Minor work on how ipythondir is handled.
Brian Granger -
Show More
@@ -165,7 +165,7 b' class Component(HasTraitlets):'
165 else:
165 else:
166 self.name = name
166 self.name = name
167 self.root = self # This is the default, it is set when parent is set
167 self.root = self # This is the default, it is set when parent is set
168 self.parent = parent
168 self.parent = parent
169 if config is not None:
169 if config is not None:
170 self.config = deepcopy(config)
170 self.config = deepcopy(config)
171 else:
171 else:
@@ -58,7 +58,7 b' from IPython.utils.strdispatch import StrDispatch'
58 from IPython.utils.platutils import toggle_set_term_title, set_term_title
58 from IPython.utils.platutils import toggle_set_term_title, set_term_title
59
59
60 from IPython.utils.traitlets import (
60 from IPython.utils.traitlets import (
61 Int, Float, Str, CBool, CaselessStrEnum, Enum, List
61 Int, Float, Str, CBool, CaselessStrEnum, Enum, List, Unicode
62 )
62 )
63
63
64 #-----------------------------------------------------------------------------
64 #-----------------------------------------------------------------------------
@@ -232,6 +232,7 b' class InteractiveShell(Component, Magic):'
232 editor = Str(get_default_editor(), config_key='EDITOR')
232 editor = Str(get_default_editor(), config_key='EDITOR')
233 filename = Str("<ipython console>")
233 filename = Str("<ipython console>")
234 interactive = CBool(False, config_key='INTERACTIVE')
234 interactive = CBool(False, config_key='INTERACTIVE')
235 ipythondir= Unicode('', config_key='IPYTHONDIR') # Set to os.getcwd() in __init__
235 logstart = CBool(False, config_key='LOGSTART')
236 logstart = CBool(False, config_key='LOGSTART')
236 logfile = Str('', config_key='LOGFILE')
237 logfile = Str('', config_key='LOGFILE')
237 logplay = Str('', config_key='LOGPLAY')
238 logplay = Str('', config_key='LOGPLAY')
@@ -294,7 +295,7 b' class InteractiveShell(Component, Magic):'
294 # Subclasses with thread support should override this as needed.
295 # Subclasses with thread support should override this as needed.
295 isthreaded = False
296 isthreaded = False
296
297
297 def __init__(self, parent=None, config=None, usage=None,
298 def __init__(self, parent=None, ipythondir=None, config=None, usage=None,
298 user_ns=None, user_global_ns=None,
299 user_ns=None, user_global_ns=None,
299 banner1=None, banner2=None,
300 banner1=None, banner2=None,
300 custom_exceptions=((),None), embedded=False):
301 custom_exceptions=((),None), embedded=False):
@@ -305,6 +306,7 b' class InteractiveShell(Component, Magic):'
305 # passing it to children components.
306 # passing it to children components.
306 super(InteractiveShell, self).__init__(parent, config=config, name='__IP')
307 super(InteractiveShell, self).__init__(parent, config=config, name='__IP')
307
308
309 self.init_ipythondir(ipythondir)
308 self.init_instance_attrs()
310 self.init_instance_attrs()
309 self.init_term_title()
311 self.init_term_title()
310 self.init_usage(usage)
312 self.init_usage(usage)
@@ -367,6 +369,16 b' class InteractiveShell(Component, Magic):'
367 # init_* methods called by __init__
369 # init_* methods called by __init__
368 #-------------------------------------------------------------------------
370 #-------------------------------------------------------------------------
369
371
372 def init_ipythondir(self, ipythondir):
373 if ipythondir is not None:
374 self.ipythondir = ipythondir
375 return
376
377 if not hasattr(self.config, 'IPYTHONDIR'):
378 # cdw is always defined
379 self.ipythondir = os.getcwd()
380 return
381
370 def init_instance_attrs(self):
382 def init_instance_attrs(self):
371 self.jobs = BackgroundJobManager()
383 self.jobs = BackgroundJobManager()
372 self.more = False
384 self.more = False
General Comments 0
You need to be logged in to leave comments. Login now