diff --git a/IPython/gui/wx/options.conf b/IPython/gui/wx/options.conf deleted file mode 100644 index b202640..0000000 --- a/IPython/gui/wx/options.conf +++ /dev/null @@ -1,6 +0,0 @@ -completion=IPYTHON -background_color=BLACK -filter_empty=True -filter_magic=True -filter_doc=True -filter_cmd=True diff --git a/IPython/gui/wx/wxIPython.py b/IPython/gui/wx/wxIPython.py index 972acfa..0d0d249 100755 --- a/IPython/gui/wx/wxIPython.py +++ b/IPython/gui/wx/wxIPython.py @@ -2,7 +2,7 @@ # -*- coding: iso-8859-15 -*- import wx.aui - +import sys #used for about dialog from wx.lib.wordwrap import wordwrap @@ -10,6 +10,9 @@ from wx.lib.wordwrap import wordwrap from IPython.gui.wx.ipython_view import IPShellWidget from IPython.gui.wx.ipython_history import IPythonHistoryPanel +#used to create options.conf file in user directory +from IPython.ipapi import get + __version__ = 0.8 __author__ = "Laurent Dufrechou" __email__ = "laurent.dufrechou _at_ gmail.com" @@ -84,7 +87,9 @@ class MyFrame(wx.Frame): dlg.Destroy() def optionSave(self, name, value): - opt = open('options.conf','w') + ip = get() + path = ip.IP.rc.ipythondir + opt = open(path + '/options.conf','w') try: options_ipython_panel = self.ipython_panel.getOptions() @@ -98,24 +103,31 @@ class MyFrame(wx.Frame): opt.close() def optionLoad(self): - opt = open('options.conf','r') - lines = opt.readlines() - opt.close() + try: + ip = get() + path = ip.IP.rc.ipythondir + opt = open(path + '/options.conf','r') + lines = opt.readlines() + opt.close() - options_ipython_panel = self.ipython_panel.getOptions() - options_history_panel = self.history_panel.getOptions() - - for line in lines: - key = line.split('=')[0] - value = line.split('=')[1].replace('\n','').replace('\r','') - if key in options_ipython_panel.keys(): - options_ipython_panel[key]['value'] = value - elif key in options_history_panel.keys(): - options_history_panel[key]['value'] = value - else: - print >>sys.__stdout__,"Warning: key ",key,"not found in widget options. Check Options.conf" - self.ipython_panel.reloadOptions(options_ipython_panel) - self.history_panel.reloadOptions(options_history_panel) + options_ipython_panel = self.ipython_panel.getOptions() + options_history_panel = self.history_panel.getOptions() + + for line in lines: + key = line.split('=')[0] + value = line.split('=')[1].replace('\n','').replace('\r','') + if key in options_ipython_panel.keys(): + options_ipython_panel[key]['value'] = value + elif key in options_history_panel.keys(): + options_history_panel[key]['value'] = value + else: + print >>sys.__stdout__,"Warning: key ",key,"not found in widget options. Check Options.conf" + self.ipython_panel.reloadOptions(options_ipython_panel) + self.history_panel.reloadOptions(options_history_panel) + + except IOError: + print >>sys.__stdout__,"Could not open Options.conf, defaulting to default values." + def createMenu(self): """local method used to create one menu bar"""