1 # Copyright (C) 2010-2012 W. Trevor King <wking@tremily.us>
3 # This file is part of Hooke.
5 # Hooke is free software: you can redistribute it and/or modify it under the
6 # terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation, either version 3 of the License, or (at your option) any
10 # Hooke is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with Hooke. If not, see <http://www.gnu.org/licenses/>.
18 """Status bar for Hooke.
23 from ... import version
26 class StatusBar (wx.StatusBar):
27 def __init__(self, *args, **kwargs):
28 super(StatusBar, self).__init__(*args, **kwargs)
29 self.SetFieldsCount(2)
30 self.SetStatusWidths([-2, -3])
31 self.SetStatusText('Ready', 0)
32 self.SetStatusText(u'Welcome to Hooke (version %s)' % version(), 1)
34 def set_playlist(self, playlist):
35 self.SetStatusText(self._playlist_status(playlist), 0)
37 def set_curve(self, curve):
40 def set_plot_text(self, text):
41 self.SetStatusText(text, 1)
43 def _playlist_status(self, playlist):
46 '(%d/%d)' % (playlist.index(), len(playlist)),
48 curve = playlist.current()
50 fields.append(curve.name)
51 return ' '.join(fields)