@@ -184,9 +184,6 @@ def app_action(*args):
184184 self .ui .add_ui_from_file (ui_file )
185185 self .widget .set_show_menubar (False )
186186
187- self .tab_switch_actiongroup = None
188- self .tab_switch_merge_id = None
189-
190187 for menuitem in ("Save" , "Undo" ):
191188 self .actiongroup .get_action (menuitem ).props .is_important = True
192189 self .widget .add_accel_group (self .ui .get_accel_group ())
@@ -410,10 +407,6 @@ def on_switch_page(self, notebook, page, which):
410407
411408 def after_switch_page (self , notebook , page , which ):
412409 self ._update_page_action_sensitivity ()
413- actiongroup = self .tab_switch_actiongroup
414- if actiongroup :
415- action_name = "SwitchTab%d" % which
416- actiongroup .get_action (action_name ).set_active (True )
417410
418411 def after_page_reordered (self , notebook , page , page_num ):
419412 self ._update_page_action_sensitivity ()
@@ -431,13 +424,6 @@ def on_notebook_label_changed(self, component, text, tooltip):
431424 text = text .encode ('utf8' )
432425 self .notebook .child_set_property (page , "menu-label" , text )
433426
434- actiongroup = self .tab_switch_actiongroup
435- if actiongroup :
436- idx = self .notebook .page_num (page )
437- action_name = "SwitchTab%d" % idx
438- label = text .replace ("_" , "__" )
439- actiongroup .get_action (action_name ).set_label (label )
440-
441427 def on_can_undo (self , undosequence , can ):
442428 self .actiongroup .get_action ("Undo" ).set_sensitive (can )
443429
@@ -563,48 +549,6 @@ def on_move_tab_next(self, *args):
563549 child = self .notebook .get_nth_page (page_num )
564550 self .notebook .reorder_child (child , page_num + 1 )
565551
566- def _update_notebook_menu (self , * args ):
567- if self .tab_switch_merge_id :
568- self .ui .remove_ui (self .tab_switch_merge_id )
569- self .ui .remove_action_group (self .tab_switch_actiongroup )
570- self .ui .ensure_update ()
571- self .tab_switch_merge_id = None
572- self .tab_switch_actiongroup = None
573-
574- if not self .notebook .get_n_pages ():
575- return
576-
577- self .tab_switch_merge_id = self .ui .new_merge_id ()
578- self .tab_switch_actiongroup = Gtk .ActionGroup (name = "TabSwitchActions" )
579- self .ui .insert_action_group (self .tab_switch_actiongroup )
580- group = None
581- current_page = self .notebook .get_current_page ()
582- for i in range (self .notebook .get_n_pages ()):
583- page = self .notebook .get_nth_page (i )
584- label = self .notebook .get_menu_label_text (page ) or ""
585- label = label .replace ("_" , "__" )
586- name = "SwitchTab%d" % i
587- tooltip = _ ("Switch to this tab" )
588- action = Gtk .RadioAction (
589- name = name , label = label , tooltip = tooltip ,
590- stock_id = None , value = i )
591- action .join_group (group )
592- group = action
593- action .set_active (current_page == i )
594-
595- def current_tab_changed_cb (action , current ):
596- if action == current :
597- self .notebook .set_current_page (action .get_current_value ())
598- action .connect ("changed" , current_tab_changed_cb )
599- if i < 10 :
600- accel = "<Alt>%d" % ((i + 1 ) % 10 )
601- else :
602- accel = None
603- self .tab_switch_actiongroup .add_action_with_accel (action , accel )
604- self .ui .add_ui (self .tab_switch_merge_id ,
605- "/Menubar/TabMenu/TabPlaceholder" ,
606- name , name , Gtk .UIManagerItemType .MENUITEM , False )
607-
608552 def page_removed (self , page , status ):
609553 if hasattr (page , 'scheduler' ):
610554 self .scheduler .remove_scheduler (page .scheduler )
0 commit comments