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