@@ -30,9 +30,10 @@ def fn_name(): return sys._getframe(1).f_code.co_name
3030from  matplotlib ._pylab_helpers  import  Gcf 
3131from  matplotlib .backend_bases  import  RendererBase , GraphicsContextBase , \
3232     FigureManagerBase , FigureCanvasBase , NavigationToolbar2 , cursors , TimerBase 
33- from  matplotlib .backend_bases  import  ShowBase , ToolContainerBase , NavigationBase 
34- from  matplotlib .backend_tools  import  SaveFigureBase , ConfigureSubplotsBase , \
35-     tools , toolbar_tools , SetCursorBase , RubberbandBase 
33+ from  matplotlib .backend_bases  import  (ShowBase , ToolContainerBase ,
34+                                       NavigationBase , StatusbarBase )
35+ from  matplotlib .backend_tools  import  (SaveFigureBase , ConfigureSubplotsBase ,
36+     tools , toolbar_tools , SetCursorBase , RubberbandBase )
3637
3738from  matplotlib .cbook  import  is_string_like , is_writable_file_like 
3839from  matplotlib .colors  import  colorConverter 
@@ -416,22 +417,30 @@ def __init__(self, canvas, num):
416417        self .canvas .show ()
417418
418419        self .vbox .pack_start (self .canvas , True , True , 0 )
420+         # calculate size for window 
421+         w  =  int  (self .canvas .figure .bbox .width )
422+         h  =  int  (self .canvas .figure .bbox .height )
419423
420424        self .navigation  =  self ._get_navigation ()
421425        self .toolbar  =  self ._get_toolbar ()
426+         self .statusbar  =  None 
427+ 
428+         def  add_widget (child , expand , fill , padding ):
429+             child .show ()
430+             self .vbox .pack_end (child , False , False , 0 )
431+             size_request  =  child .size_request ()
432+             return  size_request .height 
433+ 
422434        if  matplotlib .rcParams ['toolbar' ] ==  'navigation' :
423435            self .navigation .add_tools (tools )
424436            self .toolbar .add_tools (toolbar_tools )
425- 
426-         # calculate size for window 
427-         w  =  int  (self .canvas .figure .bbox .width )
428-         h  =  int  (self .canvas .figure .bbox .height )
437+             self .statusbar  =  StatusbarGTK3 (self .navigation )
438+             h  +=  add_widget (self .statusbar , False , False , 0 )
439+             h  +=  add_widget (Gtk .HSeparator (), False , False , 0 )
429440
430441        if  self .toolbar  is  not None :
431442            self .toolbar .show ()
432-             self .vbox .pack_end (self .toolbar , False , False , 0 )
433-             size_request  =  self .toolbar .size_request ()
434-             h  +=  size_request .height 
443+             h  +=  add_widget (self .toolbar , False , False , 0 )
435444
436445        self .window .set_default_size  (w , h )
437446
@@ -767,23 +776,6 @@ def __init__(self, navigation):
767776        self .pack_start (self ._toolbar , False , False , 0 )
768777        self ._toolbar .show_all ()
769778        self ._toolitems  =  {}
770-         self ._setup_message_area ()
771- 
772-     def  _setup_message_area (self ):
773-         box  =  Gtk .Box ()
774-         box .set_property ("orientation" , Gtk .Orientation .HORIZONTAL )
775-         sep  =  Gtk .Separator ()
776-         sep .set_property ("orientation" , Gtk .Orientation .VERTICAL )
777-         box .pack_start (sep , False , True , 0 )
778-         self .message  =  Gtk .Label ()
779-         box .pack_end (self .message , False , False , 0 )
780-         self .pack_end (box , False , False , 5 )
781-         box .show_all ()
782- 
783-         sep  =  Gtk .Separator ()
784-         sep .set_property ("orientation" , Gtk .Orientation .HORIZONTAL )
785-         self .pack_end (sep , False , True , 0 )
786-         sep .show_all ()
787779
788780    def  add_toolitem (self , name , group , position , image_file , description ,
789781                     toggle ):
@@ -811,9 +803,6 @@ def add_toolitem(self, name, group, position, image_file, description,
811803    def  _call_tool (self , btn , name ):
812804        self .trigger_tool (name )
813805
814-     def  set_message (self , s ):
815-         self .message .set_label (s )
816- 
817806    def  toggle_toolitem (self , name , toggled ):
818807        if  name  not  in self ._toolitems :
819808            return 
@@ -824,9 +813,9 @@ def toggle_toolitem(self, name, toggled):
824813
825814    def  remove_toolitem (self , name ):
826815        if  name  not  in self ._toolitems :
827-             self .set_message ('%s Not in toolbar'  %  name )
816+             self .navigation . message_event ('%s Not in toolbar'  %  name ,  self )
828817            return 
829-         for  toolitem , signal  in  self ._toolitems [name ]:
818+         for  toolitem , _signal  in  self ._toolitems [name ]:
830819            self ._toolbar .remove (toolitem )
831820        del  self ._toolitems [name ]
832821
@@ -837,6 +826,17 @@ def add_separator(self, pos=-1):
837826        return  toolitem 
838827
839828
829+ class  StatusbarGTK3 (StatusbarBase , Gtk .Statusbar ):
830+     def  __init__ (self , * args , ** kwargs ):
831+         StatusbarBase .__init__ (self , * args , ** kwargs )
832+         Gtk .Statusbar .__init__ (self )
833+         self ._context  =  self .get_context_id ('message' )
834+ 
835+     def  set_message (self , s ):
836+         self .pop (self ._context )
837+         self .push (self ._context , s )
838+ 
839+ 
840840class  SaveFigureGTK3 (SaveFigureBase ):
841841
842842    def  get_filechooser (self ):
0 commit comments