Show More
@@ -190,6 +190,7 class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp): | |||||
190 | kernel_manager.start_channels() |
|
190 | kernel_manager.start_channels() | |
191 | widget = self.widget_factory(config=self.config, |
|
191 | widget = self.widget_factory(config=self.config, | |
192 | local_kernel=True) |
|
192 | local_kernel=True) | |
|
193 | self.init_colors(widget) | |||
193 | widget.kernel_manager = kernel_manager |
|
194 | widget.kernel_manager = kernel_manager | |
194 | widget._existing = False |
|
195 | widget._existing = False | |
195 | widget._may_close = True |
|
196 | widget._may_close = True | |
@@ -212,6 +213,7 class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp): | |||||
212 | kernel_manager.start_channels() |
|
213 | kernel_manager.start_channels() | |
213 | widget = self.widget_factory(config=self.config, |
|
214 | widget = self.widget_factory(config=self.config, | |
214 | local_kernel=False) |
|
215 | local_kernel=False) | |
|
216 | self.init_colors(widget) | |||
215 | widget._existing = True |
|
217 | widget._existing = True | |
216 | widget._may_close = False |
|
218 | widget._may_close = False | |
217 | widget._confirm_exit = False |
|
219 | widget._confirm_exit = False | |
@@ -230,6 +232,7 class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp): | |||||
230 | local_kernel = (not self.existing) or self.ip in LOCAL_IPS |
|
232 | local_kernel = (not self.existing) or self.ip in LOCAL_IPS | |
231 | self.widget = self.widget_factory(config=self.config, |
|
233 | self.widget = self.widget_factory(config=self.config, | |
232 | local_kernel=local_kernel) |
|
234 | local_kernel=local_kernel) | |
|
235 | self.init_colors(self.widget) | |||
233 | self.widget._existing = self.existing |
|
236 | self.widget._existing = self.existing | |
234 | self.widget._may_close = not self.existing |
|
237 | self.widget._may_close = not self.existing | |
235 | self.widget._confirm_exit = self.confirm_exit |
|
238 | self.widget._confirm_exit = self.confirm_exit | |
@@ -246,7 +249,7 class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp): | |||||
246 |
|
249 | |||
247 | self.window.setWindowTitle('Python' if self.pure else 'IPython') |
|
250 | self.window.setWindowTitle('Python' if self.pure else 'IPython') | |
248 |
|
251 | |||
249 | def init_colors(self): |
|
252 | def init_colors(self, widget): | |
250 | """Configure the coloring of the widget""" |
|
253 | """Configure the coloring of the widget""" | |
251 | # Note: This will be dramatically simplified when colors |
|
254 | # Note: This will be dramatically simplified when colors | |
252 | # are removed from the backend. |
|
255 | # are removed from the backend. | |
@@ -264,6 +267,10 class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp): | |||||
264 | style = self.config.IPythonWidget.syntax_style |
|
267 | style = self.config.IPythonWidget.syntax_style | |
265 | except AttributeError: |
|
268 | except AttributeError: | |
266 | style = None |
|
269 | style = None | |
|
270 | try: | |||
|
271 | sheet = self.config.IPythonWidget.style_sheet | |||
|
272 | except AttributeError: | |||
|
273 | sheet = None | |||
267 |
|
274 | |||
268 | # find the value for colors: |
|
275 | # find the value for colors: | |
269 | if colors: |
|
276 | if colors: | |
@@ -284,30 +291,27 class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp): | |||||
284 | else: |
|
291 | else: | |
285 | colors=None |
|
292 | colors=None | |
286 |
|
293 | |||
287 |
# Configure the style |
|
294 | # Configure the style | |
288 | widget = self.widget |
|
|||
289 | if style: |
|
295 | if style: | |
290 | widget.style_sheet = styles.sheet_from_template(style, colors) |
|
296 | widget.style_sheet = styles.sheet_from_template(style, colors) | |
291 | widget.syntax_style = style |
|
297 | widget.syntax_style = style | |
292 | widget._syntax_style_changed() |
|
298 | widget._syntax_style_changed() | |
293 | widget._style_sheet_changed() |
|
299 | widget._style_sheet_changed() | |
294 | elif colors: |
|
300 | elif colors: | |
295 | # use a default style |
|
301 | # use a default dark/light/bw style | |
296 | widget.set_default_style(colors=colors) |
|
302 | widget.set_default_style(colors=colors) | |
297 | else: |
|
|||
298 | # this is redundant for now, but allows the widget's |
|
|||
299 | # defaults to change |
|
|||
300 | widget.set_default_style() |
|
|||
301 |
|
303 | |||
302 | if self.stylesheet: |
|
304 | if self.stylesheet: | |
303 | # we got an expicit stylesheet |
|
305 | # we got an explicit stylesheet | |
304 | if os.path.isfile(self.stylesheet): |
|
306 | if os.path.isfile(self.stylesheet): | |
305 | with open(self.stylesheet) as f: |
|
307 | with open(self.stylesheet) as f: | |
306 | sheet = f.read() |
|
308 | sheet = f.read() | |
307 | widget.style_sheet = sheet |
|
|||
308 | widget._style_sheet_changed() |
|
|||
309 | else: |
|
309 | else: | |
310 | raise IOError("Stylesheet %r not found."%self.stylesheet) |
|
310 | raise IOError("Stylesheet %r not found." % self.stylesheet) | |
|
311 | if sheet: | |||
|
312 | widget.style_sheet = sheet | |||
|
313 | widget._style_sheet_changed() | |||
|
314 | ||||
311 |
|
315 | |||
312 | def init_signal(self): |
|
316 | def init_signal(self): | |
313 | """allow clean shutdown on sigint""" |
|
317 | """allow clean shutdown on sigint""" | |
@@ -327,7 +331,6 class IPythonQtConsoleApp(BaseIPythonApplication, IPythonConsoleApp): | |||||
327 | super(IPythonQtConsoleApp, self).initialize(argv) |
|
331 | super(IPythonQtConsoleApp, self).initialize(argv) | |
328 | IPythonConsoleApp.initialize(self,argv) |
|
332 | IPythonConsoleApp.initialize(self,argv) | |
329 | self.init_qt_elements() |
|
333 | self.init_qt_elements() | |
330 | self.init_colors() |
|
|||
331 | self.init_signal() |
|
334 | self.init_signal() | |
332 |
|
335 | |||
333 | def start(self): |
|
336 | def start(self): |
General Comments 0
You need to be logged in to leave comments.
Login now