Show More
@@ -2,7 +2,7 b'' | |||||
2 | # -*- coding: iso-8859-15 -*- |
|
2 | # -*- coding: iso-8859-15 -*- | |
3 |
|
3 | |||
4 | import wx.aui |
|
4 | import wx.aui | |
5 |
|
5 | import sys | ||
6 | #used for about dialog |
|
6 | #used for about dialog | |
7 | from wx.lib.wordwrap import wordwrap |
|
7 | from wx.lib.wordwrap import wordwrap | |
8 |
|
8 | |||
@@ -10,6 +10,9 b' from wx.lib.wordwrap import wordwrap' | |||||
10 | from IPython.gui.wx.ipython_view import IPShellWidget |
|
10 | from IPython.gui.wx.ipython_view import IPShellWidget | |
11 | from IPython.gui.wx.ipython_history import IPythonHistoryPanel |
|
11 | from IPython.gui.wx.ipython_history import IPythonHistoryPanel | |
12 |
|
12 | |||
|
13 | #used to create options.conf file in user directory | |||
|
14 | from IPython.ipapi import get | |||
|
15 | ||||
13 | __version__ = 0.8 |
|
16 | __version__ = 0.8 | |
14 | __author__ = "Laurent Dufrechou" |
|
17 | __author__ = "Laurent Dufrechou" | |
15 | __email__ = "laurent.dufrechou _at_ gmail.com" |
|
18 | __email__ = "laurent.dufrechou _at_ gmail.com" | |
@@ -84,7 +87,9 b' class MyFrame(wx.Frame):' | |||||
84 | dlg.Destroy() |
|
87 | dlg.Destroy() | |
85 |
|
88 | |||
86 | def optionSave(self, name, value): |
|
89 | def optionSave(self, name, value): | |
87 | opt = open('options.conf','w') |
|
90 | ip = get() | |
|
91 | path = ip.IP.rc.ipythondir | |||
|
92 | opt = open(path + '/options.conf','w') | |||
88 |
|
93 | |||
89 | try: |
|
94 | try: | |
90 | options_ipython_panel = self.ipython_panel.getOptions() |
|
95 | options_ipython_panel = self.ipython_panel.getOptions() | |
@@ -98,24 +103,31 b' class MyFrame(wx.Frame):' | |||||
98 | opt.close() |
|
103 | opt.close() | |
99 |
|
104 | |||
100 | def optionLoad(self): |
|
105 | def optionLoad(self): | |
101 | opt = open('options.conf','r') |
|
106 | try: | |
102 | lines = opt.readlines() |
|
107 | ip = get() | |
103 | opt.close() |
|
108 | path = ip.IP.rc.ipythondir | |
|
109 | opt = open(path + '/options.conf','r') | |||
|
110 | lines = opt.readlines() | |||
|
111 | opt.close() | |||
104 |
|
112 | |||
105 | options_ipython_panel = self.ipython_panel.getOptions() |
|
113 | options_ipython_panel = self.ipython_panel.getOptions() | |
106 | options_history_panel = self.history_panel.getOptions() |
|
114 | options_history_panel = self.history_panel.getOptions() | |
107 |
|
115 | |||
108 | for line in lines: |
|
116 | for line in lines: | |
109 | key = line.split('=')[0] |
|
117 | key = line.split('=')[0] | |
110 | value = line.split('=')[1].replace('\n','').replace('\r','') |
|
118 | value = line.split('=')[1].replace('\n','').replace('\r','') | |
111 | if key in options_ipython_panel.keys(): |
|
119 | if key in options_ipython_panel.keys(): | |
112 | options_ipython_panel[key]['value'] = value |
|
120 | options_ipython_panel[key]['value'] = value | |
113 | elif key in options_history_panel.keys(): |
|
121 | elif key in options_history_panel.keys(): | |
114 | options_history_panel[key]['value'] = value |
|
122 | options_history_panel[key]['value'] = value | |
115 | else: |
|
123 | else: | |
116 | print >>sys.__stdout__,"Warning: key ",key,"not found in widget options. Check Options.conf" |
|
124 | print >>sys.__stdout__,"Warning: key ",key,"not found in widget options. Check Options.conf" | |
117 | self.ipython_panel.reloadOptions(options_ipython_panel) |
|
125 | self.ipython_panel.reloadOptions(options_ipython_panel) | |
118 | self.history_panel.reloadOptions(options_history_panel) |
|
126 | self.history_panel.reloadOptions(options_history_panel) | |
|
127 | ||||
|
128 | except IOError: | |||
|
129 | print >>sys.__stdout__,"Could not open Options.conf, defaulting to default values." | |||
|
130 | ||||
119 |
|
131 | |||
120 | def createMenu(self): |
|
132 | def createMenu(self): | |
121 | """local method used to create one menu bar""" |
|
133 | """local method used to create one menu bar""" |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now