controls/EnhancedStatusBar.py
changeset 1741 dd94b9a68c61
parent 1736 7e61baa047f0
child 1744 69dfdb26f600
equal deleted inserted replaced
1740:b789b695b5c6 1741:dd94b9a68c61
    99         self._parent = parent
    99         self._parent = parent
   100 
   100 
   101         wx.EVT_SIZE(self, self.OnSize)
   101         wx.EVT_SIZE(self, self.OnSize)
   102         wx.CallAfter(self.OnSize, None)
   102         wx.CallAfter(self.OnSize, None)
   103 
   103 
   104 
       
   105     def OnSize(self, event):
   104     def OnSize(self, event):
   106         """Handles The wx.EVT_SIZE Events For The StatusBar.
   105         """Handles The wx.EVT_SIZE Events For The StatusBar.
   107 
   106 
   108         Actually, All The Calculations Linked To HorizontalAlignment And
   107         Actually, All The Calculations Linked To HorizontalAlignment And
   109         VerticalAlignment Are Done In This Function."""
   108         VerticalAlignment Are Done In This Function."""
   190                 elif verticalalignment == ESB_ALIGN_TOP:
   189                 elif verticalalignment == ESB_ALIGN_TOP:
   191                     widget.SetPosition((xpos, rect.y))
   190                     widget.SetPosition((xpos, rect.y))
   192                 elif verticalalignment == ESB_ALIGN_BOTTOM:
   191                 elif verticalalignment == ESB_ALIGN_BOTTOM:
   193                     widget.SetPosition((xpos, rect.height-widgetsize[1]))
   192                     widget.SetPosition((xpos, rect.height-widgetsize[1]))
   194 
   193 
   195 
       
   196         if event is not None:
   194         if event is not None:
   197             event.Skip()
   195             event.Skip()
   198 
       
   199 
   196 
   200     def AddWidget(self, widget, horizontalalignment=ESB_ALIGN_CENTER_HORIZONTAL,
   197     def AddWidget(self, widget, horizontalalignment=ESB_ALIGN_CENTER_HORIZONTAL,
   201                   verticalalignment=ESB_ALIGN_CENTER_VERTICAL, pos = -1):
   198                   verticalalignment=ESB_ALIGN_CENTER_VERTICAL, pos = -1):
   202         """Add A Widget To The EnhancedStatusBar.
   199         """Add A Widget To The EnhancedStatusBar.
   203 
   200 
   236                                      ESB_ALIGN_TOP, ESB_ALIGN_BOTTOM]:
   233                                      ESB_ALIGN_TOP, ESB_ALIGN_BOTTOM]:
   237             raise '\nERROR: Parameter "verticalalignment" Should Be One Of '\
   234             raise '\nERROR: Parameter "verticalalignment" Should Be One Of '\
   238                   '"ESB_ALIGN_CENTER_VERTICAL", "ESB_ALIGN_TOP", "ESB_ALIGN_BOTTOM"' \
   235                   '"ESB_ALIGN_CENTER_VERTICAL", "ESB_ALIGN_TOP", "ESB_ALIGN_BOTTOM"' \
   239                   '"ESB_EXACT_FIT"'
   236                   '"ESB_EXACT_FIT"'
   240 
   237 
   241 
       
   242         try:
   238         try:
   243             self.RemoveChild(self._items[pos].widget)
   239             self.RemoveChild(self._items[pos].widget)
   244             self._items[pos].widget.Destroy()
   240             self._items[pos].widget.Destroy()
   245         except KeyError: pass
   241         except KeyError: pass
   246 
   242