@@ -137,6 +137,11 @@ def applyToFrame(target):
137137 if hasattr (target , 'GetAuiManager' ):
138138 target .GetAuiManager ().SetArtProvider (PsychopyDockArt ())
139139 target .GetAuiManager ().Update ()
140+ for menu in target .GetMenuBar ().GetMenus ():
141+ for submenu in menu [0 ].MenuItems :
142+ if isinstance (submenu .SubMenu , ThemeSwitcher ):
143+ submenu .SubMenu ._applyAppTheme ()
144+
140145
141146 def applyToPanel (target ):
142147 target .SetBackgroundColour (ThemeMixin .appColors ['panel_bg' ])
@@ -986,23 +991,21 @@ def __init__(self, frame):
986991 for theme in priority :
987992 tooltip = themeList .pop (theme )
988993 item = self .AppendRadioItem (wx .ID_ANY , _translate (theme ), tooltip )
994+ # Bind to theme change method
989995 frame .Bind (wx .EVT_MENU , frame .app .onThemeChange , item )
990- if item .ItemLabel .lower () == ThemeMixin .codetheme .lower ():
991- item .Check (True )
992- else :
993- item .Check (False )
994996 # Make other theme buttons
995997 for theme in themeList :
996998 item = self .AppendRadioItem (wx .ID_ANY , _translate (theme ), help = themeList [theme ])
997999 frame .Bind (wx .EVT_MENU , frame .app .onThemeChange , item )
998- if item .ItemLabel .lower () == ThemeMixin .codetheme .lower ():
999- item .Check (True )
1000- else :
1001- item .Check (False )
10021000 self .AppendSeparator ()
10031001 # Add Theme Folder button
10041002 item = self .Append (wx .ID_ANY , _translate ("Open theme folder" ))
10051003 frame .Bind (wx .EVT_MENU , self .openThemeFolder , item )
10061004
10071005 def openThemeFolder (self , event ):
10081006 subprocess .call ("explorer %(themes)s" % prefs .paths , shell = True )
1007+
1008+ def _applyAppTheme (self ):
1009+ for item in self .GetMenuItems ():
1010+ if item .IsRadio (): # This means it will not attempt to check the separator
1011+ item .Check (item .ItemLabel .lower () == ThemeMixin .codetheme .lower ())
0 commit comments