Fix syntax style switching for PySide
@@ -6,6 +6,7 @@ common actions.
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
+from functools import partial
import sys
import webbrowser
from threading import Thread
@@ -625,11 +626,9 @@ class MainWindow(QtWidgets.QMainWindow):
self.syntax_style_menu = self.view_menu.addMenu("&Syntax Style")
style_group = QtWidgets.QActionGroup(self)
for style in available_syntax_styles:
- action = QtWidgets.QAction("{}".format(style), self,
- triggered=lambda v,
- syntax_style=style:
- self.set_syntax_style(
- syntax_style=syntax_style))
+ action = QtWidgets.QAction("{}".format(style), self)
+ action.triggered.connect(partial(self.set_syntax_style,
+ style))
action.setCheckable(True)
style_group.addAction(action)
self.syntax_style_menu.addAction(action)
